eric6/UI/PythonAstViewer.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/UI/PythonAstViewer.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/UI/PythonAstViewer.py	Tue Mar 02 17:17:09 2021 +0100
@@ -28,10 +28,10 @@
     Class implementing a widget to visualize the Python AST for some Python
     sources.
     """
-    StartLineRole = Qt.UserRole
-    StartIndexRole = Qt.UserRole + 1
-    EndLineRole = Qt.UserRole + 2
-    EndIndexRole = Qt.UserRole + 3
+    StartLineRole = Qt.ItemDataRole.UserRole
+    StartIndexRole = Qt.ItemDataRole.UserRole + 1
+    EndLineRole = Qt.ItemDataRole.UserRole + 2
+    EndIndexRole = Qt.ItemDataRole.UserRole + 3
     
     def __init__(self, viewmanager, parent=None):
         """
@@ -59,8 +59,10 @@
         self.__astWidget.setHeaderLabels([self.tr("Node"),
                                           self.tr("Code Range")])
         self.__astWidget.setSortingEnabled(False)
-        self.__astWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
-        self.__astWidget.setSelectionMode(QAbstractItemView.SingleSelection)
+        self.__astWidget.setSelectionBehavior(
+            QAbstractItemView.SelectionBehavior.SelectRows)
+        self.__astWidget.setSelectionMode(
+            QAbstractItemView.SelectionMode.SingleSelection)
         self.__astWidget.setAlternatingRowColors(True)
         
         self.__errorColor = QBrush(
@@ -107,7 +109,7 @@
         @param buttons mouse buttons that were double clicked
         @type Qt.MouseButtons
         """
-        if editor is self.__editor and buttons == Qt.LeftButton:
+        if editor is self.__editor and buttons == Qt.MouseButton.LeftButton:
             if editor.isModified():
                 # reload the source
                 QTimer.singleShot(0, self.__loadAST)
@@ -489,14 +491,14 @@
             self.__astWidget.topLevelItem(0), selection)
         if itm:
             self.__astWidget.scrollToItem(
-                itm, QAbstractItemView.PositionAtCenter)
+                itm, QAbstractItemView.ScrollHint.PositionAtCenter)
             itm.setSelected(True)
     
     def __grabFocus(self):
         """
         Private method to grab the input focus.
         """
-        self.__astWidget.setFocus(Qt.OtherFocusReason)
+        self.__astWidget.setFocus(Qt.FocusReason.OtherFocusReason)
     
     @pyqtSlot(QTreeWidgetItem, int)
     def __astItemClicked(self, itm, column):

eric ide

mercurial