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 1
12 
13 #include "qwt_global.h"
14 #include "qwt_text.h"
15 #include "qwt_event_pattern.h"
16 #include <qobject.h>
17 #include <qpen.h>
18 #include <qfont.h>
19 #include <qrect.h>
20 #include <qpainterpath.h>
21 
22 class QWidget;
23 class QMouseEvent;
24 class QWheelEvent;
25 class QKeyEvent;
26 class QwtPickerMachine;
27 class QwtWidgetOverlay;
28 
95 class QWT_EXPORT QwtPicker: public QObject, public QwtEventPattern
96 {
97  Q_OBJECT
98 
100 
101  Q_PROPERTY( bool isEnabled READ isEnabled WRITE setEnabled )
102  Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode )
103 
104  Q_PROPERTY( DisplayMode trackerMode READ trackerMode WRITE setTrackerMode )
105  Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen )
106  Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont )
107 
108  Q_PROPERTY( RubberBand rubberBand READ rubberBand WRITE setRubberBand )
109  Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen )
110 
111 public:
120  {
122  NoRubberBand = 0,
123 
126 
129 
132 
135 
138 
141 
146  UserRubberBand = 100
147  };
148 
154  {
157 
160 
162  ActiveOnly
163  };
164 
174  {
177 
179  KeepSize
180  };
181 
182  explicit QwtPicker( QWidget *parent );
183  explicit QwtPicker( RubberBand rubberBand,
184  DisplayMode trackerMode, QWidget * );
185 
186  virtual ~QwtPicker();
187 
188  void setStateMachine( QwtPickerMachine * );
189  const QwtPickerMachine *stateMachine() const;
190  QwtPickerMachine *stateMachine();
191 
192  void setRubberBand( RubberBand );
193  RubberBand rubberBand() const;
194 
195  void setTrackerMode( DisplayMode );
196  DisplayMode trackerMode() const;
197 
198  void setResizeMode( ResizeMode );
199  ResizeMode resizeMode() const;
200 
201  void setRubberBandPen( const QPen & );
202  QPen rubberBandPen() const;
203 
204  void setTrackerPen( const QPen & );
205  QPen trackerPen() const;
206 
207  void setTrackerFont( const QFont & );
208  QFont trackerFont() const;
209 
210  bool isEnabled() const;
211  bool isActive() const;
212 
213  virtual bool eventFilter( QObject *, QEvent * );
214 
215  QWidget *parentWidget();
216  const QWidget *parentWidget() const;
217 
218  virtual QPainterPath pickArea() const;
219 
220  virtual void drawRubberBand( QPainter * ) const;
221  virtual void drawTracker( QPainter * ) const;
222 
223  virtual QRegion trackerMask() const;
224  virtual QRegion rubberBandMask() const;
225 
226  virtual QwtText trackerText( const QPoint &pos ) const;
227  QPoint trackerPosition() const;
228  virtual QRect trackerRect( const QFont & ) const;
229 
230  QPolygon selection() const;
231 
232 public Q_SLOTS:
233  void setEnabled( bool );
234 
235 Q_SIGNALS:
243  void activated( bool on );
244 
251  void selected( const QPolygon &polygon );
252 
259  void appended( const QPoint &pos );
260 
268  void moved( const QPoint &pos );
269 
277  void removed( const QPoint &pos );
285  void changed( const QPolygon &selection );
286 
287 protected:
288  virtual QPolygon adjustedPoints( const QPolygon & ) const;
289 
290  virtual void transition( const QEvent * );
291 
292  virtual void begin();
293  virtual void append( const QPoint & );
294  virtual void move( const QPoint & );
295  virtual void remove();
296  virtual bool end( bool ok = true );
297 
298  virtual bool accept( QPolygon & ) const;
299  virtual void reset();
300 
301  virtual void widgetMousePressEvent( QMouseEvent * );
302  virtual void widgetMouseReleaseEvent( QMouseEvent * );
303  virtual void widgetMouseDoubleClickEvent( QMouseEvent * );
304  virtual void widgetMouseMoveEvent( QMouseEvent * );
305  virtual void widgetWheelEvent( QWheelEvent * );
306  virtual void widgetKeyPressEvent( QKeyEvent * );
307  virtual void widgetKeyReleaseEvent( QKeyEvent * );
308  virtual void widgetEnterEvent( QEvent * );
309  virtual void widgetLeaveEvent( QEvent * );
310 
311  virtual void stretchSelection( const QSize &oldSize,
312  const QSize &newSize );
313 
314  virtual void updateDisplay();
315 
316  const QwtWidgetOverlay *rubberBandOverlay() const;
317  const QwtWidgetOverlay *trackerOverlay() const;
318 
319  const QPolygon &pickedPoints() const;
320 
321 private:
322  void init( QWidget *, RubberBand rubberBand, DisplayMode trackerMode );
323 
324  void setMouseTracking( bool );
325 
326  class PrivateData;
328 };
329 
330 #endif
DisplayMode
Display mode.
Definition: qwt_picker.h:153
char * begin
A crosshair ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:131
#define QWT_EXPORT
Definition: qwt_global.h:38
Display always.
Definition: qwt_picker.h:159
char * end
All points are scaled according to the new size,.
Definition: qwt_picker.h:176
PrivateData * d_data
Definition: qwt_picker.h:326
A polygon ( only for QwtPickerMachine::PolygonSelection )
Definition: qwt_picker.h:140
An ellipse ( only for QwtPickerMachine::RectSelection )
Definition: qwt_picker.h:137
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:125
A collection of event patterns.
A rectangle ( only for QwtPickerMachine::RectSelection )
Definition: qwt_picker.h:134
An overlay for a widget.
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)
A vertical line ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:128
Display never.
Definition: qwt_picker.h:156
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
QwtPicker provides selections on a widget.
Definition: qwt_picker.h:95


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17