eric6/Project/QuickFindFileDialog.py

changeset 8143
2c730d5fd177
parent 7988
c4c17121eff8
child 8205
4a0f1f896341
--- a/eric6/Project/QuickFindFileDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Project/QuickFindFileDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -55,7 +55,7 @@
         self.installEventFilter(self)
 
         self.stopButton = self.buttonBox.addButton(
-            self.tr("Stop"), QDialogButtonBox.ActionRole)
+            self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole)
         self.project = project
     
     def eventFilter(self, source, event):
@@ -69,19 +69,22 @@
         @return flag indicating that the event was handled
         @rtype bool
         """
-        if event.type() == QEvent.KeyPress:
+        if event.type() == QEvent.Type.KeyPress:
             
             # Anywhere in the dialog, make hitting escape cancel it
-            if event.key() == Qt.Key_Escape:
+            if event.key() == Qt.Key.Key_Escape:
                 self.close()
             
             # Anywhere in the dialog, make hitting up/down choose next item
             # Note: This doesn't really do anything, as other than the text
             #       input there's nothing that doesn't handle up/down already.
-            elif event.key() == Qt.Key_Up or event.key() == Qt.Key_Down:
+            elif (
+                event.key() == Qt.Key.Key_Up or
+                event.key() == Qt.Key.Key_Down
+            ):
                 current = self.fileList.currentItem()
                 index = self.fileList.indexOfTopLevelItem(current)
-                if event.key() == Qt.Key_Up:
+                if event.key() == Qt.Key.Key_Up:
                     if index != 0:
                         self.fileList.setCurrentItem(
                             self.fileList.topLevelItem(index - 1))
@@ -99,7 +102,10 @@
         """
         if button == self.stopButton:
             self.shouldStop = True
-        elif button == self.buttonBox.button(QDialogButtonBox.Open):
+        elif (
+            button ==
+            self.buttonBox.button(QDialogButtonBox.StandardButton.Open)
+        ):
             self.__openFile()
     
     def __openFile(self, itm=None):
@@ -222,7 +228,8 @@
             
         del locations
         self.stopButton.setEnabled(False)
-        self.fileList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.fileList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.fileList.header().setStretchLastSection(True)
         
         if found:
@@ -263,7 +270,7 @@
         @param current current item (QTreeWidgetItem)
         @param previous prevoius current item (QTreeWidgetItem)
         """
-        self.buttonBox.button(QDialogButtonBox.Open).setEnabled(
+        self.buttonBox.button(QDialogButtonBox.StandardButton.Open).setEnabled(
             current is not None)
 
     def show(self):

eric ide

mercurial