PDA

View Full Version : QTabWidget moving tab bug using stylesheet



Alundra
22nd March 2015, 18:53
Hi,
I'm using a QTabWidget and I have the stylesheet loaded and set using "App.setStyleSheet".
When I move the tab on a movable QTabWidget, the text and border is not visible anymore, this is like a rectangle of color, only the close button is visible.
That only happen if I set the background-color in QWidget of the stylesheet like that :


QWidget
{
background-color: #302F2F;
}

If I don't set the background-color the moving tab looks the same as before moving.
Is it a bug of Qt or something I miss ?
Thanks for the help

Alundra
23rd March 2015, 02:21
Minimal code to reproduce the bug (move tab1 or tab2 and you will see the tab becomes gray) :


#include <QApplication>
#include <QMainWindow>
#include <QTabWidget>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyleSheet("QWidget{background-color: #302F2F;}");
QMainWindow MainWindow;
QTabWidget* TabWidget = new QTabWidget(&MainWindow);
TabWidget->addTab(new QWidget(TabWidget),"Tab1");
TabWidget->addTab(new QWidget(TabWidget),"Tab2");
MainWindow.setCentralWidget(TabWidget);
TabWidget->setMovable(true);
MainWindow.show();
return a.exec();
}

Link of the QTBUG : https://bugreports.qt.io/browse/QTBUG-45173