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

Elvis Stansvik elvstone at gmail.com
Fri Apr 20 21:06:14 CEST 2018

2018-04-20 14:07 GMT+02:00 Murphy, Sean <smurphy at walbro.com>:
>> Probably not your problem, but have you tried setAutoFillBackground(true) on your plot? I have that in one of my Qwt apps.
> I think I did. I played around a lot with the following functions, but it's possible I didn't hit the right combination in the right location
>   QTableWidget::setAutoFillBackground(true);
>   QwtPlot::setAutoFillBackground(true);
>   QwtPlot::setCanvasBackground(QBrush(QColor(50,50,50)));
>   QwtPlot::canvas()->setAutoFilleBackground(true);
> 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)));

Instead of


Still don't understand why that won't work though.


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

More information about the Interest mailing list