请教大神如何删除QCustomPlot画出的图像

qq_37595932 2017-03-13 09:21:58
请问QCUStOMPlot中有没有删除当前图像的函数
...全文
4371 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
#Page# 2021-02-12
  • 打赏
  • 举报
回复
引用 5 楼 gaoyang4057 的回复:
ui->testPlot->graph(0)->data().data()->clear();
亲试可用
这个我测了,数据没了,内存没释放掉
cozhzh 2019-09-04
  • 打赏
  • 举报
回复
我参考的这边博客https://blog.csdn.net/toby54king/article/details/79033381使用的clearPlottables()清除图形,但无法清除文字。
五里之南 2019-07-29
  • 打赏
  • 举报
回复
QCustomPlot有两个清除图像的函数: QCustomPlot::clearGraphs(); QCustomPlot::clearItems(); 看你用到了哪个,就调用哪个
雪山飞狐W 2019-07-27
  • 打赏
  • 举报
回复
testPlot->graph(0)->data().data()->clear(); 这个是可以用的,比较方便,一行代码就搞定
sanqima 2019-04-12
  • 打赏
  • 举报
回复
//从大到小,依次清空图层
ui->customPlot->removeGraph(1);
ui->customPlot->removeGraph(0);

ui->customPlot->replot();
hicpp1987 2019-03-20
  • 打赏
  • 举报
回复
还少了一条

for (int i = mPlot->graphCount() - 1; i >= 0; i--)
{
	mPlot->removeGraph(i);
}
hicpp1987 2019-03-20
  • 打赏
  • 举报
回复

for (int i = mPlot->plotLayout()->elementCount() - 1; i > 0; i--)
{
	mPlot->plotLayout()->removeAt(i);
}
for (int i = mPlot->plottableCount() - 1; i > 0; i--)
{
	mPlot->removePlottable(i);
}
vanxkr 2019-01-07
  • 打赏
  • 举报
回复
clearPlottables();
Moscato_mao 2018-04-26
  • 打赏
  • 举报
回复
QCustomPlot *CustomPlot=ui->widget; CustomPlot->removeGraph(1); CustomPlot->replot(); 这里的1是图的编号,亲测可用~
gaoyang4057 2017-08-04
  • 打赏
  • 举报
回复
ui->testPlot->graph(0)->data().data()->clear(); 亲试可用
夜长梦会多 2017-07-28
  • 打赏
  • 举报
回复
我也遇到了这个问题?请问楼主解决了吗
孔方发发 2017-05-02
  • 打赏
  • 举报
回复
detachItems
feiyangqingyun 2017-04-20
  • 打赏
  • 举报
回复
ui->widgetPlot->graph(0)->clearData(); ui->widgetPlot->replot();
tranquility-c 2017-04-20
  • 打赏
  • 举报
回复
好像有一个removeGraph方法

16,175

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧