1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
2 | * Qwt Widget Library
|
---|
3 | * Copyright (C) 1997 Josef Wilgen
|
---|
4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
5 | *
|
---|
6 | * This library is free software; you can redistribute it and/or
|
---|
7 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
8 | *****************************************************************************/
|
---|
9 |
|
---|
10 | #ifndef QWT_PLOT_PICKER_H
|
---|
11 | #define QWT_PLOT_PICKER_H
|
---|
12 |
|
---|
13 | #include "qwt_global.h"
|
---|
14 | #include "qwt_picker.h"
|
---|
15 | #include <qvector.h>
|
---|
16 |
|
---|
17 | class QwtPlot;
|
---|
18 |
|
---|
19 | /*!
|
---|
20 | \brief QwtPlotPicker provides selections on a plot canvas
|
---|
21 |
|
---|
22 | QwtPlotPicker is a QwtPicker tailored for selections on
|
---|
23 | a plot canvas. It is set to a x-Axis and y-Axis and
|
---|
24 | translates all pixel coordinates into this coordinate system.
|
---|
25 | */
|
---|
26 |
|
---|
27 | class QWT_EXPORT QwtPlotPicker: public QwtPicker
|
---|
28 | {
|
---|
29 | Q_OBJECT
|
---|
30 |
|
---|
31 | public:
|
---|
32 | explicit QwtPlotPicker( QWidget *canvas );
|
---|
33 | virtual ~QwtPlotPicker();
|
---|
34 |
|
---|
35 | explicit QwtPlotPicker( int xAxis, int yAxis, QWidget * );
|
---|
36 |
|
---|
37 | explicit QwtPlotPicker( int xAxis, int yAxis,
|
---|
38 | RubberBand rubberBand, DisplayMode trackerMode, QWidget * );
|
---|
39 |
|
---|
40 | virtual void setAxis( int xAxis, int yAxis );
|
---|
41 |
|
---|
42 | int xAxis() const;
|
---|
43 | int yAxis() const;
|
---|
44 |
|
---|
45 | QwtPlot *plot();
|
---|
46 | const QwtPlot *plot() const;
|
---|
47 |
|
---|
48 | QWidget *canvas();
|
---|
49 | const QWidget *canvas() const;
|
---|
50 |
|
---|
51 | Q_SIGNALS:
|
---|
52 |
|
---|
53 | /*!
|
---|
54 | A signal emitted in case of QwtPickerMachine::PointSelection.
|
---|
55 | \param pos Selected point
|
---|
56 | */
|
---|
57 | void selected( const QPointF &pos );
|
---|
58 |
|
---|
59 | /*!
|
---|
60 | A signal emitted in case of QwtPickerMachine::RectSelection.
|
---|
61 | \param rect Selected rectangle
|
---|
62 | */
|
---|
63 | void selected( const QRectF &rect );
|
---|
64 |
|
---|
65 | /*!
|
---|
66 | A signal emitting the selected points,
|
---|
67 | at the end of a selection.
|
---|
68 |
|
---|
69 | \param pa Selected points
|
---|
70 | */
|
---|
71 | void selected( const QVector<QPointF> &pa );
|
---|
72 |
|
---|
73 | /*!
|
---|
74 | A signal emitted when a point has been appended to the selection
|
---|
75 |
|
---|
76 | \param pos Position of the appended point.
|
---|
77 | \sa append(). moved()
|
---|
78 | */
|
---|
79 | void appended( const QPointF &pos );
|
---|
80 |
|
---|
81 | /*!
|
---|
82 | A signal emitted whenever the last appended point of the
|
---|
83 | selection has been moved.
|
---|
84 |
|
---|
85 | \param pos Position of the moved last point of the selection.
|
---|
86 | \sa move(), appended()
|
---|
87 | */
|
---|
88 | void moved( const QPointF &pos );
|
---|
89 |
|
---|
90 | protected:
|
---|
91 | QRectF scaleRect() const;
|
---|
92 |
|
---|
93 | QRectF invTransform( const QRect & ) const;
|
---|
94 | QRect transform( const QRectF & ) const;
|
---|
95 |
|
---|
96 | QPointF invTransform( const QPoint & ) const;
|
---|
97 | QPoint transform( const QPointF & ) const;
|
---|
98 |
|
---|
99 | virtual QwtText trackerText( const QPoint & ) const;
|
---|
100 | virtual QwtText trackerTextF( const QPointF & ) const;
|
---|
101 |
|
---|
102 | virtual void move( const QPoint & );
|
---|
103 | virtual void append( const QPoint & );
|
---|
104 | virtual bool end( bool ok = true );
|
---|
105 |
|
---|
106 | private:
|
---|
107 | int d_xAxis;
|
---|
108 | int d_yAxis;
|
---|
109 | };
|
---|
110 |
|
---|
111 | #endif
|
---|