E5SideBar: added a fix for the upcoming PyQt 5.12 with Qt 5.12.1.

Tue, 05 Feb 2019 19:35:13 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 05 Feb 2019 19:35:13 +0100
changeset 6699
6c1f84f4b305
parent 6695
0a51887c13cd
child 6700
2a607332ccf8
child 6702
793af5761910

E5SideBar: added a fix for the upcoming PyQt 5.12 with Qt 5.12.1.

E5Gui/E5SideBar.py file | annotate | diff | comparison | revisions
--- a/E5Gui/E5SideBar.py	Sun Feb 03 16:10:39 2019 +0100
+++ b/E5Gui/E5SideBar.py	Tue Feb 05 19:35:13 2019 +0100
@@ -25,7 +25,7 @@
     Class implementing a sidebar with a widget area, that is hidden or shown,
     if the current tab is clicked again.
     """
-    Version = 1
+    Version = 2
     
     North = 0
     East = 1
@@ -577,11 +577,11 @@
         stream.writeUInt16(self.Version)
         stream.writeBool(self.__minimized)
         stream << self.__bigSize
-        stream.writeUInt16(self.__minSize)
-        stream.writeUInt16(self.__maxSize)
-        stream.writeUInt16(len(self.splitterSizes))
+        stream.writeUInt32(self.__minSize)
+        stream.writeUInt32(self.__maxSize)
+        stream.writeUInt32(len(self.splitterSizes))
         for size in self.splitterSizes:
-            stream.writeUInt16(size)
+            stream.writeUInt32(size)
         stream.writeBool(self.__autoHide)
         
         return data
@@ -606,19 +606,27 @@
         data = QByteArray(state)
         stream = QDataStream(data, QIODevice.ReadOnly)
         stream.setVersion(QDataStream.Qt_4_6)
-        stream.readUInt16()  # version
+        version = stream.readUInt16()  # version
         minimized = stream.readBool()
         
         if minimized and not self.__minimized:
             self.shrink()
         
         stream >> self.__bigSize
-        self.__minSize = max(stream.readUInt16(), minSize)
-        self.__maxSize = max(stream.readUInt16(), maxSize)
-        count = stream.readUInt16()
-        self.splitterSizes = []
-        for _ in range(count):
-            self.splitterSizes.append(stream.readUInt16())
+        if version == 1:
+            self.__minSize = max(stream.readUInt16(), minSize)
+            self.__maxSize = max(stream.readUInt16(), maxSize)
+            count = stream.readUInt16()
+            self.splitterSizes = []
+            for _ in range(count):
+                self.splitterSizes.append(stream.readUInt16())
+        elif version == 2:
+            self.__minSize = max(stream.readUInt32(), minSize)
+            self.__maxSize = max(stream.readUInt32(), maxSize)
+            count = stream.readUInt32()
+            self.splitterSizes = []
+            for _ in range(count):
+                self.splitterSizes.append(stream.readUInt32())
         
         self.__autoHide = stream.readBool()
         self.__autoHideButton.setChecked(not self.__autoHide)

eric ide

mercurial