这个功能,API里面都给写好了 我们直接调用就好了
customPlot->selectionRect()->setPen(QPen(Qt::black,1,Qt::DashLine));//设置选框的样式:虚线
customPlot->selectionRect()->setBrush(QBrush(QColor(0,0,100,50)));//设置选框的样式:半透明浅蓝
customPlot->setSelectionRectMode(QCP::SelectionRectMode::srmZoom);
效果图: 是不是很方便??