Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.4, 4.8.2
-
Windows
-
9ea9ec1cbb567197ce0bf44ea58a79308c9b64d8
Description
If a stylesheet defines the appearance for QHeaderView::section and it’s set for a QTableWidget before the widget is shown, the style is not applied to the horizontal header. The style is correctly set to the vertical header.
Setting the same stylesheet to the application or the horizontal header before showing the table widget works. Also setting the style to QTableWidget after the show() works correctly.
The code below shows this issue:
int main(int argc, char *argv[]) { QApplication app(argc, argv); QString qss = "QHeaderView::section{color: rgb(255, 255, 255);background-color: rgb(0, 0, 0);}"; QTableWidget t1(10,10,NULL); QTableWidget t2(10,10,NULL); t1.setWindowTitle("t1"); t2.setWindowTitle("t2"); t1.setStyleSheet(qss); t1.show(); t2.show(); t2.setStyleSheet(qss); return app.exec(); }