QWT 7.0.1
Loading...
Searching...
No Matches
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
59class QWT_EXPORT QwtKnob : public QwtAbstractSlider
60{
61 Q_OBJECT
62
63 Q_ENUMS ( KnobStyle MarkerStyle )
64
65 Q_PROPERTY( KnobStyle knobStyle READ knobStyle WRITE setKnobStyle )
66 Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth )
67 Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment )
68 Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
69 Q_PROPERTY( int numTurns READ numTurns WRITE setNumTurns )
70 Q_PROPERTY( MarkerStyle markerStyle READ markerStyle WRITE setMarkerStyle )
71 Q_PROPERTY( int markerSize READ markerSize WRITE setMarkerSize )
72 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
73
74 public:
84 {
87
90
96
101 Styled
102 };
103
113 {
115 NoMarker = -1,
116
119
122
125
131
136 Notch
137 };
138
139 explicit QwtKnob( QWidget* parent = NULL );
140 virtual ~QwtKnob();
141
142 void setAlignment( Qt::Alignment );
143 Qt::Alignment alignment() const;
144
145 void setKnobWidth( int );
146 int knobWidth() const;
147
148 void setNumTurns( int );
149 int numTurns() const;
150
151 void setTotalAngle ( double angle );
152 double totalAngle() const;
153
154 void setKnobStyle( KnobStyle );
155 KnobStyle knobStyle() const;
156
157 void setBorderWidth( int );
158 int borderWidth() const;
159
160 void setMarkerStyle( MarkerStyle );
161 MarkerStyle markerStyle() const;
162
163 void setMarkerSize( int );
164 int markerSize() const;
165
166 virtual QSize sizeHint() const QWT_OVERRIDE;
167 virtual QSize minimumSizeHint() const QWT_OVERRIDE;
168
169 void setScaleDraw( QwtRoundScaleDraw* );
170
171 const QwtRoundScaleDraw* scaleDraw() const;
172 QwtRoundScaleDraw* scaleDraw();
173
174 QRect knobRect() const;
175
176 protected:
177 virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
178 virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
179
180 virtual void drawKnob( QPainter*, const QRectF& ) const;
181
182 virtual void drawFocusIndicator( QPainter* ) const;
183
184 virtual void drawMarker( QPainter*,
185 const QRectF&, double angle ) const;
186
187 virtual double scrolledTo( const QPoint& ) const QWT_OVERRIDE;
188 virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
189
190 private:
191 class PrivateData;
192 PrivateData* m_data;
193};
194
195#endif
An abstract base class for slider widgets with a scale.
Definition qwt_abstract_slider.h:50
The Knob Widget.
Definition qwt_knob.h:60
MarkerStyle
Marker type.
Definition qwt_knob.h:113
@ Nub
Draw a raised ellipse with a gradient build from QPalette::Light and QPalette::Mid.
Definition qwt_knob.h:130
@ Dot
Paint a circle in QPalette::ButtonText color.
Definition qwt_knob.h:124
@ Tick
Paint a single tick in QPalette::ButtonText color.
Definition qwt_knob.h:118
@ Triangle
Paint a triangle in QPalette::ButtonText color.
Definition qwt_knob.h:121
KnobStyle
Style of the knob surface.
Definition qwt_knob.h:84
@ Flat
Fill the knob with a brush from QPalette::Button.
Definition qwt_knob.h:86
@ Sunken
Build a gradient from QPalette::Midlight, QPalette::Button and QPalette::Midlight.
Definition qwt_knob.h:95
@ Raised
Build a gradient from QPalette::Midlight and QPalette::Button.
Definition qwt_knob.h:89
A class for drawing round scales.
Definition qwt_round_scale_draw.h:49