[Interest] QTreeWidget displays blank widget

Nicolas Krieger nicolas.krieger at medecom.fr
Thu Aug 9 17:51:41 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.

Thank you


Le 09/08/2018 à 17:41, Murphy, Sean a écrit :
>> 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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
*Nicolas Krieger*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180809/952a6941/attachment.html>


More information about the Interest mailing list