Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.3.2, 6.4.0 RC1
-
None
-
-
109e088c7c (qt/qtbase/dev) 109e088c7c (qt/tqtc-qtbase/dev) 124a8c20ed (qt/qtbase/6.4) 124a8c20ed (qt/tqtc-qtbase/6.4) bf6cad8ba5 (qt/tqtc-qtbase/6.2)
Description
Setting background colours to a QTableWidgetItem that is used as a horizontal header item in QTableWidget doesn't display correctly in 'fusion' style.
I believe this is due to the `QPalette::cacheKey()` being equal for palette with different background brushes, as in QFusionStyle::drawControl under case CE_HeaderSection: reuses the same cached pixmap for at least some of the header items.
Can be reproduced using the following code added to WidgetGallery::createBottomLeftTabWidget() in the 'styles' example:
tableWidget->setColumnCount(4); const auto headerColours = std::vector<QColor>{Qt::GlobalColor::red, Qt::GlobalColor::blue, Qt::GlobalColor::green}; for (size_t i=0; i<headerColours.size(); ++i) { const auto &colour = headerColours[i]; auto headerItem = new QTableWidgetItem(""); headerItem->setBackground(colour); tableWidget->setHorizontalHeaderItem(i, headerItem); }
When displaying in 'fusion mode' the headers are coloured incorrectly in Qt 6:
In Qt 5 they are displayed correctly:
Attachments
Issue Links
- is duplicated by
-
QTBUG-107543 Regression[6.31->6.3.2, 6.26]: backgroundrole in QAbstractTableModel.headerData is broken (release builds only)
- Closed
- resulted in
-
QTCREATORBUG-28470 [REG Qt 6.4.0 -> 6.4.1] Arrows in UI are black (instead of white)
- Closed