102 if self.tabRect(i).contains(evt.pos()): |
102 if self.tabRect(i).contains(evt.pos()): |
103 tabIndex = i |
103 tabIndex = i |
104 i += 1 |
104 i += 1 |
105 |
105 |
106 # If found and not the current tab then show tab preview |
106 # If found and not the current tab then show tab preview |
107 if tabIndex != -1 and \ |
107 if ( |
108 tabIndex != self.currentIndex() and \ |
108 tabIndex != -1 and |
109 evt.buttons() == Qt.NoButton: |
109 tabIndex != self.currentIndex() and |
110 if self.__previewPopup is None or \ |
110 evt.buttons() == Qt.NoButton |
|
111 ): |
|
112 if ( |
|
113 self.__previewPopup is None or |
111 (self.__previewPopup is not None and |
114 (self.__previewPopup is not None and |
112 self.__previewPopup.getCustomData("index") != tabIndex): |
115 self.__previewPopup.getCustomData("index") != tabIndex) |
|
116 ): |
113 QTimer.singleShot( |
117 QTimer.singleShot( |
114 0, lambda: self.__showTabPreview(tabIndex)) |
118 0, lambda: self.__showTabPreview(tabIndex)) |
115 |
119 |
116 # If current tab or not found then hide previous tab preview |
120 # If current tab or not found then hide previous tab preview |
117 if tabIndex == self.currentIndex() or \ |
121 if ( |
118 tabIndex == -1: |
122 tabIndex == self.currentIndex() or |
|
123 tabIndex == -1 |
|
124 ): |
119 self.__hidePreview() |
125 self.__hidePreview() |
120 |
126 |
121 def leaveEvent(self, evt): |
127 def leaveEvent(self, evt): |
122 """ |
128 """ |
123 Protected method to handle leave events. |
129 Protected method to handle leave events. |
149 handling of all others to the superclass. |
155 handling of all others to the superclass. |
150 |
156 |
151 @param evt reference to the event to be handled (QEvent) |
157 @param evt reference to the event to be handled (QEvent) |
152 @return flag indicating, if the event was handled (boolean) |
158 @return flag indicating, if the event was handled (boolean) |
153 """ |
159 """ |
154 if evt.type() == QEvent.ToolTip and \ |
160 if ( |
155 Preferences.getWebBrowser("ShowPreview"): |
161 evt.type() == QEvent.ToolTip and |
|
162 Preferences.getWebBrowser("ShowPreview") |
|
163 ): |
156 # suppress tool tips if we are showing previews |
164 # suppress tool tips if we are showing previews |
157 evt.setAccepted(True) |
165 evt.setAccepted(True) |
158 return True |
166 return True |
159 |
167 |
160 return super(WebBrowserTabBar, self).event(evt) |
168 return super(WebBrowserTabBar, self).event(evt) |