Clear QCPItemText in QCustomPlot -


i can't clear items in qcustomplot. method qcustomplot::itemcount() returns 0.

qcustomplot *plot = new qcustomplot(this); qdebug() << plot->itemcount();                    // returns 0 qcpitemtext *textlabel = new qcpitemtext(plot); qdebug() << plot->itemcount();                    // returns 0 

maybe qcpitemtext not considered item, how clear qcpitemtext then? or reset qcustomplot?

use after allocate textlabel :

plot->additem(textlabel);  

from documentation :

bool qcustomplot::additem ( qcpabstractitem * item)

adds specified item plot. qcustomplot takes ownership of item.

returns true on success, i.e. when item wasn't in plot , parent plot of item qcustomplot.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -