E5Gui/E5SideBar.py

branch
5_1_x
changeset 1448
b9c04bc0a692
parent 1441
0caac6d00bc2
child 1452
c45568ff630d
--- a/E5Gui/E5SideBar.py	Mon Nov 14 20:06:41 2011 +0100
+++ b/E5Gui/E5SideBar.py	Tue Nov 15 19:31:10 2011 +0100
@@ -8,7 +8,7 @@
 """
 
 from PyQt4.QtCore import QEvent, QSize, Qt, QByteArray, QDataStream, QIODevice
-from PyQt4.QtGui import QTabBar, QWidget, QStackedWidget, QBoxLayout, QToolButton
+from PyQt4.QtGui import QTabBar, QWidget, QStackedWidget, QBoxLayout, QToolButton, QSizePolicy
 
 from E5Gui.E5Application import e5App
 
@@ -38,7 +38,8 @@
         self.__tabBar = QTabBar()
         self.__tabBar.setDrawBase(True)
         self.__tabBar.setShape(QTabBar.RoundedNorth)
-        self.__tabBar.setUsesScrollButtons(False)
+        self.__tabBar.setUsesScrollButtons(True)
+        self.__tabBar.setDrawBase(False)
         self.__stackedWidget = QStackedWidget(self)
         self.__stackedWidget.setContentsMargins(0, 0, 0, 0)
         self.__autoHideButton = QToolButton()
@@ -201,8 +202,7 @@
             used, if the second parameter is a QIcon)
         """
         if label:
-            index = self.__tabBar.addTab(iconOrLabel, "")
-            self.__tabBar.setTabToolTip(index, label)
+            self.__tabBar.addTab(iconOrLabel, label)
         else:
             self.__tabBar.addTab(iconOrLabel)
         self.__stackedWidget.addWidget(widget)
@@ -223,8 +223,7 @@
             used, if the second parameter is a QIcon)
         """
         if label:
-            self.__tabBar.insertTab(index, iconOrLabel, "")
-            self.__tabBar.setTabToolTip(index, label)
+            self.__tabBar.insertTab(index, iconOrLabel, label)
         else:
             self.__tabBar.insertTab(index, iconOrLabel)
         self.__stackedWidget.insertWidget(index, widget)
@@ -363,21 +362,25 @@
         """
         if orient == E5SideBar.North:
             self.__tabBar.setShape(QTabBar.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)
         elif orient == E5SideBar.East:
             self.__tabBar.setShape(QTabBar.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)
         elif orient == E5SideBar.South:
             self.__tabBar.setShape(QTabBar.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)
         elif orient == E5SideBar.West:
             self.__tabBar.setShape(QTabBar.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)

eric ide

mercurial