QWT 7.0.1
Loading...
Searching...
No Matches
qwt_dial_needle.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_DIAL_NEEDLE_H
28#define QWT_DIAL_NEEDLE_H
29
30#include "qwt_global.h"
31#include <qpalette.h>
32
33class QPainter;
34
44class QWT_EXPORT QwtDialNeedle
45{
46 public:
48 virtual ~QwtDialNeedle();
49
50 virtual void setPalette( const QPalette& );
51 const QPalette& palette() const;
52
53 virtual void draw( QPainter*, const QPointF& center,
54 double length, double direction,
55 QPalette::ColorGroup = QPalette::Active ) const;
56
57 protected:
73 virtual void drawNeedle( QPainter* painter,
74 double length, QPalette::ColorGroup colorGroup ) const = 0;
75
76 virtual void drawKnob( QPainter*, double width,
77 const QBrush&, bool sunken ) const;
78
79 private:
80 Q_DISABLE_COPY(QwtDialNeedle)
81
82 QPalette m_palette;
83};
84
98class QWT_EXPORT QwtDialSimpleNeedle : public QwtDialNeedle
99{
100 public:
102 enum Style
103 {
106
108 Ray
109 };
110
111 QwtDialSimpleNeedle( Style, bool hasKnob = true,
112 const QColor& mid = Qt::gray, const QColor& base = Qt::darkGray );
113
114 void setWidth( double width );
115 double width() const;
116
117 protected:
118 virtual void drawNeedle( QPainter*, double length,
119 QPalette::ColorGroup ) const QWT_OVERRIDE;
120
121 private:
122 Style m_style;
123 bool m_hasKnob;
124 double m_width;
125};
126
144class QWT_EXPORT QwtCompassMagnetNeedle : public QwtDialNeedle
145{
146 public:
148 enum Style
149 {
152
154 ThinStyle
155 };
156
157 QwtCompassMagnetNeedle( Style = TriangleStyle,
158 const QColor& light = Qt::white, const QColor& dark = Qt::red );
159
160 protected:
161 virtual void drawNeedle( QPainter*,
162 double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
163
164 private:
165 Style m_style;
166};
167
181class QWT_EXPORT QwtCompassWindArrow : public QwtDialNeedle
182{
183 public:
185 enum Style
186 {
189
191 Style2
192 };
193
194 QwtCompassWindArrow( Style, const QColor& light = Qt::white,
195 const QColor& dark = Qt::gray );
196
197 protected:
198 virtual void drawNeedle( QPainter*,
199 double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
200
201 private:
202 Style m_style;
203};
204
205#endif
A magnet needle for compass widgets.
Definition qwt_dial_needle.h:145
Style
Style of the needle.
Definition qwt_dial_needle.h:149
@ TriangleStyle
A needle with a triangular shape.
Definition qwt_dial_needle.h:151
An indicator for the wind direction.
Definition qwt_dial_needle.h:182
Style
Style of the arrow.
Definition qwt_dial_needle.h:186
@ Style1
A needle pointing to the center.
Definition qwt_dial_needle.h:188
Base class for needles that can be used in a QwtDial.
Definition qwt_dial_needle.h:45
virtual void drawNeedle(QPainter *painter, double length, QPalette::ColorGroup colorGroup) const =0
Draw the needle.
A needle for dial widgets.
Definition qwt_dial_needle.h:99
Style
Style of the needle.
Definition qwt_dial_needle.h:103
@ Arrow
Arrow.
Definition qwt_dial_needle.h:105