> I would like to display colored widgets in a QTreeWidget. > Screenshots of what I really have are in attached files. > My wigdet is colored, but when in the QTreeWidget, it is all white. How can I > resolve it?
Are you adding your widget to the QTreeWidget via QTreeWidget ::setCellWidget(int row, int column, QWidget *widget) ? If so, I had the same issue and got this suggestion from Qt support: "This does not look like a bug to me. The QStyledItemDelegate is the way to customize painting the items in QTableView's (and Widgets), you can read more about this from: http://doc.qt.io/qt-5/qstyleditemdelegate.html#details The Table views (and other item views) are rendered differently, so it looks like the palette is just not used in these cases (looks like QStyledItemDelegate does not support it). So if you want to customize the items further, I would suggest using the QStyledItemDelegate." We ended up changing our minds (for a different reason), and I never went down the path suggested by Qt support, so I don't know how easy it is to apply to what you're doing, but on the surface it sounds like what you might want to do? I personally still think it's a bug (again assuming you're using the setCellWidget() call), since I think in that specific case, the QTableWidget should honor the fact that the widget you're setting within a table cell already knows how to paint itself fully and it's palette should be used. Sean This message has been scanned for malware by Forcepoint. www.forcepoint.com _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest