eric6/Preferences/ConfigurationDialog.py

changeset 8143
2c730d5fd177
parent 8069
1176a936efa4
child 8176
31965986ecd1
child 8205
4a0f1f896341
--- a/eric6/Preferences/ConfigurationDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Preferences/ConfigurationDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -444,12 +444,12 @@
                 pitm = self.configList
             self.itmDict[key] = ConfigurationPageItem(pitm, pageData[0], key,
                                                       pageData[1])
-            self.itmDict[key].setData(0, Qt.UserRole, key)
+            self.itmDict[key].setData(0, Qt.ItemDataRole.UserRole, key)
             if (not self.fromEric or
                 displayMode != ConfigurationWidget.DefaultMode or
                     key in expandedEntries):
                 self.itmDict[key].setExpanded(True)
-        self.configList.sortByColumn(0, Qt.AscendingOrder)
+        self.configList.sortByColumn(0, Qt.SortOrder.AscendingOrder)
         
         # set the initial size of the splitter
         self.configSplitter.setSizes([200, 600])
@@ -494,7 +494,7 @@
         self.verticalLayout_2.setObjectName("verticalLayout_2")
         
         self.configSplitter = QSplitter(self)
-        self.configSplitter.setOrientation(Qt.Horizontal)
+        self.configSplitter.setOrientation(Qt.Orientation.Horizontal)
         self.configSplitter.setObjectName("configSplitter")
         
         self.configListWidget = QWidget(self.configSplitter)
@@ -512,17 +512,19 @@
         self.configListSearch.textChanged.connect(self.__searchTextChanged)
         
         self.scrollArea = QScrollArea(self.configSplitter)
-        self.scrollArea.setFrameShape(QFrame.NoFrame)
-        self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
-        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
+        self.scrollArea.setFrameShape(QFrame.Shape.NoFrame)
+        self.scrollArea.setVerticalScrollBarPolicy(
+            Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
+        self.scrollArea.setHorizontalScrollBarPolicy(
+            Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
         self.scrollArea.setWidgetResizable(False)
         self.scrollArea.setSizeAdjustPolicy(
-            QAbstractScrollArea.AdjustToContents)
+            QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents)
         self.scrollArea.setObjectName("scrollArea")
         
         self.configStack = QStackedWidget()
-        self.configStack.setFrameShape(QFrame.Box)
-        self.configStack.setFrameShadow(QFrame.Sunken)
+        self.configStack.setFrameShape(QFrame.Shape.Box)
+        self.configStack.setFrameShadow(QFrame.Shadow.Sunken)
         self.configStack.setObjectName("configStack")
         self.scrollArea.setWidget(self.configStack)
         
@@ -534,44 +536,50 @@
         self.vboxlayout.setContentsMargins(6, 6, 6, 6)
         self.vboxlayout.setObjectName("vboxlayout")
         spacerItem = QSpacerItem(
-            20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
+            20, 20, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
         self.vboxlayout.addItem(spacerItem)
         self.emptyPagePixmap = QLabel(self.emptyPage)
-        self.emptyPagePixmap.setAlignment(Qt.AlignCenter)
+        self.emptyPagePixmap.setAlignment(Qt.AlignmentFlag.AlignCenter)
         self.emptyPagePixmap.setObjectName("emptyPagePixmap")
         self.emptyPagePixmap.setPixmap(
             QPixmap(os.path.join(getConfig('ericPixDir'), 'eric.png')))
         self.vboxlayout.addWidget(self.emptyPagePixmap)
         self.textLabel1 = QLabel(self.emptyPage)
-        self.textLabel1.setAlignment(Qt.AlignCenter)
+        self.textLabel1.setAlignment(Qt.AlignmentFlag.AlignCenter)
         self.textLabel1.setObjectName("textLabel1")
         self.vboxlayout.addWidget(self.textLabel1)
         spacerItem1 = QSpacerItem(
-            20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+            20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
         self.vboxlayout.addItem(spacerItem1)
         self.configStack.addWidget(self.emptyPage)
         
         self.verticalLayout_2.addWidget(self.configSplitter)
         
         self.buttonBox = QDialogButtonBox(self)
-        self.buttonBox.setOrientation(Qt.Horizontal)
+        self.buttonBox.setOrientation(Qt.Orientation.Horizontal)
         self.buttonBox.setStandardButtons(
-            QDialogButtonBox.Apply | QDialogButtonBox.Cancel |
-            QDialogButtonBox.Ok | QDialogButtonBox.Reset)
+            QDialogButtonBox.StandardButton.Apply |
+            QDialogButtonBox.StandardButton.Cancel |
+            QDialogButtonBox.StandardButton.Ok |
+            QDialogButtonBox.StandardButton.Reset
+        )
         self.buttonBox.setObjectName("buttonBox")
         if (
             not self.fromEric and
             self.displayMode == ConfigurationWidget.DefaultMode
         ):
-            self.buttonBox.button(QDialogButtonBox.Apply).hide()
-        self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
+            self.buttonBox.button(QDialogButtonBox.StandardButton.Apply).hide()
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Apply).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Reset).setEnabled(False)
         self.verticalLayout_2.addWidget(self.buttonBox)
 
         self.setWindowTitle(self.tr("Preferences"))
         
         self.configList.header().hide()
-        self.configList.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.configList.header().setSortIndicator(
+            0, Qt.SortOrder.AscendingOrder)
         self.configList.setSortingEnabled(True)
         self.textLabel1.setText(
             self.tr("Please select an entry of the list \n"
@@ -711,20 +719,25 @@
             elif setCurrent:
                 items = self.configList.findItems(
                     pageData[0],
-                    Qt.MatchFixedString | Qt.MatchRecursive)
+                    Qt.MatchFlag.MatchFixedString |
+                    Qt.MatchFlag.MatchRecursive)
                 for item in items:
-                    if item.data(0, Qt.UserRole) == pageName:
+                    if item.data(0, Qt.ItemDataRole.UserRole) == pageName:
                         self.configList.setCurrentItem(item)
         self.configStack.setCurrentWidget(page)
         self.__resizeConfigStack()
         
         if page != self.emptyPage:
             page.polishPage()
-            self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(True)
-            self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(True)
+            self.buttonBox.button(
+                QDialogButtonBox.StandardButton.Apply).setEnabled(True)
+            self.buttonBox.button(
+                QDialogButtonBox.StandardButton.Reset).setEnabled(True)
         else:
-            self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
-            self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
+            self.buttonBox.button(
+                QDialogButtonBox.StandardButton.Apply).setEnabled(False)
+            self.buttonBox.button(
+                QDialogButtonBox.StandardButton.Reset).setEnabled(False)
         
         # reset scrollbars
         for sb in [self.scrollArea.horizontalScrollBar(),
@@ -811,9 +824,13 @@
         
         @param button button that was clicked (QAbstractButton)
         """
-        if button == self.buttonBox.button(QDialogButtonBox.Apply):
+        if button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Apply
+        ):
             self.on_applyButton_clicked()
-        elif button == self.buttonBox.button(QDialogButtonBox.Reset):
+        elif button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Reset
+        ):
             self.on_resetButton_clicked()
         
     @pyqtSlot()
@@ -863,7 +880,7 @@
         
         @param item reference to the collapsed item (QTreeWidgetItem)
         """
-        pageName = item.data(0, Qt.UserRole)
+        pageName = item.data(0, Qt.ItemDataRole.UserRole)
         if pageName in self.__expandedEntries:
             self.__expandedEntries.remove(pageName)
     
@@ -874,7 +891,7 @@
         
         @param item reference to the expanded item (QTreeWidgetItem)
         """
-        pageName = item.data(0, Qt.UserRole)
+        pageName = item.data(0, Qt.ItemDataRole.UserRole)
         if pageName not in self.__expandedEntries:
             self.__expandedEntries.append(pageName)
     
@@ -929,7 +946,7 @@
         if name:
             self.setObjectName(name)
         self.setModal(modal)
-        self.setWindowFlags(Qt.Window)
+        self.setWindowFlags(Qt.WindowType.Window)
         
         self.layout = QVBoxLayout(self)
         self.layout.setContentsMargins(0, 0, 0, 0)

eric ide

mercurial