Home > Back-end >  QT QCustomPlot how to set up a pan and zoom with the mouse will not move to the negative half shaft
QT QCustomPlot how to set up a pan and zoom with the mouse will not move to the negative half shaft

Time:01-08

By scaling or drag show only the content of the first quadrant, coordinate system when the X or Y axis movement to zero when I was less than the negative half shaft, not shows part of the painting line,
 widgets: : widgets (QWidget * parent) 
: QWidget (parent)
{
This - & gt; SetGeometry (100100500400);

GridLayout=new QGridLayout (this);
GridLayout - & gt; SetSpacing (5);
GridLayout - & gt; SetContentsMargins (20, 20, 20, 20).

Plot=new QCustomPlot (this);
GridLayout - & gt; AddWidget (plot);
The plot - & gt; SetBackground (QColor (222240254));//set the background color in

/*
IRangeDrag axis range can be drag mouse hold down the moving coordinate
IRangeZoom shaft range by the mouse wheel scale mouse wheel scale curve
ISelectAxes shaft is a choice can be selected to
ISelectLegend illustrations can choose legend can be selected to
ISelectPlottables figure can be selected, the content of (curve), for example,
*/
The plot - & gt; SetInteractions (QCP: : iRangeDrag | QCP: : iRangeZoom | QCP: : iSelectAxes |
QCP: : iSelectLegend | QCP: : iSelectPlottables);//set curve properties


The plot - & gt; XAxis - & gt; SetRange (0100);
The plot - & gt; YAxis - & gt; SetRange (0, 50);

}


CodePudding user response:

https://blog.csdn.net/lhw19931201/article/details/103631644? Utm_medium=distribute. Pc_relevant_bbs_down. None - task - 2 ~ all ~ first_rank_v2 ~ rank_v29-3. Nonecase& Depth_1 - utm_source=distribute. Pc_relevant_bbs_down. None - task - 2 ~ all ~ first_rank_v2 ~ rank_v29-3. Nonecase
More the problem will be solved, and convenient to find
  • Related