Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
4.6.3, 5.0.0
-
None
-
Linux, X11, KDE4.4 + Qt 4.6.3 + NVidia GT8600GTS
Description
When documentMode of QTabWidget is set to False, rect of QTabBar will have the size of the sum of all tabs width, but this doesn't mean the size of the QTabWidget. Moving the tabs will result in a cut effect because of the rect. If QTabBar is subclassed and forced to do the rect with QTabWidget width, it will just ignore the alignment set with qss. Here you have an example code:
# -*- coding: utf-8 -*- from PyQt4.QtCore import QSize from PyQt4.QtGui import * class TabBar(QTabBar): def __init__(self, parent=None): QTabBar.__init__(self, parent) self.parent = parent self.cw = self.width() self.ch = self.height() def sizeHint(self): w = self.parent.width() return QSize(w, self.ch) def tabSizeHinta(self, index): w = self.width() / self.count() return QSize(w, self.ch) app = QApplication([]) tabwidget = QTabWidget() tabwidget.setMovable(True) tabBar = TabBar(tabwidget) tabwidget.setTabBar(tabBar) #Uncomment this line to see the "cut" bug. tabwidget.insertTab(0, QTextEdit(), "test") tabwidget.insertTab(1, QTextEdit(), "test1") tabwidget.setMovable(True) tabwidget.setStyleSheet("QTabWidget {qproperty-tabPosition: South;} QTabWidget::tab-bar {subcontrol-position: center;} ") #If setTabBar is commented, this will center tabs tabwidget.show() app.exec_()