eric6/WebBrowser/WebBrowserTabBar.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8205
4a0f1f896341
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
55 if not preview.isNull(): 55 if not preview.isNull():
56 w = self.tabSizeHint(index).width() 56 w = self.tabSizeHint(index).width()
57 h = int(w * currentBrowser.height() / currentBrowser.width()) 57 h = int(w * currentBrowser.height() / currentBrowser.width())
58 58
59 self.__previewPopup = E5PassivePopup(self) 59 self.__previewPopup = E5PassivePopup(self)
60 self.__previewPopup.setFrameShape(QFrame.StyledPanel) 60 self.__previewPopup.setFrameShape(QFrame.Shape.StyledPanel)
61 self.__previewPopup.setFrameShadow(QFrame.Plain) 61 self.__previewPopup.setFrameShadow(QFrame.Shadow.Plain)
62 self.__previewPopup.setFixedSize(w, h) 62 self.__previewPopup.setFixedSize(w, h)
63 self.__previewPopup.setCustomData("index", index) 63 self.__previewPopup.setCustomData("index", index)
64 64
65 label = QLabel() 65 label = QLabel()
66 label.setPixmap(preview.scaled(w, h)) 66 label.setPixmap(preview.scaled(w, h))
67 67
68 self.__previewPopup.setView(label) 68 self.__previewPopup.setView(label)
69 self.__previewPopup.layout().setAlignment(Qt.AlignTop) 69 self.__previewPopup.layout().setAlignment(
70 Qt.AlignmentFlag.AlignTop)
70 self.__previewPopup.layout().setContentsMargins(0, 0, 0, 0) 71 self.__previewPopup.layout().setContentsMargins(0, 0, 0, 0)
71 72
72 tr = self.tabRect(index) 73 tr = self.tabRect(index)
73 pos = QPoint(tr.x(), tr.y() + tr.height()) 74 pos = QPoint(tr.x(), tr.y() + tr.height())
74 75
104 105
105 # If found and not the current tab then show tab preview 106 # If found and not the current tab then show tab preview
106 if ( 107 if (
107 tabIndex != -1 and 108 tabIndex != -1 and
108 tabIndex != self.currentIndex() and 109 tabIndex != self.currentIndex() and
109 evt.buttons() == Qt.NoButton 110 evt.buttons() == Qt.MouseButton.NoButton
110 ): 111 ):
111 if ( 112 if (
112 self.__previewPopup is None or 113 self.__previewPopup is None or
113 (self.__previewPopup is not None and 114 (self.__previewPopup is not None and
114 self.__previewPopup.getCustomData("index") != tabIndex) 115 self.__previewPopup.getCustomData("index") != tabIndex)
155 156
156 @param evt reference to the event to be handled (QEvent) 157 @param evt reference to the event to be handled (QEvent)
157 @return flag indicating, if the event was handled (boolean) 158 @return flag indicating, if the event was handled (boolean)
158 """ 159 """
159 if ( 160 if (
160 evt.type() == QEvent.ToolTip and 161 evt.type() == QEvent.Type.ToolTip and
161 Preferences.getWebBrowser("ShowPreview") 162 Preferences.getWebBrowser("ShowPreview")
162 ): 163 ):
163 # suppress tool tips if we are showing previews 164 # suppress tool tips if we are showing previews
164 evt.setAccepted(True) 165 evt.setAccepted(True)
165 return True 166 return True

eric ide

mercurial