eric6/E5Gui/E5ToolButton.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/E5Gui/E5ToolButton.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/E5Gui/E5ToolButton.py	Tue Mar 02 17:17:09 2021 +0100
@@ -63,7 +63,7 @@
         self.__pressTimer.setSingleShot(True)
         self.__pressTimer.setInterval(
             QApplication.style().styleHint(
-                QStyle.SH_ToolButton_PopupDelay, opt, self))
+                QStyle.StyleHint.SH_ToolButton_PopupDelay, opt, self))
         self.__pressTimer.timeout.connect(self.__showMenu)
     
     ##################################################################
@@ -131,7 +131,10 @@
         
         if self.__options & E5ToolButton.ShowMenuInsideOption:
             pos = self.mapToGlobal(self.rect().bottomRight())
-            if QApplication.layoutDirection() == Qt.RightToLeft:
+            if (
+                QApplication.layoutDirection() ==
+                Qt.LayoutDirection.RightToLeft
+            ):
                 pos.setX(pos.x() - self.rect().width())
             else:
                 pos.setX(pos.x() - self.__menu.sizeHint().width())
@@ -174,7 +177,7 @@
             opt = QStyleOption()
             opt.initFrom(self)
             size = self.style().pixelMetric(
-                QStyle.PM_ToolBarIconSize, opt, self)
+                QStyle.PixelMetric.PM_ToolBarIconSize, opt, self)
             self.setIconSize(QSize(size, size))
         else:
             self.__options &= ~E5ToolButton.ToolBarLookOption
@@ -194,18 +197,18 @@
         @param evt reference to the mouse event
         @type QMouseEvent
         """
-        if self.popupMode() == QToolButton.DelayedPopup:
+        if self.popupMode() == QToolButton.ToolButtonPopupMode.DelayedPopup:
             self.__pressTimer.start()
         
         if (
-            evt.buttons() == Qt.LeftButton and
+            evt.buttons() == Qt.MouseButton.LeftButton and
             self.__menu is not None and
-            self.popupMode() == QToolButton.InstantPopup
+            self.popupMode() == QToolButton.ToolButtonPopupMode.InstantPopup
         ):
             self.setDown(True)
             self.__showMenu()
         elif (
-            evt.buttons() == Qt.RightButton and
+            evt.buttons() == Qt.MouseButton.RightButton and
             self.__menu is not None
         ):
             self.setDown(True)
@@ -223,15 +226,15 @@
         self.__pressTimer.stop()
         
         if (
-            evt.button() == Qt.MiddleButton and
+            evt.button() == Qt.MouseButton.MiddleButton and
             self.rect().contains(evt.pos())
         ):
             self.middleClicked.emit()
             self.setDown(False)
         elif (
-            evt.button() == Qt.LeftButton and
+            evt.button() == Qt.MouseButton.LeftButton and
             self.rect().contains(evt.pos()) and
-            evt.modifiers() == Qt.ControlModifier
+            evt.modifiers() == Qt.KeyboardModifier.ControlModifier
         ):
             self.controlClicked.emit()
             self.setDown(False)
@@ -249,7 +252,7 @@
         
         self.__pressTimer.stop()
         
-        if evt.buttons() == Qt.LeftButton:
+        if evt.buttons() == Qt.MouseButton.LeftButton:
             self.doubleClicked.emit()
     
     def contextMenuEvent(self, evt):

eric ide

mercurial