Hello. Let's look at such situation: I have one QCustomPlot widget with multiple QCPAxisRect-s in QCPLayerGrid in one column. I'd like to hide some AxisRect. If I just call "someAxisRect->setVisible(false)" it will disappear, but plot will have white space instead of it. I don't know any method to collapse this space. I tried to do this:
//in hide method
someAxisRect->setVisible(false);
someAxisRect->layout()->take(someAxisRect);
ui->plot->plotLayout()->simplify();
//in show method
plot->plotLayout()->insertRow(row);
plot->plotLayout()->addElement(row,0,someAxisRect);
someAxisRect->setVisible(true);
It works, but I'm not sure it's a proper way, because if I don't change visibility taken AxisRect is still painted under another AxisRect and responds to interactions (selection, e.g.). Any help appreciated.