QCustomPlot Discussion and Comments

Setting transparent background does leaves previous drawings in placeReturn to overview

The background of the QCustomPlot widget should be the same color as the MainWindow color and I prefer this is "inherited" rather than defined on the widget itself.
*All* transparent backgrounds work fine in other widgets (QLabel, QPushButton, etc).


With QCustomPlot, the background is white by default. So I set it to transparent:


However, when the widget is drawn, any drawing that was previously in the location of the QCustomPlot widget is left in place (I get old text, old buttons, old images of widgets that no longer exist).

The issue is the of the same kind as explained in the qtcenter thread where the following answer appears: https://www.qtcentre.org/threads/3310-clean-with-transparent-color#post_52434 .

I bluntly tried


but that resulted in a segmentation fault.

What method should I use to make sure that the background is redrawn for the QCustomPlot?


ui->graphicsView->setAttribute(Qt::WA_OpaquePaintEvent, false);

assuming your QCustomPlot is ui->graphicsView.

(see https://www.qcustomplot.com/index.php/support/forum/549)