RefactoringRope/MatchesDialog.py

branch
eric7
changeset 365
f740b50380df
parent 354
a967ff16629a
child 374
958f34e97952
--- a/RefactoringRope/MatchesDialog.py	Wed May 26 17:53:08 2021 +0200
+++ b/RefactoringRope/MatchesDialog.py	Wed May 26 19:07:42 2021 +0200
@@ -7,12 +7,12 @@
 Module implementing a dialog to show matching references/definitions.
 """
 
-from PyQt5.QtCore import pyqtSlot, Qt
-from PyQt5.QtWidgets import (
+from PyQt6.QtCore import pyqtSlot, Qt
+from PyQt6.QtWidgets import (
     QDialog, QTreeWidgetItem, QDialogButtonBox, QHeaderView
 )
 
-from E5Gui.E5Application import e5App
+from EricWidgets.EricApplication import ericApp
 
 from .Ui_MatchesDialog import Ui_MatchesDialog
 
@@ -21,7 +21,7 @@
     """
     Class implementing a dialog to show matching references/definitions.
     """
-    FilePathRole = Qt.UserRole
+    FilePathRole = Qt.ItemDataRole.UserRole
     
     def __init__(self, ui, showConfidence, parent=None, name=None):
         """
@@ -42,15 +42,17 @@
             self.setObjectName(name)
         self.setupUi(self)
         
-        self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         
         self.ui = ui
         self.__showConfidence = showConfidence
-        self.__e5project = e5App().getObject("Project")
+        self.__e5project = ericApp().getObject("Project")
         
         if not self.__showConfidence:
             self.matchesList.setColumnHidden(2, True)
-        self.matchesList.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.matchesList.header().setSortIndicator(
+            0, Qt.SortOrder.AscendingOrder)
     
     def __resort(self):
         """
@@ -64,7 +66,8 @@
         """
         Private method to resize the list columns.
         """
-        self.matchesList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.matchesList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.matchesList.header().setStretchLastSection(True)
     
     @pyqtSlot(QTreeWidgetItem, int)
@@ -79,7 +82,7 @@
         """
         lineno = int(item.text(1))
         fn = item.data(0, MatchesDialog.FilePathRole)
-        e5App().getObject("ViewManager").openSourceFile(fn, lineno)
+        ericApp().getObject("ViewManager").openSourceFile(fn, lineno)
     
     def addEntry(self, filename, lineno, unsure=False):
         """
@@ -99,7 +102,7 @@
              " {0:5d}".format(lineno),
              " {0:5d}%".format(conf)])
         itm.setData(0, MatchesDialog.FilePathRole, filename)
-        itm.setTextAlignment(1, Qt.AlignRight)
-        itm.setTextAlignment(2, Qt.AlignRight)
+        itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight)
+        itm.setTextAlignment(2, Qt.AlignmentFlag.AlignRight)
         self.__resort()
         self.__resizeColumns()

eric ide

mercurial