eric6/DataViews/PyProfileDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8207
d359172d11be
--- a/eric6/DataViews/PyProfileDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/DataViews/PyProfileDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -65,10 +65,12 @@
         """
         super(PyProfileDialog, self).__init__(parent)
         self.setupUi(self)
-        self.setWindowFlags(Qt.Window)
+        self.setWindowFlags(Qt.WindowType.Window)
         
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         
         self.cancelled = False
         self.exclude = True
@@ -79,7 +81,8 @@
         self.summaryList.headerItem().setText(
             self.summaryList.columnCount(), "")
         self.resultList.headerItem().setText(self.resultList.columnCount(), "")
-        self.resultList.header().setSortIndicator(0, Qt.DescendingOrder)
+        self.resultList.header().setSortIndicator(
+            0, Qt.SortOrder.DescendingOrder)
         
         self.__menu = QMenu(self)
         self.filterItm = self.__menu.addAction(
@@ -92,10 +95,12 @@
             self.tr('Erase Timing Info'), self.__eraseTiming)
         self.__menu.addSeparator()
         self.__menu.addAction(self.tr('Erase All Infos'), self.__eraseAll)
-        self.resultList.setContextMenuPolicy(Qt.CustomContextMenu)
+        self.resultList.setContextMenuPolicy(
+            Qt.ContextMenuPolicy.CustomContextMenu)
         self.resultList.customContextMenuRequested.connect(
             self.__showContextMenu)
-        self.summaryList.setContextMenuPolicy(Qt.CustomContextMenu)
+        self.summaryList.setContextMenuPolicy(
+            Qt.ContextMenuPolicy.CustomContextMenu)
         self.summaryList.customContextMenuRequested.connect(
             self.__showContextMenu)
         
@@ -125,7 +130,7 @@
             functionName
         ])
         for col in [0, 1, 2, 3, 4, 6]:
-            itm.setTextAlignment(col, Qt.AlignRight)
+            itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight)
         
     def __createSummaryItem(self, label, contents):
         """
@@ -135,7 +140,7 @@
         @param contents text of the second column (string)
         """
         itm = QTreeWidgetItem(self.summaryList, [label, contents])
-        itm.setTextAlignment(1, Qt.AlignRight)
+        itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight)
         
     def __resortResultList(self):
         """
@@ -262,13 +267,18 @@
         button.
         """
         self.cancelled = True
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         QApplication.processEvents()
-        self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.resultList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.resultList.header().setStretchLastSection(True)
-        self.summaryList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.summaryList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.summaryList.header().setStretchLastSection(True)
         
     def __unfinish(self):
@@ -276,9 +286,12 @@
         Private slot called to revert the effects of the __finish slot.
         """
         self.cancelled = False
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         
     def on_buttonBox_clicked(self, button):
         """
@@ -286,9 +299,13 @@
         
         @param button button that was clicked (QAbstractButton)
         """
-        if button == self.buttonBox.button(QDialogButtonBox.Close):
+        if button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close
+        ):
             self.close()
-        elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
+        elif button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel
+        ):
             self.__finish()
         
     def __showContextMenu(self, coord):

eric ide

mercurial