eric6/QScintilla/SearchReplaceWidget.py

changeset 8143
2c730d5fd177
parent 8130
5fe4ff181b68
child 8218
7c09585bd960
--- a/eric6/QScintilla/SearchReplaceWidget.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/QScintilla/SearchReplaceWidget.py	Tue Mar 02 17:17:09 2021 +0100
@@ -168,14 +168,16 @@
             self.tr('Find Next'),
             0, 0, self, 'search_widget_find_next')
         self.findNextAct.triggered.connect(self.on_findNextButton_clicked)
-        self.findNextAct.setShortcutContext(Qt.WidgetWithChildrenShortcut)
+        self.findNextAct.setShortcutContext(
+            Qt.ShortcutContext.WidgetWithChildrenShortcut)
         
         self.findPrevAct = E5Action(
             self.tr('Find Prev'),
             self.tr('Find Prev'),
             0, 0, self, 'search_widget_find_prev')
         self.findPrevAct.triggered.connect(self.on_findPrevButton_clicked)
-        self.findPrevAct.setShortcutContext(Qt.WidgetWithChildrenShortcut)
+        self.findPrevAct.setShortcutContext(
+            Qt.ShortcutContext.WidgetWithChildrenShortcut)
         
         if replace:
             self.replaceAndSearchAct = E5Action(
@@ -186,7 +188,7 @@
                 self.on_replaceSearchButton_clicked)
             self.replaceAndSearchAct.setEnabled(False)
             self.replaceAndSearchAct.setShortcutContext(
-                Qt.WidgetWithChildrenShortcut)
+                Qt.ShortcutContext.WidgetWithChildrenShortcut)
             
             self.replaceSelectionAct = E5Action(
                 self.tr("Replace Occurrence"),
@@ -196,7 +198,7 @@
                 self.on_replaceButton_clicked)
             self.replaceSelectionAct.setEnabled(False)
             self.replaceSelectionAct.setShortcutContext(
-                Qt.WidgetWithChildrenShortcut)
+                Qt.ShortcutContext.WidgetWithChildrenShortcut)
             
             self.replaceAllAct = E5Action(
                 self.tr("Replace All"),
@@ -206,7 +208,7 @@
                 self.on_replaceAllButton_clicked)
             self.replaceAllAct.setEnabled(False)
             self.replaceAllAct.setShortcutContext(
-                Qt.WidgetWithChildrenShortcut)
+                Qt.ShortcutContext.WidgetWithChildrenShortcut)
         
         self.addAction(self.findNextAct)
         self.addAction(self.findPrevAct)
@@ -306,7 +308,7 @@
         
         @param evt event containing the state change (QEvent)
         """
-        if evt.type() == QEvent.FontChange:
+        if evt.type() == QEvent.Type.FontChange:
             self.adjustSize()
     
     def __selectionBoundary(self, selections=None):
@@ -434,17 +436,17 @@
         """
         if not ok:
             palette = self.ui.findtextCombo.lineEdit().palette()
-            palette.setColor(QPalette.Base, QColor("red"))
-            palette.setColor(QPalette.Text, QColor("white"))
+            palette.setColor(QPalette.ColorRole.Base, QColor("red"))
+            palette.setColor(QPalette.ColorRole.Text, QColor("white"))
             self.ui.findtextCombo.lineEdit().setPalette(palette)
         else:
             palette = self.ui.findtextCombo.lineEdit().palette()
             palette.setColor(
-                QPalette.Base,
-                self.ui.findtextCombo.palette().color(QPalette.Base))
+                QPalette.ColorRole.Base,
+                self.ui.findtextCombo.palette().color(QPalette.ColorRole.Base))
             palette.setColor(
-                QPalette.Text,
-                self.ui.findtextCombo.palette().color(QPalette.Text))
+                QPalette.ColorRole.Text,
+                self.ui.findtextCombo.palette().color(QPalette.ColorRole.Text))
             self.ui.findtextCombo.lineEdit().setPalette(palette)
     
     @pyqtSlot()
@@ -1209,10 +1211,10 @@
         
         @param event reference to the key press event (QKeyEvent)
         """
-        if event.key() == Qt.Key_Escape:
+        if event.key() == Qt.Key.Key_Escape:
             aw = self.__viewmanager.activeWindow()
             if aw:
-                aw.setFocus(Qt.ActiveWindowFocusReason)
+                aw.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
                 aw.hideFindIndicator()
             event.accept()
             if self.__sliding:
@@ -1245,27 +1247,29 @@
         self.__layout = QHBoxLayout(self)
         self.setLayout(self.__layout)
         self.__layout.setContentsMargins(0, 0, 0, 0)
-        self.__layout.setAlignment(Qt.AlignTop)
+        self.__layout.setAlignment(Qt.AlignmentFlag.AlignTop)
         
         self.__leftButton = QToolButton(self)
-        self.__leftButton.setArrowType(Qt.LeftArrow)
+        self.__leftButton.setArrowType(Qt.ArrowType.LeftArrow)
         self.__leftButton.setSizePolicy(
-            QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
+            QSizePolicy.Policy.Minimum, QSizePolicy.Policy.MinimumExpanding)
         self.__leftButton.setAutoRepeat(True)
         
         self.__scroller = QScrollArea(self)
         self.__scroller.setWidget(self.__searchReplaceWidget)
         self.__scroller.setSizePolicy(
-            QSizePolicy.Expanding, QSizePolicy.Minimum)
-        self.__scroller.setFrameShape(QFrame.NoFrame)
-        self.__scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
-        self.__scroller.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
+            QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
+        self.__scroller.setFrameShape(QFrame.Shape.NoFrame)
+        self.__scroller.setVerticalScrollBarPolicy(
+            Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
+        self.__scroller.setHorizontalScrollBarPolicy(
+            Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
         self.__scroller.setWidgetResizable(False)
         
         self.__rightButton = QToolButton(self)
-        self.__rightButton.setArrowType(Qt.RightArrow)
+        self.__rightButton.setArrowType(Qt.ArrowType.RightArrow)
         self.__rightButton.setSizePolicy(
-            QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
+            QSizePolicy.Policy.Minimum, QSizePolicy.Policy.MinimumExpanding)
         self.__rightButton.setAutoRepeat(True)
         
         self.__layout.addWidget(self.__leftButton)
@@ -1286,7 +1290,7 @@
 
         @param evt event containing the state change (QEvent)
         """
-        if evt.type() == QEvent.FontChange:
+        if evt.type() == QEvent.Type.FontChange:
             self.setMaximumHeight(
                 self.__searchReplaceWidget.sizeHint().height())
             self.adjustSize()

eric ide

mercurial