From d23532e499857db6dfbfd2b0a1d9bfb9370cc9b3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 7 Sep 2016 10:57:54 +0530 Subject: [PATCH] Edit Book: Fix high-dpi rendering of emblems in the File Browser --- src/calibre/gui2/tweak_book/file_list.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/file_list.py b/src/calibre/gui2/tweak_book/file_list.py index cb7a1d3880..a06fdd02d7 100644 --- a/src/calibre/gui2/tweak_book/file_list.py +++ b/src/calibre/gui2/tweak_book/file_list.py @@ -344,10 +344,11 @@ class FileList(QTreeWidget): icon = self.rendered_emblem_cache[emblems] = QIcon(pixmaps[0]) else: canvas = QPixmap((num * w) + ((num-1)*2), h) + canvas.setDevicePixelRatio(pixmaps[0].devicePixelRatio()) canvas.fill(Qt.transparent) painter = QPainter(canvas) for i, pm in enumerate(pixmaps): - painter.drawPixmap(i * (w + 2), 0, pm) + painter.drawPixmap(int(i * (w + 2)/canvas.devicePixelRatio()), 0, pm) painter.end() icon = self.rendered_emblem_cache[emblems] = canvas item.setData(0, Qt.DecorationRole, icon)