Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Combining QCustomPlot's QCPBars with Qt's QScrollArea



  • Hi all,

    I followed some advise given to me here and I am now using the designer instead of doing the grinding UI design myself.
    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.


  • Lifetime Qt Champion

    Hi
    just use the name from the UI for that widget you set to be promoted to QCustomPlot.



  • I think I understand my mistake - thank you. I promoted the scroll area - but that is clearly wrong. Should have promoted a widget and set that as the widget of the scroll area. (I realized this myself earlier btw :-) ).
    Thank you.


Log in to reply