eric6/E5Gui/E5SideBar.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
--- a/eric6/E5Gui/E5SideBar.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/E5Gui/E5SideBar.py	Tue Mar 02 17:17:09 2021 +0100
@@ -45,7 +45,7 @@
         
         self.__tabBar = QTabBar()
         self.__tabBar.setDrawBase(True)
-        self.__tabBar.setShape(QTabBar.RoundedNorth)
+        self.__tabBar.setShape(QTabBar.Shape.RoundedNorth)
         self.__tabBar.setUsesScrollButtons(True)
         self.__tabBar.setDrawBase(False)
         self.__stackedWidget = QStackedWidget(self)
@@ -57,9 +57,9 @@
         self.__autoHideButton.setChecked(True)
         self.__autoHideButton.setToolTip(
             self.tr("Deselect to activate automatic collapsing"))
-        self.barLayout = QBoxLayout(QBoxLayout.LeftToRight)
+        self.barLayout = QBoxLayout(QBoxLayout.Direction.LeftToRight)
         self.barLayout.setContentsMargins(0, 0, 0, 0)
-        self.layout = QBoxLayout(QBoxLayout.TopToBottom)
+        self.layout = QBoxLayout(QBoxLayout.Direction.TopToBottom)
         self.layout.setContentsMargins(0, 0, 0, 0)
         self.layout.setSpacing(0)
         self.barLayout.addWidget(self.__autoHideButton)
@@ -239,7 +239,7 @@
         @return flag indicating, if the event was handled (boolean)
         """
         if obj == self.__tabBar:
-            if evt.type() == QEvent.MouseButtonPress:
+            if evt.type() == QEvent.Type.MouseButtonPress:
                 pos = evt.pos()
                 for i in range(self.__tabBar.count()):
                     if self.__tabBar.tabRect(i).contains(pos):
@@ -253,7 +253,7 @@
                     return True
                 elif self.isMinimized():
                     self.expand()
-            elif evt.type() == QEvent.Wheel:
+            elif evt.type() == QEvent.Type.Wheel:
                 delta = evt.angleDelta().y()
                 if delta > 0:
                     self.prevTab()
@@ -439,33 +439,35 @@
         @param orient orientation of the sidebar (North, East, South, West)
         """
         if orient == E5SideBar.North:
-            self.__tabBar.setShape(QTabBar.RoundedNorth)
+            self.__tabBar.setShape(QTabBar.Shape.RoundedNorth)
             self.__tabBar.setSizePolicy(
-                QSizePolicy.Expanding, QSizePolicy.Preferred)
-            self.barLayout.setDirection(QBoxLayout.LeftToRight)
-            self.layout.setDirection(QBoxLayout.TopToBottom)
-            self.layout.setAlignment(self.barLayout, Qt.AlignLeft)
+                QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
+            self.barLayout.setDirection(QBoxLayout.Direction.LeftToRight)
+            self.layout.setDirection(QBoxLayout.Direction.TopToBottom)
+            self.layout.setAlignment(self.barLayout,
+                                     Qt.AlignmentFlag.AlignLeft)
         elif orient == E5SideBar.East:
-            self.__tabBar.setShape(QTabBar.RoundedEast)
+            self.__tabBar.setShape(QTabBar.Shape.RoundedEast)
             self.__tabBar.setSizePolicy(
-                QSizePolicy.Preferred, QSizePolicy.Expanding)
-            self.barLayout.setDirection(QBoxLayout.TopToBottom)
-            self.layout.setDirection(QBoxLayout.RightToLeft)
-            self.layout.setAlignment(self.barLayout, Qt.AlignTop)
+                QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding)
+            self.barLayout.setDirection(QBoxLayout.Direction.TopToBottom)
+            self.layout.setDirection(QBoxLayout.Direction.RightToLeft)
+            self.layout.setAlignment(self.barLayout, Qt.AlignmentFlag.AlignTop)
         elif orient == E5SideBar.South:
-            self.__tabBar.setShape(QTabBar.RoundedSouth)
+            self.__tabBar.setShape(QTabBar.Shape.RoundedSouth)
             self.__tabBar.setSizePolicy(
-                QSizePolicy.Expanding, QSizePolicy.Preferred)
-            self.barLayout.setDirection(QBoxLayout.LeftToRight)
-            self.layout.setDirection(QBoxLayout.BottomToTop)
-            self.layout.setAlignment(self.barLayout, Qt.AlignLeft)
+                QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
+            self.barLayout.setDirection(QBoxLayout.Direction.LeftToRight)
+            self.layout.setDirection(QBoxLayout.Direction.BottomToTop)
+            self.layout.setAlignment(self.barLayout,
+                                     Qt.AlignmentFlag.AlignLeft)
         elif orient == E5SideBar.West:
-            self.__tabBar.setShape(QTabBar.RoundedWest)
+            self.__tabBar.setShape(QTabBar.Shape.RoundedWest)
             self.__tabBar.setSizePolicy(
-                QSizePolicy.Preferred, QSizePolicy.Expanding)
-            self.barLayout.setDirection(QBoxLayout.TopToBottom)
-            self.layout.setDirection(QBoxLayout.LeftToRight)
-            self.layout.setAlignment(self.barLayout, Qt.AlignTop)
+                QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding)
+            self.barLayout.setDirection(QBoxLayout.Direction.TopToBottom)
+            self.layout.setDirection(QBoxLayout.Direction.LeftToRight)
+            self.layout.setAlignment(self.barLayout, Qt.AlignmentFlag.AlignTop)
         self.__orientation = orient
     
     def tabIcon(self, index):
@@ -567,8 +569,8 @@
                 self.__maxSize = self.maximumWidth()
         
         data = QByteArray()
-        stream = QDataStream(data, QIODevice.WriteOnly)
-        stream.setVersion(QDataStream.Qt_4_6)
+        stream = QDataStream(data, QIODevice.OpenModeFlag.WriteOnly)
+        stream.setVersion(QDataStream.Version.Qt_4_6)
         
         stream.writeUInt16(self.Version)
         stream.writeBool(self.__minimized)
@@ -600,8 +602,8 @@
             maxSize = self.maximumWidth()
         
         data = QByteArray(state)
-        stream = QDataStream(data, QIODevice.ReadOnly)
-        stream.setVersion(QDataStream.Qt_4_6)
+        stream = QDataStream(data, QIODevice.OpenModeFlag.ReadOnly)
+        stream.setVersion(QDataStream.Version.Qt_4_6)
         version = stream.readUInt16()  # version
         minimized = stream.readBool()
         

eric ide

mercurial