10#include "qwt_plot_picker.h"
13#include "qwt_scale_div.h"
14#include "qwt_scale_map.h"
15#include "qwt_picker_machine.h"
17class QwtPlotPicker::PrivateData
46 m_data =
new PrivateData;
79 m_data =
new PrivateData;
80 m_data->xAxisId = xAxisId;
81 m_data->yAxisId = yAxisId;
100 :
QwtPicker( rubberBand, trackerMode, canvas )
102 m_data =
new PrivateData;
103 m_data->xAxisId = xAxisId;
104 m_data->yAxisId = yAxisId;
130 w = w->parentWidget();
132 return qobject_cast< QwtPlot* >( w );
138 const QWidget* w =
canvas();
140 w = w->parentWidget();
142 return qobject_cast< const QwtPlot* >( w );
160 rect = rect.normalized();
178 if ( xAxisId != m_data->xAxisId || yAxisId != m_data->yAxisId )
180 m_data->xAxisId = xAxisId;
181 m_data->yAxisId = yAxisId;
188 return m_data->xAxisId;
194 return m_data->yAxisId;
205 if (
plot() == NULL )
230 text = QString::number( pos.y(),
'f', 4 );
233 text = QString::number( pos.x(),
'f', 4 );
236 text = QString::number( pos.x(),
'f', 4 )
237 +
", " + QString::number( pos.y(),
'f', 4 );
291 if ( points.count() == 0 )
300 switch ( selectionType )
310 if ( points.count() >= 2 )
312 const QPoint p1 = points.first();
313 const QPoint p2 = points.last();
315 const QRect rect = QRect( p1, p2 ).normalized();
323 for (
int i = 0; i < points.count(); i++ )
393#include "moc_qwt_plot_picker.cpp"
QwtPicker provides selections on a widget.
RubberBand rubberBand() const
virtual void move(const QPoint &)
virtual void append(const QPoint &)
@ VLineRubberBand
A vertical line ( only for QwtPickerMachine::PointSelection )
@ HLineRubberBand
A horizontal line ( only for QwtPickerMachine::PointSelection )
virtual bool end(bool ok=true)
Close a selection setting the state to inactive.
QWidget * parentWidget()
Return the parent widget, where the selection happens.
const QwtPickerMachine * stateMachine() const
QPolygon selection() const
@ NoSelection
The state machine not usable for any type of selection.
@ RectSelection
The state machine is for selecting a rectangle (2 points).
@ PolygonSelection
The state machine is for selecting a polygon (many points).
@ PointSelection
The state machine is for selecting a single point.
SelectionType selectionType() const
Return the selection type.
bool isAxisVisible(QwtAxisId) const
virtual QwtScaleMap canvasMap(QwtAxisId) const
const QwtScaleDiv & axisScaleDiv(QwtAxisId) const
Return the scale division of a specified axis.
QRect transform(const QRectF &) const
virtual ~QwtPlotPicker()
Destructor.
virtual bool end(bool ok=true) override
void selected(const QPointF &pos)
QwtAxisId yAxis() const
Return y axis.
void moved(const QPointF &pos)
virtual void append(const QPoint &) override
void appended(const QPointF &pos)
QwtAxisId xAxis() const
Return x axis.
virtual void setAxes(QwtAxisId xAxisId, QwtAxisId yAxisId)
virtual void move(const QPoint &) override
virtual QwtText trackerText(const QPoint &) const override
QwtPlotPicker(QWidget *canvas)
Create a plot picker.
virtual QwtText trackerTextF(const QPointF &) const
Translate a position into a position string.
QRectF invTransform(const QRect &) const
A class representing a scale division.
double lowerBound() const
double transform(double s) const
double invTransform(double p) const
A class representing a text.