Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.7.1, 6.7.2
-
None
-
Windows 11 Version 23H2 (x86_64)
Qt v6.7.2
windows11 style
-
-
7dc67d989 (dev), 41df8e68c (6.8), c52d0bfb0 (6.7)
Description
The intent is coloring QTableview text, in either Light or Dark mode, using an overridden data():
else if (role == Qt::ForegroundRole) { return QBrush(QColor(Qt::blue)); // QColor(Qt::blue);
With the "windows11" style, this Qt::ForegroundRole property appears to be ignored. The Qt::BackgroundRole is however accepted, like:
When forcing use of the "fusion" style before initializing QApplication, i.e.
QApplication::setStyle("fusion");
the Qt::ForegroundRole property works as expected:
- Removing the stylesheet on the QTableView::item didn't help.
- QAbstractItemModelTester shows no warnings
- a delegate viewer is active on some columns, but this affects all columns
This came to my attention as 6.7.x defaults to "windows11". For now the app can keep using "fusion". Suggestions are welcome.
Attachments
Issue Links
- duplicates
-
QTBUG-126596 QListWidgetItem::setForeground() does not work
-
- Closed
-
- is duplicated by
-
QTBUG-128775 QTableWidget foreground / font color cannot be set via palette on Win11
-
- Closed
-