25 |
25 |
26 @param parent reference to the parent widget (QWidget) |
26 @param parent reference to the parent widget (QWidget) |
27 """ |
27 """ |
28 super(SnapshotPreview, self).__init__(parent) |
28 super(SnapshotPreview, self).__init__(parent) |
29 |
29 |
30 self.setAlignment(Qt.AlignHCenter | Qt.AlignCenter) |
30 self.setAlignment(Qt.AlignmentFlag.AlignHCenter | |
31 self.setCursor(Qt.OpenHandCursor) |
31 Qt.AlignmentFlag.AlignCenter) |
|
32 self.setCursor(Qt.CursorShape.OpenHandCursor) |
32 |
33 |
33 self.__mouseClickPoint = QPoint(0, 0) |
34 self.__mouseClickPoint = QPoint(0, 0) |
34 |
35 |
35 def setPreview(self, preview): |
36 def setPreview(self, preview): |
36 """ |
37 """ |
39 @param preview preview picture to be shown (QPixmap) |
40 @param preview preview picture to be shown (QPixmap) |
40 """ |
41 """ |
41 if not preview.isNull(): |
42 if not preview.isNull(): |
42 pixmap = preview.scaled( |
43 pixmap = preview.scaled( |
43 self.width(), self.height(), |
44 self.width(), self.height(), |
44 Qt.KeepAspectRatio, Qt.SmoothTransformation) |
45 Qt.AspectRatioMode.KeepAspectRatio, |
|
46 Qt.TransformationMode.SmoothTransformation) |
45 else: |
47 else: |
46 pixmap = preview |
48 pixmap = preview |
47 self.setPixmap(pixmap) |
49 self.setPixmap(pixmap) |
48 |
50 |
49 def mousePressEvent(self, evt): |
51 def mousePressEvent(self, evt): |
50 """ |
52 """ |
51 Protected method to handle mouse button presses. |
53 Protected method to handle mouse button presses. |
52 |
54 |
53 @param evt mouse button press event (QMouseEvent) |
55 @param evt mouse button press event (QMouseEvent) |
54 """ |
56 """ |
55 if evt.button() == Qt.LeftButton: |
57 if evt.button() == Qt.MouseButton.LeftButton: |
56 self.__mouseClickPoint = evt.pos() |
58 self.__mouseClickPoint = evt.pos() |
57 |
59 |
58 def mouseReleaseEvent(self, evt): |
60 def mouseReleaseEvent(self, evt): |
59 """ |
61 """ |
60 Protected method to handle mouse button releases. |
62 Protected method to handle mouse button releases. |