eric6/UI/PythonDisViewer.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/UI/PythonDisViewer.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/UI/PythonDisViewer.py	Tue Mar 02 17:17:09 2021 +0100
@@ -41,9 +41,9 @@
     Class implementing a widget to visualize the Python Disassembly for some
     Python sources.
     """
-    StartLineRole = Qt.UserRole
-    EndLineRole = Qt.UserRole + 1
-    CodeInfoRole = Qt.UserRole + 2
+    StartLineRole = Qt.ItemDataRole.UserRole
+    EndLineRole = Qt.ItemDataRole.UserRole + 1
+    CodeInfoRole = Qt.ItemDataRole.UserRole + 2
     
     def __init__(self, viewmanager,
                  mode=PythonDisViewerModes.SourceDisassemblyMode,
@@ -360,7 +360,7 @@
         
         itm = QTreeWidgetItem(parent, fields)
         for col in (0, 1, 3):
-            itm.setTextAlignment(col, Qt.AlignRight)
+            itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight)
         # set font to indicate current instruction and jump target
         font = itm.font(0)
         if instr.offset == lasti:
@@ -553,11 +553,14 @@
                 if lasti:
                     lastInstructions = self.disWidget.findItems(
                         "{0:d}".format(lasti),
-                        Qt.MatchFixedString | Qt.MatchRecursive, 1)
+                        Qt.MatchFlag.MatchFixedString |
+                        Qt.MatchFlag.MatchRecursive,
+                        1
+                    )
                     if lastInstructions:
                         self.disWidget.scrollToItem(
                             lastInstructions[0],
-                            QAbstractItemView.PositionAtCenter)
+                            QAbstractItemView.ScrollHint.PositionAtCenter)
                 
                 if "codeinfo" in disassembly:
                     self.__showCodeInfoData(disassembly["codeinfo"])
@@ -609,7 +612,7 @@
             
             if child.data(0, self.StartLineRole) == lineno:
                 self.disWidget.scrollToItem(
-                    child, QAbstractItemView.PositionAtCenter)
+                    child, QAbstractItemView.ScrollHint.PositionAtCenter)
     
     def __selectItemForEditorLine(self):
         """
@@ -802,7 +805,7 @@
             
             for index, value in enumerate(infoList):
                 itm = QTreeWidgetItem(parent, [str(index), str(value)])
-                itm.setTextAlignment(0, Qt.AlignRight)
+                itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
         
         self.codeInfoWidget.clear()
         

eric ide

mercurial