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);
posted @ 2020-03-17 16:54  不随。  阅读(1276)  评论(0)    收藏  举报  来源