eric6/E5Gui/E5ModelMenu.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/E5Gui/E5ModelMenu.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/E5Gui/E5ModelMenu.py	Tue Mar 02 17:17:09 2021 +0100
@@ -41,8 +41,9 @@
         
         self.setAcceptDrops(True)
         
-        self._mouseButton = Qt.NoButton
-        self._keyboardModifiers = Qt.KeyboardModifiers(Qt.NoModifier)
+        self._mouseButton = Qt.MouseButton.NoButton
+        self._keyboardModifiers = Qt.KeyboardModifiers(
+            Qt.KeyboardModifier.NoModifier)
         self.__dropRow = -1
         self.__dropIndex = None
         
@@ -203,7 +204,7 @@
             modelMenu.triggered.disconnect(modelMenu.__actionTriggered)
             modelMenu.setTitle(title)
             
-            icon = parent.data(Qt.DecorationRole)
+            icon = parent.data(Qt.ItemDataRole.DecorationRole)
             if icon == NotImplemented or icon is None:
                 icon = UI.PixmapCache.getIcon("defaultIcon")
             modelMenu.setIcon(icon)
@@ -243,7 +244,7 @@
         @param idx index of the item to create an action for (QModelIndex)
         @return reference to the created action (QAction)
         """
-        icon = idx.data(Qt.DecorationRole)
+        icon = idx.data(Qt.ItemDataRole.DecorationRole)
         if icon == NotImplemented or icon is None:
             icon = UI.PixmapCache.getIcon("defaultIcon")
         action = self.makeAction(icon, idx.data(), self)
@@ -269,7 +270,8 @@
                 self.__maxWidth = fm.horizontalAdvance("m") * 30
             except AttributeError:
                 self.__maxWidth = fm.width('m') * 30
-        smallText = fm.elidedText(text, Qt.ElideMiddle, self.__maxWidth)
+        smallText = fm.elidedText(text, Qt.TextElideMode.ElideMiddle,
+                                  self.__maxWidth)
         
         return QAction(icon, smallText, parent)
     
@@ -354,7 +356,7 @@
         
         @param evt reference to the event object (QMouseEvent)
         """
-        if evt.button() == Qt.LeftButton:
+        if evt.button() == Qt.MouseButton.LeftButton:
             self.__dragStartPosition = evt.pos()
         super(E5ModelMenu, self).mousePressEvent(evt)
     
@@ -368,7 +370,7 @@
             super(E5ModelMenu, self).mouseMoveEvent(evt)
             return
         
-        if not (evt.buttons() & Qt.LeftButton):
+        if not (evt.buttons() & Qt.MouseButton.LeftButton):
             super(E5ModelMenu, self).mouseMoveEvent(evt)
             return
         
@@ -397,7 +399,7 @@
         actionRect = self.actionGeometry(act)
         drag.setPixmap(self.grab(actionRect))
         
-        if drag.exec() == Qt.MoveAction:
+        if drag.exec() == Qt.DropAction.MoveAction:
             row = idx.row()
             if self.__dropIndex == idx.parent() and self.__dropRow <= row:
                 row += 1
@@ -417,7 +419,7 @@
         self._mouseButton = evt.button()
         self._keyboardModifiers = evt.modifiers()
         
-        if evt.button() == Qt.LeftButton:
+        if evt.button() == Qt.MouseButton.LeftButton:
             self.__dragStartPosition = QPoint()
         
         super(E5ModelMenu, self).mouseReleaseEvent(evt)
@@ -426,8 +428,9 @@
         """
         Public method to reset the saved internal state.
         """
-        self._mouseButton = Qt.NoButton
-        self._keyboardModifiers = Qt.KeyboardModifiers(Qt.NoModifier)
+        self._mouseButton = Qt.MouseButton.NoButton
+        self._keyboardModifiers = Qt.KeyboardModifiers(
+            Qt.KeyboardModifier.NoModifier)
     
     def removeEntry(self, idx):
         """

eric ide

mercurial