QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_wheel.h
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_WHEEL_H
28#define QWT_WHEEL_H
29
30#include "qwt_global.h"
31#include <qwidget.h>
32
41class QWT_EXPORT QwtWheel : public QWidget
42{
43 Q_OBJECT
44
45 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
46
47 Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
48
49 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
50 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
51
52 Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
53 Q_PROPERTY(int pageStepCount READ pageStepCount WRITE setPageStepCount)
54 Q_PROPERTY(bool stepAlignment READ stepAlignment WRITE setStepAlignment)
55
56 Q_PROPERTY(bool tracking READ isTracking WRITE setTracking)
57 Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
58 Q_PROPERTY(bool inverted READ isInverted WRITE setInverted)
59
60 Q_PROPERTY(double mass READ mass WRITE setMass)
61 Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval)
62
63 Q_PROPERTY(double totalAngle READ totalAngle WRITE setTotalAngle)
64 Q_PROPERTY(double viewAngle READ viewAngle WRITE setViewAngle)
65 Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount)
66 Q_PROPERTY(int wheelWidth READ wheelWidth WRITE setWheelWidth)
67 Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth)
68 Q_PROPERTY(int wheelBorderWidth READ wheelBorderWidth WRITE setWheelBorderWidth)
69 Q_PROPERTY(bool flatStyle READ flatStyle WRITE setFlatStyle)
70
71public:
73 explicit QwtWheel(QWidget* parent = nullptr);
75 ~QwtWheel() override;
76
78 double value() const;
79
81 void setOrientation(Qt::Orientation);
83 Qt::Orientation orientation() const;
84
86 double totalAngle() const;
88 double viewAngle() const;
89
91 void setTickCount(int);
93 int tickCount() const;
94
96 void setWheelWidth(int);
98 int wheelWidth() const;
99
101 void setWheelBorderWidth(int);
103 int wheelBorderWidth() const;
104
106 void setBorderWidth(int);
108 int borderWidth() const;
109
111 void setFlatStyle(bool);
113 bool flatStyle() const;
114
116 void setInverted(bool);
118 bool isInverted() const;
119
121 void setWrapping(bool);
123 bool wrapping() const;
124
126 void setSingleStep(double);
128 double singleStep() const;
129
131 void setPageStepCount(int);
133 int pageStepCount() const;
134
136 void setStepAlignment(bool on);
138 bool stepAlignment() const;
139
141 void setRange(double min, double max);
142
144 void setMinimum(double);
146 double minimum() const;
147
149 void setMaximum(double);
151 double maximum() const;
152
154 void setUpdateInterval(int);
156 int updateInterval() const;
157
159 void setTracking(bool);
161 bool isTracking() const;
162
164 double mass() const;
165
166public Q_SLOTS:
167 void setValue(double);
168 void setTotalAngle(double);
169 void setViewAngle(double);
170 void setMass(double);
171
172Q_SIGNALS:
173
181 void valueChanged(double value);
182
187
192
197 void wheelMoved(double value);
198
199protected:
200 virtual void paintEvent(QPaintEvent*) override;
201 virtual void mousePressEvent(QMouseEvent*) override;
202 virtual void mouseReleaseEvent(QMouseEvent*) override;
203 virtual void mouseMoveEvent(QMouseEvent*) override;
204 virtual void keyPressEvent(QKeyEvent*) override;
205 virtual void wheelEvent(QWheelEvent*) override;
206 virtual void timerEvent(QTimerEvent*) override;
207
208 void stopFlying();
209
210 QRect wheelRect() const;
211
212 virtual QSize sizeHint() const override;
213 virtual QSize minimumSizeHint() const override;
214
215 virtual void drawTicks(QPainter*, const QRectF&);
216 virtual void drawWheelBackground(QPainter*, const QRectF&);
217
218 virtual double valueAt(const QPoint&) const;
219
220private:
221 double alignedValue(double) const;
222 double boundedValue(double) const;
223
224 QWT_DECLARE_PRIVATE(QwtWheel)
225};
226
227#endif
The Wheel Widget
Definition qwt_wheel.h:42
~QwtWheel() override
Destructor
void wheelMoved(double value)
Signal emitted when the user moves the wheel with the mouse
void wheelReleased()
Signal emitted when the user releases the mouse
void wheelPressed()
Signal emitted when the user presses the wheel with the mouse
void valueChanged(double value)
Notify a change of value