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
16 class QPainter;
17
27 class QWT_EXPORT QwtDialNeedle
28{
29 public:
30 QwtDialNeedle();
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
81 class QWT_EXPORT QwtDialSimpleNeedle : public QwtDialNeedle
82{
83 public:
85 enum Style
86 {
88 Arrow,
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
127 class QWT_EXPORT QwtCompassMagnetNeedle : public QwtDialNeedle
128{
129 public:
131 enum Style
132 {
134 TriangleStyle,
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
164 class QWT_EXPORT QwtCompassWindArrow : public QwtDialNeedle
165{
166 public:
168 enum Style
169 {
171 Style1,
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
QwtCompassMagnetNeedle
A magnet needle for compass widgets.
Definition qwt_dial_needle.h:128
QwtCompassMagnetNeedle::Style
Style
Style of the needle.
Definition qwt_dial_needle.h:132
QwtCompassMagnetNeedle::TriangleStyle
@ TriangleStyle
A needle with a triangular shape.
Definition qwt_dial_needle.h:134
QwtCompassWindArrow
An indicator for the wind direction.
Definition qwt_dial_needle.h:165
QwtCompassWindArrow::Style
Style
Style of the arrow.
Definition qwt_dial_needle.h:169
QwtCompassWindArrow::Style1
@ Style1
A needle pointing to the center.
Definition qwt_dial_needle.h:171
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition qwt_dial_needle.h:28
QwtDialNeedle::drawNeedle
virtual void drawNeedle(QPainter *painter, double length, QPalette::ColorGroup colorGroup) const =0
Draw the needle.
QwtDialSimpleNeedle
A needle for dial widgets.
Definition qwt_dial_needle.h:82
QwtDialSimpleNeedle::Style
Style
Style of the needle.
Definition qwt_dial_needle.h:86
QwtDialSimpleNeedle::Arrow
@ Arrow
Arrow.
Definition qwt_dial_needle.h:88