Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
6.7.2
-
None
-
Windows 11
-
-
7dc67d989 (dev), 41df8e68c (6.8), c52d0bfb0 (6.7)
Description
When trying to set the font/foreground color in QTableWidget via Palette (see TableColor.zip),
either for all entries
QPalette pal=table1->palette();
pal.setColor(QPalette::ColorRole::Text, QColor::fromRgb(255,0,0));
table1->setPalette(pal);
for(int i=0;i<rowTexts.size(); i++)
{
QTableWidgetItem* item = new QTableWidgetItem(rowTexts[i]);
table1->setItem(i,0,item);
{{ }}}
or single cells
for(int i=0;i<rowTexts.size(); i++)
{
QTableWidgetItem* item = new QTableWidgetItem(rowTexts[i]);
item->setForeground(QColor::fromRgb(i*60+80,0,0));
table2->setItem(i,0,item);
{{ }}}
this has no effect on Windows 11 (see TableColor_Win11_not_ok.png), the text stays black.
On Windows 10 everything is ok (see TableColor_Win10_ok.png).
In fact, the problem occurs only in the combination Qt6(.7.2) + Win11 + Palette.
With Qt5 or Win10 or StyleSheets, it works. Unfortunately, setStyleSheet() is not available for table items.
Attachments
Issue Links
- duplicates
-
QTBUG-126543 windows11 style has QTableView ignoring Qt::ForegroundRole
- Closed