This commit is contained in:
Kovid Goyal 2016-08-25 20:56:28 +05:30
parent ae0ccff893
commit 402fc88b73
2 changed files with 5 additions and 2 deletions

View File

@ -497,7 +497,7 @@ class Delegate(QStyledItemDelegate):
pixmap = index.data(Qt.DecorationRole) pixmap = index.data(Qt.DecorationRole)
if pixmap and not pixmap.isNull(): if pixmap and not pixmap.isNull():
rect = option.rect.adjusted(0, self.SPACING, COVER_SIZE[0] - option.rect.width(), - self.SPACING) rect = option.rect.adjusted(0, self.SPACING, COVER_SIZE[0] - option.rect.width(), - self.SPACING)
painter.drawPixmap(rect, pixmap, pixmap.rect()) painter.drawPixmap(rect, pixmap)
if option.state & QStyle.State_Selected: if option.state & QStyle.State_Selected:
painter.setPen(QPen(QApplication.instance().palette().highlightedText().color())) painter.setPen(QPen(QApplication.instance().palette().highlightedText().color()))
bottom = option.rect.bottom() - 2 bottom = option.rect.bottom() - 2
@ -690,6 +690,7 @@ class ChooseTheme(Dialog):
theme['cover-pixmap'] = p = QPixmap() theme['cover-pixmap'] = p = QPixmap()
if isinstance(cdata, bytes): if isinstance(cdata, bytes):
p.loadFromData(cdata) p.loadFromData(cdata)
p.setDevicePixelRatio(self.devicePixelRatio())
item = self.item_from_name(theme['name']) item = self.item_from_name(theme['name'])
if item is not None: if item is not None:
item.setData(Qt.DecorationRole, p) item.setData(Qt.DecorationRole, p)

View File

@ -239,7 +239,9 @@ class Background(QWidget): # {{{
from calibre.gui2.preferences.texture_chooser import texture_path from calibre.gui2.preferences.texture_chooser import texture_path
path = texture_path(self.btex) path = texture_path(self.btex)
if path: if path:
self.brush.setTexture(QPixmap(path)) p = QPixmap(path)
p.setDevicePixelRatio(self.devicePixelRatio())
self.brush.setTexture(p)
self.update() self.update()
def sizeHint(self): def sizeHint(self):