Fix rendering of cover in book details popup window on high DPI screens

This commit is contained in:
Kovid Goyal 2016-08-24 21:06:26 +05:30
parent 1e90aaa1a8
commit 0b4ff115a8

View File

@ -166,8 +166,10 @@ class BookInfo(QDialog):
pixmap.height(), self.cover.size().width()-10, pixmap.height(), self.cover.size().width()-10,
self.cover.size().height()-10) self.cover.size().height()-10)
if scaled: if scaled:
pixmap = pixmap.scaled(new_width, new_height, dpr = self.devicePixelRatio()
pixmap = pixmap.scaled(int(dpr * new_width), int(dpr * new_height),
Qt.KeepAspectRatio, Qt.SmoothTransformation) Qt.KeepAspectRatio, Qt.SmoothTransformation)
pixmap.setDevicePixelRatio(dpr)
self.cover.set_pixmap(pixmap) self.cover.set_pixmap(pixmap)
self.update_cover_tooltip() self.update_cover_tooltip()
@ -198,6 +200,7 @@ class BookInfo(QDialog):
self.current_row = row self.current_row = row
self.setWindowTitle(mi.title) self.setWindowTitle(mi.title)
self.cover_pixmap = QPixmap.fromImage(mi.cover_data[1]) self.cover_pixmap = QPixmap.fromImage(mi.cover_data[1])
self.cover_pixmap.setDevicePixelRatio(self.devicePixelRatio())
self.resize_cover() self.resize_cover()
html = render_html(mi, self.css, True, self, all_fields=True) html = render_html(mi, self.css, True, self, all_fields=True)
self.details.setHtml(html) self.details.setHtml(html)