[Interest] QTableWidget::setCellWidget() overrides widget's palette?

Elvis Stansvik elvstone at gmail.com
Sat Apr 21 11:03:38 CEST 2018


2018-04-21 0:52 GMT+02:00 Murphy, Sean <smurphy at walbro.com>:
>> > But the issue only comes up with the plots that are embedded into the
>> table. The standalone plot has the color palette I want, and
>> > the palette is being set in the plot class' constructor, so it should be the
>> same palette for all 3 plots.
>>
>> Yea, didn't think that was it.
>>
>> One ugly workaround I found that seems to work:
>>
>>     auto palette = canvas()->palette();
>>     palette.setBrush(QPalette::Base, QBrush(QColor(50,50,50)));
>>     canvas()->setPalette(palette);
>
> Thanks so much for finding that solution! After my last email, I had tried
> setting it with QPalette::Window, but didn't try Base.

No problem. Setting QPalette::Window is exactly what Qwt's
setCanvasBackground does btw. I guess something within Qt is
re-setting that on the cell widget, but didn't dig deeper to find out.

Elvis

>
>> Instead of
>>
>>     setCanvasBackground(QBrush(QColor(50,50,50)));
>>
>> Still don't understand why that won't work though.
>
> I don't either, but at this point it works the way I want it to, so that's good enough
> for me!
>
> Thanks again,
> 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



More information about the Interest mailing list