source: ntrip/trunk/BNC/qwt/qwt_wheel.h@ 8127

Last change on this file since 8127 was 8127, checked in by stoecker, 7 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 4.8 KB
Line 
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_WHEEL_H
11#define QWT_WHEEL_H
12
13#include "qwt_global.h"
14#include <qwidget.h>
15
16/*!
17 \brief The Wheel Widget
18
19 The wheel widget can be used to change values over a very large range
20 in very small steps. Using the setMass() member, it can be configured
21 as a flying wheel.
22
23 The default range of the wheel is [0.0, 100.0]
24
25 \sa The radio example.
26*/
27class QWT_EXPORT QwtWheel: public QWidget
28{
29 Q_OBJECT
30
31 Q_PROPERTY( Qt::Orientation orientation
32 READ orientation WRITE setOrientation )
33
34 Q_PROPERTY( double value READ value WRITE setValue )
35 Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
36 Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
37
38 Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
39 Q_PROPERTY( int pageStepCount READ pageStepCount WRITE setPageStepCount )
40 Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
41
42 Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
43 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
44 Q_PROPERTY( bool inverted READ isInverted WRITE setInverted )
45
46 Q_PROPERTY( double mass READ mass WRITE setMass )
47 Q_PROPERTY( int updateInterval READ updateInterval WRITE setUpdateInterval )
48
49 Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
50 Q_PROPERTY( double viewAngle READ viewAngle WRITE setViewAngle )
51 Q_PROPERTY( int tickCount READ tickCount WRITE setTickCount )
52 Q_PROPERTY( int wheelWidth READ wheelWidth WRITE setWheelWidth )
53 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
54 Q_PROPERTY( int wheelBorderWidth READ wheelBorderWidth WRITE setWheelBorderWidth )
55
56public:
57 explicit QwtWheel( QWidget *parent = NULL );
58 virtual ~QwtWheel();
59
60 double value() const;
61
62 void setOrientation( Qt::Orientation );
63 Qt::Orientation orientation() const;
64
65 double totalAngle() const;
66 double viewAngle() const;
67
68 void setTickCount( int );
69 int tickCount() const;
70
71 void setWheelWidth( int );
72 int wheelWidth() const;
73
74 void setWheelBorderWidth( int );
75 int wheelBorderWidth() const;
76
77 void setBorderWidth( int );
78 int borderWidth() const;
79
80 void setInverted( bool tf );
81 bool isInverted() const;
82
83 void setWrapping( bool tf );
84 bool wrapping() const;
85
86 void setSingleStep( double );
87 double singleStep() const;
88
89 void setPageStepCount( int );
90 int pageStepCount() const;
91
92 void setStepAlignment( bool on );
93 bool stepAlignment() const;
94
95 void setRange( double vmin, double vmax );
96
97 void setMinimum( double min );
98 double minimum() const;
99
100 void setMaximum( double max );
101 double maximum() const;
102
103 void setUpdateInterval( int );
104 int updateInterval() const;
105
106 void setTracking( bool enable );
107 bool isTracking() const;
108
109 double mass() const;
110
111public Q_SLOTS:
112 void setValue( double );
113 void setTotalAngle ( double );
114 void setViewAngle( double );
115 void setMass( double );
116
117Q_SIGNALS:
118
119 /*!
120 \brief Notify a change of value.
121
122 When tracking is enabled this signal will be emitted every
123 time the value changes.
124
125 \param value new value
126 \sa setTracking()
127 */
128 void valueChanged( double value );
129
130 /*!
131 This signal is emitted when the user presses the
132 the wheel with the mouse
133 */
134 void wheelPressed();
135
136 /*!
137 This signal is emitted when the user releases the mouse
138 */
139 void wheelReleased();
140
141 /*!
142 This signal is emitted when the user moves the
143 wheel with the mouse.
144
145 \param value new value
146 */
147 void wheelMoved( double value );
148
149protected:
150 virtual void paintEvent( QPaintEvent * );
151 virtual void mousePressEvent( QMouseEvent * );
152 virtual void mouseReleaseEvent( QMouseEvent * );
153 virtual void mouseMoveEvent( QMouseEvent * );
154 virtual void keyPressEvent( QKeyEvent * );
155 virtual void wheelEvent( QWheelEvent * );
156 virtual void timerEvent( QTimerEvent * );
157
158 void stopFlying();
159
160 QRect wheelRect() const;
161
162 virtual QSize sizeHint() const;
163 virtual QSize minimumSizeHint() const;
164
165 virtual void drawTicks( QPainter *, const QRectF & );
166 virtual void drawWheelBackground( QPainter *, const QRectF & );
167
168 virtual double valueAt( const QPoint & ) const;
169
170private:
171 double alignedValue( double ) const;
172 double boundedValue( double ) const;
173
174 class PrivateData;
175 PrivateData *d_data;
176};
177
178#endif
Note: See TracBrowser for help on using the repository browser.