qwt_picker.h
Go to the documentation of this file.
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_PICKER
11 #define QWT_PICKER
12 
13 #include "qwt_global.h"
14 #include "qwt_event_pattern.h"
15 
16 #include <qobject.h>
17 
18 class QwtPickerMachine;
19 class QwtWidgetOverlay;
20 class QwtText;
21 class QWidget;
22 class QMouseEvent;
23 class QWheelEvent;
24 class QKeyEvent;
25 class QPainter;
26 class QPen;
27 class QFont;
28 class QRegion;
29 class QPainterPath;
30 class QPoint;
31 class QRect;
32 class QSize;
33 class QPolygon;
34 
104 class QWT_EXPORT QwtPicker: public QObject, public QwtEventPattern
105 {
106  Q_OBJECT
107 
109 
110  Q_PROPERTY( bool isEnabled READ isEnabled WRITE setEnabled )
111  Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode )
112 
113  Q_PROPERTY( DisplayMode trackerMode READ trackerMode WRITE setTrackerMode )
114  Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen )
115  Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont )
116 
117  Q_PROPERTY( RubberBand rubberBand READ rubberBand WRITE setRubberBand )
118  Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen )
119 
120 public:
129  {
131  NoRubberBand = 0,
132 
135 
138 
141 
144 
147 
150 
155  UserRubberBand = 100
156  };
157 
163  {
166 
169 
171  ActiveOnly
172  };
173 
183  {
186 
188  KeepSize
189  };
190 
191  explicit QwtPicker( QWidget *parent );
192  explicit QwtPicker( RubberBand rubberBand,
193  DisplayMode trackerMode, QWidget * );
194 
195  virtual ~QwtPicker();
196 
197  void setStateMachine( QwtPickerMachine * );
198  const QwtPickerMachine *stateMachine() const;
199  QwtPickerMachine *stateMachine();
200 
201  void setRubberBand( RubberBand );
202  RubberBand rubberBand() const;
203 
204  void setTrackerMode( DisplayMode );
205  DisplayMode trackerMode() const;
206 
207  void setResizeMode( ResizeMode );
208  ResizeMode resizeMode() const;
209 
210  void setRubberBandPen( const QPen & );
211  QPen rubberBandPen() const;
212 
213  void setTrackerPen( const QPen & );
214  QPen trackerPen() const;
215 
216  void setTrackerFont( const QFont & );
217  QFont trackerFont() const;
218 
219  bool isEnabled() const;
220  bool isActive() const;
221 
222  virtual bool eventFilter( QObject *, QEvent * ) QWT_OVERRIDE;
223 
224  QWidget *parentWidget();
225  const QWidget *parentWidget() const;
226 
227  virtual QPainterPath pickArea() const;
228 
229  virtual void drawRubberBand( QPainter * ) const;
230  virtual void drawTracker( QPainter * ) const;
231 
232  virtual QRegion trackerMask() const;
233  virtual QRegion rubberBandMask() const;
234 
235  virtual QwtText trackerText( const QPoint &pos ) const;
236  QPoint trackerPosition() const;
237  virtual QRect trackerRect( const QFont & ) const;
238 
239  QPolygon selection() const;
240 
241 public Q_SLOTS:
242  void setEnabled( bool );
243 
244 Q_SIGNALS:
252  void activated( bool on );
253 
260  void selected( const QPolygon &polygon );
261 
268  void appended( const QPoint &pos );
269 
277  void moved( const QPoint &pos );
278 
286  void removed( const QPoint &pos );
294  void changed( const QPolygon &selection );
295 
296 protected:
297  virtual QPolygon adjustedPoints( const QPolygon & ) const;
298 
299  virtual void transition( const QEvent * );
300 
301  virtual void begin();
302  virtual void append( const QPoint & );
303  virtual void move( const QPoint & );
304  virtual void remove();
305  virtual bool end( bool ok = true );
306 
307  virtual bool accept( QPolygon & ) const;
308  virtual void reset();
309 
310  virtual void widgetMousePressEvent( QMouseEvent * );
311  virtual void widgetMouseReleaseEvent( QMouseEvent * );
312  virtual void widgetMouseDoubleClickEvent( QMouseEvent * );
313  virtual void widgetMouseMoveEvent( QMouseEvent * );
314  virtual void widgetWheelEvent( QWheelEvent * );
315  virtual void widgetKeyPressEvent( QKeyEvent * );
316  virtual void widgetKeyReleaseEvent( QKeyEvent * );
317  virtual void widgetEnterEvent( QEvent * );
318  virtual void widgetLeaveEvent( QEvent * );
319 
320  virtual void stretchSelection(
321  const QSize &oldSize, const QSize &newSize );
322 
323  virtual void updateDisplay();
324 
325  const QwtWidgetOverlay *rubberBandOverlay() const;
326  const QwtWidgetOverlay *trackerOverlay() const;
327 
328  const QPolygon &pickedPoints() const;
329 
330 private:
331  void init( QWidget *, RubberBand rubberBand, DisplayMode trackerMode );
332 
333  void setMouseTracking( bool );
334 
335  class PrivateData;
336  PrivateData *d_data;
337 };
338 
339 #endif
DisplayMode
Display mode.
Definition: qwt_picker.h:162
A crosshair ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:140
#define QWT_EXPORT
Definition: qwt_global.h:38
Display always.
Definition: qwt_picker.h:168
All points are scaled according to the new size,.
Definition: qwt_picker.h:185
A polygon ( only for QwtPickerMachine::PolygonSelection )
Definition: qwt_picker.h:149
An ellipse ( only for QwtPickerMachine::RectSelection )
Definition: qwt_picker.h:146
A class representing a text.
Definition: qwt_text.h:51
A state machine for QwtPicker selections.
A horizontal line ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:134
const T & move(const T &v)
Definition: backward.hpp:394
A collection of event patterns.
A rectangle ( only for QwtPickerMachine::RectSelection )
Definition: qwt_picker.h:143
An overlay for a widget.
A vertical line ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:137
Display never.
Definition: qwt_picker.h:165
void remove(lua_State *L, int rawindex, int count)
Definition: sol.hpp:8933
QwtPicker provides selections on a widget.
Definition: qwt_picker.h:104
#define QWT_OVERRIDE
Definition: qwt_global.h:53


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10