long index=-1;
QList<QCPLayoutElement*> totalElements=chartPlot->plotLayout()->elements(false);
int size=totalElements.size();
bool isRemoved=chartPlot->plotLayout()->removeAt(size-1);
chartPlot->plotLayout()->updateLayout();
totalElements=chartPlot->plotLayout()->elements(false);
size=totalElements.size();
The plotLayout doesnot remove the last element .It just shows 0x0 for the element.
How to remove it ?