only scale if the image is too large
This commit is contained in:
@@ -26,12 +26,16 @@ class ImagePopup(QtWidgets.QLabel):
|
|||||||
self.popup_timer = QtCore.QTimer()
|
self.popup_timer = QtCore.QTimer()
|
||||||
self.popup_timer.timeout.connect(self.check_mouse)
|
self.popup_timer.timeout.connect(self.check_mouse)
|
||||||
|
|
||||||
pixmap = QtGui.QPixmap(filename).scaled(
|
pixmap = QtGui.QPixmap(filename)
|
||||||
settings.value("ImagePopup/w", type=int),
|
W = settings.value("ImagePopup/w", type=int)
|
||||||
settings.value("ImagePopup/h", type=int),
|
H = settings.value("ImagePopup/h", type=int)
|
||||||
aspectRatioMode=QtCore.Qt.AspectRatioMode.KeepAspectRatio,
|
if pixmap.height() > H or pixmap.width() > W:
|
||||||
transformMode=QtCore.Qt.TransformationMode.SmoothTransformation,
|
pixmap = pixmap.scaled(
|
||||||
)
|
W,
|
||||||
|
H,
|
||||||
|
aspectRatioMode=QtCore.Qt.AspectRatioMode.KeepAspectRatio,
|
||||||
|
transformMode=QtCore.Qt.TransformationMode.SmoothTransformation,
|
||||||
|
)
|
||||||
self.setPixmap(pixmap)
|
self.setPixmap(pixmap)
|
||||||
|
|
||||||
self.move(pos - QtCore.QPoint(15, 15))
|
self.move(pos - QtCore.QPoint(15, 15))
|
||||||
|
|||||||
Reference in New Issue
Block a user