QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_knob.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_KNOB_H
28#define QWT_KNOB_H
29
30#include "qwt_global.h"
31#include "qwt_abstract_slider.h"
32
34
49class QWT_EXPORT QwtKnob : public QwtAbstractSlider
50{
51 Q_OBJECT
52
53 Q_ENUMS(KnobStyle MarkerStyle)
54
55 Q_PROPERTY(KnobStyle knobStyle READ knobStyle WRITE setKnobStyle)
56 Q_PROPERTY(int knobWidth READ knobWidth WRITE setKnobWidth)
57 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
58 Q_PROPERTY(double totalAngle READ totalAngle WRITE setTotalAngle)
59 Q_PROPERTY(int numTurns READ numTurns WRITE setNumTurns)
60 Q_PROPERTY(MarkerStyle markerStyle READ markerStyle WRITE setMarkerStyle)
61 Q_PROPERTY(int markerSize READ markerSize WRITE setMarkerSize)
62 Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth)
63
64public:
72 {
75
78
81
83 Styled
84 };
85
93 {
95 NoMarker = -1,
96
99
102
105
108
110 Notch
111 };
112
114 explicit QwtKnob(QWidget* parent = nullptr);
116 ~QwtKnob() override;
117
119 void setAlignment(Qt::Alignment);
121 Qt::Alignment alignment() const;
122
124 void setKnobWidth(int);
126 int knobWidth() const;
127
129 void setNumTurns(int);
131 int numTurns() const;
132
134 void setTotalAngle(double angle);
136 double totalAngle() const;
137
139 void setKnobStyle(KnobStyle);
141 KnobStyle knobStyle() const;
142
144 void setBorderWidth(int);
146 int borderWidth() const;
147
149 void setMarkerStyle(MarkerStyle);
151 MarkerStyle markerStyle() const;
152
154 void setMarkerSize(int);
156 int markerSize() const;
157
159 virtual QSize sizeHint() const override;
161 virtual QSize minimumSizeHint() const override;
162
164 void setScaleDraw(QwtRoundScaleDraw*);
165
167 const QwtRoundScaleDraw* scaleDraw() const;
169 QwtRoundScaleDraw* scaleDraw();
170
172 QRect knobRect() const;
173
174protected:
175 virtual void paintEvent(QPaintEvent*) override;
176 virtual void changeEvent(QEvent*) override;
177
178 virtual void drawKnob(QPainter*, const QRectF&) const;
179
180 virtual void drawFocusIndicator(QPainter*) const;
181
182 virtual void drawMarker(QPainter*, const QRectF&, double angle) const;
183
184 virtual double scrolledTo(const QPoint&) const override;
185 virtual bool isScrollPosition(const QPoint&) const override;
186
187private:
188 QWT_DECLARE_PRIVATE(QwtKnob)
189};
190
191#endif
virtual void changeEvent(QEvent *) override
Handle change events (English only)
Definition qwt_abstract_scale.cpp:454
An abstract base class for slider widgets with a scale
Definition qwt_abstract_slider.h:47
The Knob Widget
Definition qwt_knob.h:50
MarkerStyle
Marker type
Definition qwt_knob.h:93
@ Nub
Draw a raised ellipse with a gradient from QPalette::Light and QPalette::Mid
Definition qwt_knob.h:107
@ Dot
Paint a circle in QPalette::ButtonText color
Definition qwt_knob.h:104
@ Tick
Paint a single tick in QPalette::ButtonText color
Definition qwt_knob.h:98
@ Triangle
Paint a triangle in QPalette::ButtonText color
Definition qwt_knob.h:101
~QwtKnob() override
Destructor
KnobStyle
Style of the knob surface
Definition qwt_knob.h:72
@ Flat
Fill the knob with a brush from QPalette::Button
Definition qwt_knob.h:74
@ Sunken
Build a gradient from QPalette::Midlight, QPalette::Button and QPalette::Midlight
Definition qwt_knob.h:80
@ Raised
Build a gradient from QPalette::Midlight and QPalette::Button
Definition qwt_knob.h:77
A class for drawing round scales
Definition qwt_round_scale_draw.h:47