qwt_picker.h
Go to the documentation of this file.
1 /******************************************************************************
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 
103 class QWT_EXPORT QwtPicker : public QObject, public QwtEventPattern
104 {
105  Q_OBJECT
106 
108 
109  Q_PROPERTY( bool isEnabled READ isEnabled WRITE setEnabled )
110  Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode )
111 
112  Q_PROPERTY( DisplayMode trackerMode READ trackerMode WRITE setTrackerMode )
113  Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen )
114  Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont )
115 
116  Q_PROPERTY( RubberBand rubberBand READ rubberBand WRITE setRubberBand )
117  Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen )
118 
119  public:
128  {
130  NoRubberBand = 0,
131 
134 
137 
140 
143 
146 
149 
154  UserRubberBand = 100
155  };
156 
162  {
165 
168 
170  ActiveOnly
171  };
172 
182  {
185 
187  KeepSize
188  };
189 
190  explicit QwtPicker( QWidget* parent );
191  explicit QwtPicker( RubberBand rubberBand,
192  DisplayMode trackerMode, QWidget* );
193 
194  virtual ~QwtPicker();
195 
196  void setStateMachine( QwtPickerMachine* );
197  const QwtPickerMachine* stateMachine() const;
198  QwtPickerMachine* stateMachine();
199 
200  void setRubberBand( RubberBand );
201  RubberBand rubberBand() const;
202 
203  void setTrackerMode( DisplayMode );
204  DisplayMode trackerMode() const;
205 
206  void setResizeMode( ResizeMode );
207  ResizeMode resizeMode() const;
208 
209  void setRubberBandPen( const QPen& );
210  QPen rubberBandPen() const;
211 
212  void setTrackerPen( const QPen& );
213  QPen trackerPen() const;
214 
215  void setTrackerFont( const QFont& );
216  QFont trackerFont() const;
217 
218  bool isEnabled() const;
219  bool isActive() const;
220 
221  virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
222 
223  QWidget* parentWidget();
224  const QWidget* parentWidget() const;
225 
226  virtual QPainterPath pickArea() const;
227 
228  virtual void drawRubberBand( QPainter* ) const;
229  virtual void drawTracker( QPainter* ) const;
230 
231  virtual QRegion trackerMask() const;
232  virtual QRegion rubberBandMask() const;
233 
234  virtual QwtText trackerText( const QPoint& pos ) const;
235  QPoint trackerPosition() const;
236  virtual QRect trackerRect( const QFont& ) const;
237 
238  QPolygon selection() const;
239 
240  public Q_SLOTS:
241  void setEnabled( bool );
242 
243  Q_SIGNALS:
251  void activated( bool on );
252 
259  void selected( const QPolygon& polygon );
260 
267  void appended( const QPoint& pos );
268 
276  void moved( const QPoint& pos );
277 
285  void removed( const QPoint& pos );
293  void changed( const QPolygon& selection );
294 
295  protected:
296  virtual QPolygon adjustedPoints( const QPolygon& ) const;
297 
298  virtual void transition( const QEvent* );
299 
300  virtual void begin();
301  virtual void append( const QPoint& );
302  virtual void move( const QPoint& );
303  virtual void remove();
304  virtual bool end( bool ok = true );
305 
306  virtual bool accept( QPolygon& ) const;
307  virtual void reset();
308 
309  virtual void widgetMousePressEvent( QMouseEvent* );
310  virtual void widgetMouseReleaseEvent( QMouseEvent* );
311  virtual void widgetMouseDoubleClickEvent( QMouseEvent* );
312  virtual void widgetMouseMoveEvent( QMouseEvent* );
313  virtual void widgetWheelEvent( QWheelEvent* );
314  virtual void widgetKeyPressEvent( QKeyEvent* );
315  virtual void widgetKeyReleaseEvent( QKeyEvent* );
316  virtual void widgetEnterEvent( QEvent* );
317  virtual void widgetLeaveEvent( QEvent* );
318 
319  virtual void stretchSelection(
320  const QSize& oldSize, const QSize& newSize );
321 
322  virtual void updateDisplay();
323 
324  const QwtWidgetOverlay* rubberBandOverlay() const;
325  const QwtWidgetOverlay* trackerOverlay() const;
326 
327  const QPolygon& pickedPoints() const;
328  QRect trackerRect( const QSize& ) const;
329 
330  private:
331  void init( QWidget*, RubberBand rubberBand, DisplayMode trackerMode );
332 
333  void setMouseTracking( bool );
334 
335  class PrivateData;
337 };
338 
339 #endif
QwtPicker::AlwaysOn
@ AlwaysOn
Display always.
Definition: qwt_picker.h:167
QwtWidgetOverlay
An overlay for a widget.
Definition: qwt_widget_overlay.h:40
QwtPicker::EllipseRubberBand
@ EllipseRubberBand
An ellipse ( only for QwtPickerMachine::RectSelection )
Definition: qwt_picker.h:145
QwtPicker::DisplayMode
DisplayMode
Display mode.
Definition: qwt_picker.h:161
QwtPicker::CrossRubberBand
@ CrossRubberBand
A crosshair ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:139
QwtPicker::ResizeMode
ResizeMode
Definition: qwt_picker.h:181
QwtPicker::RectRubberBand
@ RectRubberBand
A rectangle ( only for QwtPickerMachine::RectSelection )
Definition: qwt_picker.h:142
QwtPicker::AlwaysOff
@ AlwaysOff
Display never.
Definition: qwt_picker.h:164
QwtPicker::RubberBand
RubberBand
Definition: qwt_picker.h:127
qwt_global.h
QwtPicker::VLineRubberBand
@ VLineRubberBand
A vertical line ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:136
append
QCXXHighlighter::QCXXHighlighter(QTextDocument *document) m_highlightRule append)({ QRegularExpression(R"(#[a-zA-Z_]+)"), "Preprocessor" })
Definition: QCXXHighlighter.cpp:60
QwtPicker::PolygonRubberBand
@ PolygonRubberBand
A polygon ( only for QwtPickerMachine::PolygonSelection )
Definition: qwt_picker.h:148
QwtText
A class representing a text.
Definition: qwt_text.h:51
backward::details::move
const T & move(const T &v)
Definition: backward.hpp:394
QwtPicker::Stretch
@ Stretch
All points are scaled according to the new size,.
Definition: qwt_picker.h:184
qwt_event_pattern.h
QwtPicker::HLineRubberBand
@ HLineRubberBand
A horizontal line ( only for QwtPickerMachine::PointSelection )
Definition: qwt_picker.h:133
QwtPickerMachine
A state machine for QwtPicker selections.
Definition: qwt_picker_machine.h:28
QwtPicker::m_data
PrivateData * m_data
Definition: qwt_picker.h:335
backward::Color::reset
@ reset
Definition: backward.hpp:3678
QwtPicker::PrivateData
Definition: qwt_picker.cpp:119
sol::stack::remove
void remove(lua_State *L_, int rawindex, int count)
Definition: sol.hpp:9945
QwtEventPattern
A collection of event patterns.
Definition: qwt_event_pattern.h:30
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtPicker
QwtPicker provides selections on a widget.
Definition: qwt_picker.h:103
init
void init(const M_string &remappings)


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45