On linux ensure the cover is always drawn on top of the selection rect in the cover download dialog

This commit is contained in:
Kovid Goyal 2011-04-18 09:48:23 -06:00
parent 724c549ac8
commit 7281c8de79

View File

@ -30,6 +30,7 @@ from calibre.ebooks.metadata.book.base import Metadata
from calibre.gui2 import error_dialog, NONE
from calibre.utils.date import utcnow, fromordinal, format_date
from calibre.library.comments import comments_to_html
from calibre.constants import islinux
from calibre import force_unicode
# }}}
@ -116,6 +117,12 @@ class CoverDelegate(QStyledItemDelegate): # {{{
def paint(self, painter, option, index):
QStyledItemDelegate.paint(self, painter, option, index)
if islinux:
# On linux for some reason the selected color is drawn on top of
# the decoration
style = QApplication.style()
style.drawItemPixmap(painter, option.rect, Qt.AlignTop|Qt.AlignHCenter,
QPixmap(index.data(Qt.DecorationRole)))
if self.timer.isActive() and index.data(Qt.UserRole).toBool():
rect = QRect(0, 0, self.spinner_width, self.spinner_width)
rect.moveCenter(option.rect.center())
@ -945,7 +952,7 @@ class CoverFetch(QDialog): # {{{
# }}}
if __name__ == '__main__':
#DEBUG_DIALOG = True
DEBUG_DIALOG = True
app = QApplication([])
d = FullFetch()
d.start(title='great gatsby', authors=['fitzgerald'])