5 |
5 |
6 """ |
6 """ |
7 Module implementing the label to show the web site icon. |
7 Module implementing the label to show the web site icon. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtCore import Qt, QPoint, QMimeData |
10 from PyQt6.QtCore import Qt, QPoint, QMimeData |
11 from PyQt5.QtGui import QDrag, QPixmap |
11 from PyQt6.QtGui import QDrag, QPixmap |
12 from PyQt5.QtWidgets import QLabel, QApplication |
12 from PyQt6.QtWidgets import QLabel, QApplication |
13 |
13 |
14 |
14 |
15 class FavIconLabel(QLabel): |
15 class FavIconLabel(QLabel): |
16 """ |
16 """ |
17 Class implementing the label to show the web site icon. |
17 Class implementing the label to show the web site icon. |
64 Protected method to handle mouse press events. |
64 Protected method to handle mouse press events. |
65 |
65 |
66 @param evt reference to the mouse event (QMouseEvent) |
66 @param evt reference to the mouse event (QMouseEvent) |
67 """ |
67 """ |
68 if evt.button() == Qt.MouseButton.LeftButton: |
68 if evt.button() == Qt.MouseButton.LeftButton: |
69 self.__dragStartPos = evt.pos() |
69 self.__dragStartPos = evt.position().toPoint() |
70 super().mousePressEvent(evt) |
70 super().mousePressEvent(evt) |
71 |
71 |
72 def mouseReleaseEvent(self, evt): |
72 def mouseReleaseEvent(self, evt): |
73 """ |
73 """ |
74 Protected method to handle mouse release events. |
74 Protected method to handle mouse release events. |
85 |
85 |
86 @param evt reference to the mouse event (QMouseEvent) |
86 @param evt reference to the mouse event (QMouseEvent) |
87 """ |
87 """ |
88 if ( |
88 if ( |
89 evt.button() == Qt.MouseButton.LeftButton and |
89 evt.button() == Qt.MouseButton.LeftButton and |
90 ((evt.pos() - self.__dragStartPos).manhattanLength() > |
90 ((evt.position().toPoint() - self.__dragStartPos).manhattanLength() > |
91 QApplication.startDragDistance()) and |
91 QApplication.startDragDistance()) and |
92 self.__browser is not None |
92 self.__browser is not None |
93 ): |
93 ): |
94 drag = QDrag(self) |
94 drag = QDrag(self) |
95 mimeData = QMimeData() |
95 mimeData = QMimeData() |