eric6/WebBrowser/CookieJar/CookieExceptionsModel.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/WebBrowser/CookieJar/CookieExceptionsModel.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/WebBrowser/CookieJar/CookieExceptionsModel.py	Tue Mar 02 17:17:09 2021 +0100
@@ -40,21 +40,26 @@
         
         @param section section number (integer)
         @param orientation orientation (Qt.Orientation)
-        @param role role of the data to retrieve (integer)
+        @param role role of the data to retrieve (Qt.ItemDataRole)
         @return requested data
         """
-        if role == Qt.SizeHintRole:
+        if role == Qt.ItemDataRole.SizeHintRole:
             fm = QFontMetrics(QFont())
             height = fm.height() + fm.height() // 3
             try:
                 width = fm.horizontalAdvance(
-                    self.headerData(section, orientation, Qt.DisplayRole))
+                    self.headerData(section, orientation,
+                                    Qt.ItemDataRole.DisplayRole))
             except AttributeError:
                 width = fm.width(
-                    self.headerData(section, orientation, Qt.DisplayRole))
+                    self.headerData(section, orientation,
+                                    Qt.ItemDataRole.DisplayRole))
             return QSize(width, height)
         
-        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
+        if (
+            orientation == Qt.Orientation.Horizontal and
+            role == Qt.ItemDataRole.DisplayRole
+        ):
             try:
                 return self.__headers[section]
             except IndexError:
@@ -73,7 +78,7 @@
         if index.row() < 0 or index.row() >= self.rowCount():
             return None
         
-        if role in (Qt.DisplayRole, Qt.EditRole):
+        if role in (Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole):
             row = index.row()
             if row < len(self.__allowedCookies):
                 if index.column() == 0:

eric ide

mercurial