QCustomPlot Discussion and Comments

Plot widget inside TabWidgetReturn to overview

Hello all,

I was trying to use the plot widget as a child in the Tab widget. I have taken the basic example code to plot square function and added that after setupUi(this) function in the window constructor. There are three tabs in the application.

Tab containing the plot is the third one - and when I click on the tab at run time... plot captures the screen of previous tab and that is displayed on the axis.

I am not sure about the repaint event, even after calling the replot function it is not updating.

I hope someone can point me to few ideas.


Can you post an image showing how is the previous content painted on the axis? I remember having similar issues with painting the QCustomPlot on various events (resize etc.) but I'm not sure anymore how I've solved it.

Hello Mr. Petrman,

here is the link:

Regards and thanks in adv,

I tried to use the component using Qt Creator and it worked fine.

But when I am using it without creator in project where I am dynamically adding the instance - it is not working as expected. I am not sure what I am doing wrong....

Can any one have idea about this kind of problem. I am just hobby programmer and have not digged into the paint events yet.

Will try parallel to find some solution... but any pointers will be of gr8 help.


Hello dear board members,

I was trying to solve the above problem of ghost image. My concepts of C++ and drawings are not upto the mark. But I observed few things:

1) When I used the older version of QCustomplot *.cpp and *.h files - I did not found any problem in repaint the plots when tabs are changed.

2) When I used the new version of Qcustomplot with dll in the application it worked like charm.

Once again thanks to DerManu for such a fine piece of code.

Hope this might help someone. And I am sure - there are more to learn for me...


Hi Android2jc,

Can you post how you did the repaint? I am also trying to add a plot widget inside a tabwidget.

Thanks a lot,