QCustomplot放大与缩小

文章目录[隐藏]

QCustomplot 放大与缩小方法

方法 1 : 以鼠标当前位置为中心点进行放大缩小

ui->customplot->axisRect()->setRangeZoomFactor(2);
ui->customplot->axisRect()->setRangeZoom(Qt::Vertical);
方法 2 : 链接 mouseWheel 信号进行处理(如果不以鼠标为中心,以 Y 轴中心点为中心)
double dCenter = ui->customplot->xAxis->range().center();
// 扩大区间 (缩小 plottables 鼠标向内滚动)
ui->customplot->xAxis->scaleRange(2.0, dCenter);
///缩小区间 (放大 plotTables 鼠标向外滚动)
ui->customplot->xAxis->scaleRange(0.5, dCenter);

本文作者:不随。

本文链接:https://www.cnblogs.com/tmblog/p/17849377.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   不随。  阅读(940)  评论(0编辑  收藏  举报  
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.