well, I managed some steps.
I have created a picker:
myPlot->canvas());
d_picker
->setRubberBandPen
(QColor(Qt
::green));
d_picker
->setRubberBand
(QwtPicker::CrossRubberBand);
d_picker
->setTrackerPen
(QColor(Qt
::blue));
d_picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
myPlot->canvas());
d_picker->setStateMachine(new QwtPickerDragRectMachine());
d_picker->setRubberBandPen(QColor(Qt::green));
d_picker->setRubberBand(QwtPicker::CrossRubberBand);
d_picker->setTrackerPen(QColor(Qt::blue));
To copy to clipboard, switch view to plain text mode
but I am still missing the rest:
when you click you leave mark on the plot/canvas, a cross "+", an "x", whatever
get the clicked coordinates in a variable
when you click you leave mark on the plot/canvas, a cross "+", an "x", whatever
get the clicked coordinates in a variable
To copy to clipboard, switch view to plain text mode
the methods
void selected (const QwtDoublePoint &pos)
void selected (const QwtDoubleRect &rect)
void selected (const QwtArray< QwtDoublePoint > &pa)
void selected (const QwtDoublePoint &pos)
void selected (const QwtDoubleRect &rect)
void selected (const QwtArray< QwtDoublePoint > &pa)
To copy to clipboard, switch view to plain text mode
are signals. Should i try to make a connection between these signals and a custom slot where I will store the clicked values? Which setStateMachine is the proper one in order to get 4 separate points of the plot?
Added after 22 minutes:
Is the following combination possible to work?
myPlot->canvas());
d_picker
->setRubberBandPen
(QColor(Qt
::green));
d_picker
->setRubberBand
(QwtPicker::CrossRubberBand);
d_picker
->setTrackerPen
(QColor(Qt
::blue));
connect(d_picker, SIGNAL (selected(const QwtDoublePoint &)), myPlot, SLOT (setPoint1(const QwtDoublePoint &)) );
d_picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
myPlot->canvas());
d_picker->setStateMachine(new QwtPickerClickPointMachine());
d_picker->setRubberBandPen(QColor(Qt::green));
d_picker->setRubberBand(QwtPicker::CrossRubberBand);
d_picker->setTrackerPen(QColor(Qt::blue));
connect(d_picker, SIGNAL (selected(const QwtDoublePoint &)), myPlot, SLOT (setPoint1(const QwtDoublePoint &)) );
To copy to clipboard, switch view to plain text mode
void my2dPlot::setPoint1(const QwtDoublePoint & po1)
{
point1 = po1;
x1.setNum(point1.x());
y1.setNum(point1.y());
QString info
("x >>> " + x1
+ " y >>> " +y1
);
showInfo(info);
}
void my2dPlot::setPoint1(const QwtDoublePoint & po1)
{
point1 = po1;
QString x1,y1;
x1.setNum(point1.x());
y1.setNum(point1.y());
QString info("x >>> " + x1 + " y >>> " +y1);
showInfo(info);
}
To copy to clipboard, switch view to plain text mode
Bookmarks