Hey, I had an idea on how I can manage my plots by dividing them into four different QGridLayouts and then iterate the plots in each QGridLayout separately.
My wish would have been to use findchildren to find the grids, then from each grid look for the plots by using findchildren in there. This is where it doesn't work since the plots are not children but rather "items" as I have understood.
Here's how that looked like:
QGridLayout* grid = this->findChild<QGridLayout*>(gridLayout1"); QCustomPlot* plots = grid->findChildren<QCustomPlot*>(); // <- DOES NOT WORK
But I can work around this I think. I count the items in the grid and iterate the items using QGridLayout::ItemAt(int index). My problem here is I get an QLayoutItem* in return, how can I "convert" it to QCustomPlot so that I can use it as a plot?
my current code:
QGridLayout* grid = this->findChild<QGridLayout*>("gridLayout1"); for (int i= 0; i < grid->count(); i++) { QLayoutItem* plot = grid->itemAt(i) // How to get this item as a QCustomPlot instead? }