我不能清除QCustomPlot中的项目。方法QCustomPlot::itemCount()总是返回0。
QCustomPlot *plot = new QCustomPlot(this);
qDebug() << plot->itemCount(); // returns 0
QCPItemText *textLabel = new QCPItemText(plot);
qDebug() << plot->itemCount(); // returns 0也许QCPItemText不是一个项目,但是我如何清除QCPItemText呢?或重置QCustomPlot
发布于 2014-01-31 22:36:23
在分配textLabel之后使用此方法:
plot->addItem(textLabel); 从文件中:
bool QCustomPlot::addItem ( QCPAbstractItem * item) 将指定的项添加到绘图中。QCustomPlot拥有该项目的所有权。 在成功时返回true,即当item不在绘图中,并且item的父图是这个QCustomPlot时。
https://stackoverflow.com/questions/21485505
复制相似问题