Qwt User's Guide 6.3.0
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
10#ifndef QWT_DIAL_NEEDLE_H
11#define QWT_DIAL_NEEDLE_H
12
13#include "qwt_global.h"
14#include <qpalette.h>
15
16class QPainter;
17
27class QWT_EXPORT QwtDialNeedle
28{
29 public:
31 virtual ~QwtDialNeedle();
32
33 virtual void setPalette( const QPalette& );
34 const QPalette& palette() const;
35
36 virtual void draw( QPainter*, const QPointF& center,
37 double length, double direction,
38 QPalette::ColorGroup = QPalette::Active ) const;
39
40 protected:
56 virtual void drawNeedle( QPainter* painter,
57 double length, QPalette::ColorGroup colorGroup ) const = 0;
58
59 virtual void drawKnob( QPainter*, double width,
60 const QBrush&, bool sunken ) const;
61
62 private:
63 Q_DISABLE_COPY(QwtDialNeedle)
64
65 QPalette m_palette;
66};
67
81class QWT_EXPORT QwtDialSimpleNeedle : public QwtDialNeedle
82{
83 public:
85 enum Style
86 {
89
91 Ray
92 };
93
94 QwtDialSimpleNeedle( Style, bool hasKnob = true,
95 const QColor& mid = Qt::gray, const QColor& base = Qt::darkGray );
96
97 void setWidth( double width );
98 double width() const;
99
100 protected:
101 virtual void drawNeedle( QPainter*, double length,
102 QPalette::ColorGroup ) const QWT_OVERRIDE;
103
104 private:
105 Style m_style;
106 bool m_hasKnob;
107 double m_width;
108};
109
127class QWT_EXPORT QwtCompassMagnetNeedle : public QwtDialNeedle
128{
129 public:
131 enum Style
132 {
135
137 ThinStyle
138 };
139
140 QwtCompassMagnetNeedle( Style = TriangleStyle,
141 const QColor& light = Qt::white, const QColor& dark = Qt::red );
142
143 protected:
144 virtual void drawNeedle( QPainter*,
145 double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
146
147 private:
148 Style m_style;
149};
150
164class QWT_EXPORT QwtCompassWindArrow : public QwtDialNeedle
165{
166 public:
168 enum Style
169 {
172
174 Style2
175 };
176
177 QwtCompassWindArrow( Style, const QColor& light = Qt::white,
178 const QColor& dark = Qt::gray );
179
180 protected:
181 virtual void drawNeedle( QPainter*,
182 double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
183
184 private:
185 Style m_style;
186};
187
188#endif
A magnet needle for compass widgets.
Style
Style of the needle.
@ TriangleStyle
A needle with a triangular shape.
An indicator for the wind direction.
Style
Style of the arrow.
@ Style1
A needle pointing to the center.
Base class for needles that can be used in a QwtDial.
virtual void drawNeedle(QPainter *painter, double length, QPalette::ColorGroup colorGroup) const =0
Draw the needle.
A needle for dial widgets.
Style
Style of the needle.