QListWidgetItem setForeground does not work anymore
-
Re: QListWidgetItem setForeground does not work with global stylesheet
I updated to QT 5.15.2 and now I experience the same problem! Is there a workaround, that tree widget items ignore this stylesheet? I need the stylesheet for other reasond. The older QT version 5.12.x worked correctly for this case?!
-
@WWebber said in QListWidgetItem setForeground does not work anymore:
The brush from the treeitem holds no solid color, although displayed in solid black.
I don't understand what you're trying to tell us. Please provide a minimal, compileable example.
@Christian-Ehrlicher
Actually the problem is fixed.
The anomaly between 5.12 and 5.15 was, that the default brush the tree-item returned, did not hold a solid brush. But I did not further investigate, what exactly it held, I simply set it. Schedule is tight - Thx anyway -
Re: QListWidgetItem setForeground does not work with global stylesheet
I updated to QT 5.15.2 and now I experience the same problem! Is there a workaround, that tree widget items ignore this stylesheet? I need the stylesheet for other reasond. The older QT version 5.12.x worked correctly for this case?!
-
@WWebber
You would have to state what your exact issue is, because I see many things discussed in that thread.@JonB
To put it short, the widgetItem->setForeground() is not working anymore (in V5.12 it worked but in V5.15 it does not - same code). Other than a user wrote it also does not work without a stylesheet on the tree-control. Everything else in the treeview like icons, fonts and checkboxes are ok. -
@JonB
To put it short, the widgetItem->setForeground() is not working anymore (in V5.12 it worked but in V5.15 it does not - same code). Other than a user wrote it also does not work without a stylesheet on the tree-control. Everything else in the treeview like icons, fonts and checkboxes are ok.Works fine for me, please provide a minimal, compilable example and the OS and style you're using
int main(int argc, char* argv[]) { QApplication app(argc, argv); QTableWidget tw; tw.setRowCount(1); tw.setColumnCount(1); auto item = new QTableWidgetItem; item->setText("Hello"); item->setForeground(QBrush(Qt::red)); tw.setItem(0,0,item); tw.show(); app.exec(); }
-
Works fine for me, please provide a minimal, compilable example and the OS and style you're using
int main(int argc, char* argv[]) { QApplication app(argc, argv); QTableWidget tw; tw.setRowCount(1); tw.setColumnCount(1); auto item = new QTableWidgetItem; item->setText("Hello"); item->setForeground(QBrush(Qt::red)); tw.setItem(0,0,item); tw.show(); app.exec(); }
well.. the problem is on a different place:
QBrush b = item->foreground(0); b.setColor(Qt::red); item->setForeground(0, b);
The brush from the treeitem holds no solid color, although displayed in solid black.
-
well.. the problem is on a different place:
QBrush b = item->foreground(0); b.setColor(Qt::red); item->setForeground(0, b);
The brush from the treeitem holds no solid color, although displayed in solid black.
@WWebber said in QListWidgetItem setForeground does not work anymore:
The brush from the treeitem holds no solid color, although displayed in solid black.
I don't understand what you're trying to tell us. Please provide a minimal, compileable example.
-
@WWebber said in QListWidgetItem setForeground does not work anymore:
The brush from the treeitem holds no solid color, although displayed in solid black.
I don't understand what you're trying to tell us. Please provide a minimal, compileable example.
@Christian-Ehrlicher
Actually the problem is fixed.
The anomaly between 5.12 and 5.15 was, that the default brush the tree-item returned, did not hold a solid brush. But I did not further investigate, what exactly it held, I simply set it. Schedule is tight - Thx anyway -