src/eric7/WebBrowser/UrlBar/FavIconLabel.py

branch
eric7
changeset 10436
f6881d10e995
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10435:c712d09cc839 10436:f6881d10e995
19 19
20 def __init__(self, parent=None): 20 def __init__(self, parent=None):
21 """ 21 """
22 Constructor 22 Constructor
23 23
24 @param parent reference to the parent widget (QWidget) 24 @param parent reference to the parent widget
25 @type QWidget
25 """ 26 """
26 super().__init__(parent) 27 super().__init__(parent)
27 28
28 self.__browser = None 29 self.__browser = None
29 self.__dragStartPos = QPoint() 30 self.__dragStartPos = QPoint()
50 51
51 def setBrowser(self, browser): 52 def setBrowser(self, browser):
52 """ 53 """
53 Public method to set the browser connection. 54 Public method to set the browser connection.
54 55
55 @param browser reference to the browser widegt (HelpBrowser) 56 @param browser reference to the browser widget
57 @type WebBrowserView
56 """ 58 """
57 self.__browser = browser 59 self.__browser = browser
58 self.__browser.loadFinished.connect(self.__browserIconChanged) 60 self.__browser.loadFinished.connect(self.__browserIconChanged)
59 self.__browser.faviconChanged.connect(self.__browserIconChanged) 61 self.__browser.faviconChanged.connect(self.__browserIconChanged)
60 self.__browser.loadStarted.connect(self.__clearIcon) 62 self.__browser.loadStarted.connect(self.__clearIcon)
61 63
62 def mousePressEvent(self, evt): 64 def mousePressEvent(self, evt):
63 """ 65 """
64 Protected method to handle mouse press events. 66 Protected method to handle mouse press events.
65 67
66 @param evt reference to the mouse event (QMouseEvent) 68 @param evt reference to the mouse event
69 @type QMouseEvent
67 """ 70 """
68 if evt.button() == Qt.MouseButton.LeftButton: 71 if evt.button() == Qt.MouseButton.LeftButton:
69 self.__dragStartPos = evt.position().toPoint() 72 self.__dragStartPos = evt.position().toPoint()
70 super().mousePressEvent(evt) 73 super().mousePressEvent(evt)
71 74
72 def mouseReleaseEvent(self, evt): 75 def mouseReleaseEvent(self, evt):
73 """ 76 """
74 Protected method to handle mouse release events. 77 Protected method to handle mouse release events.
75 78
76 @param evt reference to the mouse event (QMouseEvent) 79 @param evt reference to the mouse event
80 @type QMouseEvent
77 """ 81 """
78 if evt.button() == Qt.MouseButton.LeftButton: 82 if evt.button() == Qt.MouseButton.LeftButton:
79 self.__showPopup(evt.globalPosition().toPoint()) 83 self.__showPopup(evt.globalPosition().toPoint())
80 super().mouseReleaseEvent(evt) 84 super().mouseReleaseEvent(evt)
81 85
82 def mouseMoveEvent(self, evt): 86 def mouseMoveEvent(self, evt):
83 """ 87 """
84 Protected method to handle mouse move events. 88 Protected method to handle mouse move events.
85 89
86 @param evt reference to the mouse event (QMouseEvent) 90 @param evt reference to the mouse event
91 @type QMouseEvent
87 """ 92 """
88 if ( 93 if (
89 evt.button() == Qt.MouseButton.LeftButton 94 evt.button() == Qt.MouseButton.LeftButton
90 and ( 95 and (
91 (evt.position().toPoint() - self.__dragStartPos).manhattanLength() 96 (evt.position().toPoint() - self.__dragStartPos).manhattanLength()

eric ide

mercurial