diff --git a/src/calibre/gui2/convert/metadata.py b/src/calibre/gui2/convert/metadata.py index b5a866135e..d87310631c 100644 --- a/src/calibre/gui2/convert/metadata.py +++ b/src/calibre/gui2/convert/metadata.py @@ -97,11 +97,14 @@ class MetadataWidget(Widget, Ui_Form): pm = QPixmap() pm.loadFromData(cover) if not pm.isNull(): + pm.setDevicePixelRatio(getattr(self, 'devicePixelRatioF', self.devicePixelRatio)()) self.cover.setPixmap(pm) self.cover_data = cover self.set_cover_tooltip(pm) else: - self.cover.setPixmap(QPixmap(I('default_cover.png'))) + pm = QPixmap(I('default_cover.png')) + pm.setDevicePixelRatio(getattr(self, 'devicePixelRatioF', self.devicePixelRatio)()) + self.cover.setPixmap(pm) self.cover.setToolTip(_('This book has no cover')) for x in ('author', 'series', 'publisher'): x = getattr(self, x) @@ -201,6 +204,7 @@ class MetadataWidget(Widget, Ui_Form): if cover: pix = QPixmap() pix.loadFromData(cover) + pix.setDevicePixelRatio(getattr(self, 'devicePixelRatioF', self.devicePixelRatio)()) if pix.isNull(): d = error_dialog(self.parent(), _('Error reading file'), _file + _(" is not a valid picture")) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 5d8331cfcf..08f0149e78 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -1172,6 +1172,7 @@ class Cover(ImageView): # {{{ pm = QPixmap(I('default_cover.png')) else: self._cdata = cdata + pm.setDevicePixelRatio(getattr(self, 'devicePixelRatioF', self.devicePixelRatio)()) self.setPixmap(pm) tt = _('This book has no cover') if self._cdata: diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index 962f2fcb73..6bc08aea3a 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -343,9 +343,9 @@ class ImageView(QWidget, ImageDropMixin): # {{{ cw, ch = self.rect().width(), self.rect().height() scaled, nw, nh = fit_image(w, h, cw, ch) if scaled: - pmap = pmap.scaled(nw, nh, Qt.IgnoreAspectRatio, + pmap = pmap.scaled(nw*pmap.devicePixelRatio(), nh*pmap.devicePixelRatio(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation) - w, h = pmap.width(), pmap.height() + w, h = pmap.width()/pmap.devicePixelRatio(), pmap.height()/pmap.devicePixelRatio() x = int(abs(cw - w)/2.) y = int(abs(ch - h)/2.) target = QRect(x, y, w, h)