QCustomPlot 连续快速地调用replot()改善速度

QCustomPlot库提供了一个参数refreshPriority用于优化replot()调用的时机。当需要连续快速地更新图表时,设置为QCustomPlot::rpQueuedReplot能延迟实际重绘到下次事件循环,合并多次replot请求,避免无效重绘,从而提高性能。在多线程刷新图表场景下,推荐使用ui->customplot->replot(QCustomPlot::rpQueuedReplot);

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

qcustomplot库对replot()的解释:


void QCustomPlot::replot 
(
QCustomPlot::RefreshPriority 
refreshPriority = QCustomPlot::rpRefreshHint
)

Causes a complete replot into the internal paint buffer(s). 
Finally, the widget surface is refreshed with the new buffer contents. This is the method that must be called to make changes to the plot, e.g. on the axis ranges or data points of graphs, visible.
The parameter refreshPriority can be used to fine-tune the timing of the replot.
 For example if your application calls replot very quickly in succession 
(e.g. multiple independent functions change some aspects of the plot and each wants to make sure the change gets replotted),
 it is advisable to set refreshPriority to QCustomPlot::rpQueuedReplot. This way, the actual replotting is deferred to the next event loop iteration. 
Multiple successive calls of replot with this priority will only cause a single replot, avoiding redundant replots and improv
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值