[Interest] QTreeWidget displays blank widget

Murphy, Sean smurphy at walbro.com
Thu Aug 9 18:13:52 CEST 2018


> Yes, I used QTreeWidget ::setCellWidget(int row, int column, QWidget *widget).
> I have already used QStyledItemDelegate, but setCellWidget is far easiest for what I want to do.
> I don't really understand why QPushbutton are correctly displayed and not other widgets.
> But if only delegate is the solution, I will use it.

From the discussion I had with support, it appears that QTableWidget is expecting a 
QTableWidgetItem to define the colors for QPalette::ForegroundRole and QPalette::BackgroundRole,
but since you're using setCellWidget() you're most likely not adding a QTableWidgetItem to the
cell. Which even if you were, I don't think would get what you want since you have two different
background colors (the orange and the blue) as the background of the two labels. I don't know
if using QStyledItemDelegate gets you over that hurdle either, since I don't see how it allows you
to set different BackgroundRole values for the QLabel child widgets?

If you come up with a good solution, please respond to the list (or at least respond to me personally!)
as I'm interested in the correct solution to this as well just in case we decide to come back around to
this idea for our project.

Sean


This message has been scanned for malware by Forcepoint. www.forcepoint.com


More information about the Interest mailing list