-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
4.8.2, 5.3.2, 5.4.0 Beta
Hello,
Whenever I style a QTabBar and have an overall QWidget style defined, the tabs disappear while getting moved.
http://stackoverflow.com/questions/7626514/how-to-set-qtabbar-tab-style-while-its-getting-moved
import sys from PyQt4 import QtGui STYLESHEET = """ QWidget { background-color: rgb(64, 64, 64); } QTabWidget::pane { /* The tab widget frame */ border-top: 2px solid #C2C7CB; } QTabWidget::tab-bar { left: 5px; /* move to the right by 5px */ } /* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ QTabBar::tab { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 2px solid #C4C4C3; border-bottom-color: #C2C7CB; /* same as the pane color */ border-top-left-radius: 4px; border-top-right-radius: 4px; min-width: 8ex; padding: 2px; } QTabBar::tab:selected, QTabBar::tab:hover { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fafafa, stop: 0.4 #f4f4f4, stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); } QTabBar::tab:selected { border-color: #9B9B9B; border-bottom-color: #C2C7CB; /* same as pane color */ } QTabBar::tab:!selected { margin-top: 2px; /* make non-selected tabs look smaller */ } """ class Ui(QtGui.QWidget): def __init__(self): super(Ui, self).__init__() self.setStyleSheet(STYLESHEET) tabWidget = QtGui.QTabWidget() tabWidget.setMovable(True) tabWidget.addTab(QtGui.QWidget(), "First") tabWidget.addTab(QtGui.QWidget(), "Second") tabWidget.addTab(QtGui.QWidget(), "Third") gridLayout = QtGui.QGridLayout() gridLayout.addWidget(tabWidget,) self.setLayout(gridLayout) self.resize(600, 300) app = QtGui.QApplication(sys.argv) ui = Ui() ui.show() sys.exit(app.exec_())