eric7/WebBrowser/UrlBar/FavIconLabel.py

branch
eric7
changeset 8318
962bce857696
parent 8312
800c432b34c8
child 8319
ea11a3948f40
equal deleted inserted replaced
8316:0c7a44af84bc 8318:962bce857696
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()

eric ide

mercurial