QCustomPlot Discussion and Comments

Combining QCustomPlot's QCPBars with Qt's QScrollAreaReturn to overview

Hi all,

I have a QScrollArea that is promoted to a QCustomPlot, and everything is as expected. Trouble is that my previous code to actually build a bar chart does not build anymore because "ui.qcustomplot_ptr" is now of type CScrollArea*, and it does not have members of type QCPAxis:

QCPBars *thread_bar_ptr = new QCPBars(ui.qcustomplot_ptr->xAxis, ui.qcustomplot_ptr->yAxis) ; // build error

Any advise would be much appreciated.

I think you are using QScrollArea wrong. Check the Qt documentation for it, it says you must set a child widget with setWidget. It says nothing about promoting/inheritance.

Thanks for your reply. You are right; I should have added my widget to the scroll area, but instead I promoted the scroll area to become QCustomPlot which is clearly a mistake.