I am calling customPlot->plotLayout()->clear(); and if I call customPlot->legend->setVisible(true);
the program crashes. Perhaps clear() clears the legend too. How can I add a new legend.
I tried customPlot->legend = new QCPLegend();
but it gives error
bool __thiscall QCPLayerable::setLayer(const class QString &) no parent QCustomPlot set
void __thiscall QCPLayerable::initializeParentPlot(class QCustomPlot *) called with parentPlot zero
bool __thiscall QCPLayerable::setLayer(const class QString &) no parent QCustomPlot set
void __thiscall QCPLayerable::initializeParentPlot(class QCustomPlot *) called with parentPlot zero