QCustomPlot Discussion and Comments

Access all plots in a for loopReturn to overview

Hello,
I wish to access all my plots to modify their colors in a loop.
I have more than 30 plots in my app, I crated them one by one but 200 lines to modify their color is so painful so I want to use something like the method I used to modify the font on all my other widgets :

        foreach (QWidget *widget, QApplication::allWidgets()) {
            widget->setFont(f);
            widget->update();
        }

so it would look like :
for(QCustomPlot *widget : QCustomPlot::AllPlottable()) {
widget->xAxis->setLabelColor(colcode);
}

but of course AllPlottable don't exist and nothing in the doc looks like it.

Any idea how I could modify the color of all my plots at once ?

Thank you a ton

are all of your plots under the same parent? if so, i would use
QList<QCustomPlot *> allPlots = parentWidget.findChildren<QCustomPlot *>();

it may also be recursive, as there is an option for specifying direct children only.

Thanks I used :

        auto children = this->findChildren<QCustomPlot*>();
          foreach(QCustomPlot *widget ,children) {

and it works perfectly :D