56 painter = QPainter(self)
57 previewSize = self.size()*self.devicePixelRatioF()
60 if self.
image.width() <= previewSize.width()
or self.
image.height() <= previewSize.height():
62 image = self.
image.scaled(previewSize, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.FastTransformation)
64 image = self.
image.scaled(previewSize, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation)
65 image.setDevicePixelRatio(self.devicePixelRatioF())
67 x_offset = int(self.width() - image.width()/self.devicePixelRatioF())
69 x_offset = int((self.width() - image.width()/self.devicePixelRatioF()) / 2)
72 painter.drawImage(x_offset, 0, image)