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

Murphy, Sean smurphy at walbro.com
Fri Apr 20 01:51:29 CEST 2018

I'm attempting to create a data view that plots sample data from different data sources using a QwtPlot embedded in a QTableWidget and I'm having a little trouble getting the plot's palette to hold after calling QTableWidget::setCellWidget. So the idea is one data source per row, with a plot and then some statistical data (min, max, mean, and standard deviation for now). I whipped up some sample code, and it works so far - I'm getting the plots inserted into the correct column of the table. The problem is that plot's palette isn't coming out the way I want it.

I've attached a screenshot of what the my dataPlot class (which inherits from QwtPlot) looks like both when it's not embedded in a table cell (the upper half of the application), and what it looks like when it's in the table cell (lower half). It appears the color of the QwtPlotCurve's pen remains intact when putting plots in cells, but the plot canvas' background color is somehow getting over written. Any ideas on how to fix it?

I've also attached the code. You'll need to download and compile Qwt (https://sourceforge.net/projects/qwt/files/qwt/6.1.3/) to attempt to build/run it, but I'm guessing that the issue would hold for any widget that is embedded into a QTableWidget's cell?

I'm using:
  Qt 5.9.1
  Qwt 6.1.3
  Windows 7, 64 bit


This message has been scanned for malware by Forcepoint. www.forcepoint.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2018-04-19 19_36_39-Qwt CellWidget Test.png
Type: image/png
Size: 42319 bytes
Desc: 2018-04-19 19_36_39-Qwt CellWidget Test.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180419/14d446c6/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qwt_cellWidget_Test.zip
Type: application/x-zip-compressed
Size: 5678 bytes
Desc: qwt_cellWidget_Test.zip
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180419/14d446c6/attachment.bin>

More information about the Interest mailing list