It does not work neither.
But I have finally found the solution; use
"setBackgroundRole(QPalette::Window)" in the widget that will be
displayed in the TreeWidget. The default value is QPalette::NoRole.
That's all ! There is nothing else to do.
On 8/10/2018 1:41 PM, coroberti . wrote:
Hi,
Tr
Hi,
Try for your widgets to call
setAutoFillBackground(true);
Kind regards,
Robert
On Thu, Aug 9, 2018 at 5:58 PM, Nicolas Krieger
wrote:
> Hello
>
> I would like to display colored widgets in a QTreeWidget.
>
> Screenshots of what I really have are in attached files.
>
> My wigdet is colored
I've tried with QFrame, and it does not work either.
I've tried with QStyledItemDelegate and only writing the "paint" method :
void
TestDelegate::paint(QPainter*painter,constQStyleOptionViewItem&option,constQModelIndex&index)const
{
SimpleWidget*pWidget=newSimpleWidget;
pWidget->render(painte
Hi Nicolas,
Try using a QFrame for SimpleWidget - you may be able to get rid of
widget_2.
I'm surprised that the nested QWidget worked, as QWidget doesn't
normally draw a background.
Hope that helps, Tony
___
Interest mailing list
Interest@qt-pr
I have finally managed to do what I wanted in using styleSheets. Not
really beautiful.
If a have a widget containing all other widgets, for which I defined a
styleSheet, the color will be displayed only for the children (see last
example).
The "solution" is to have a child widget that conta
> 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
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 t
> 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
Hello
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?
--
*Nicolas Krieger*
___
Interest mai