qwt_dial_needle.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 
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 d_palette;
66 };
67 
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 d_style;
106  bool d_hasKnob;
107  double d_width;
108 };
109 
127 class 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 d_style;
149 };
150 
164 class 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 d_style;
186 };
187 
188 #endif
A magnet needle for compass widgets.
#define QWT_EXPORT
Definition: qwt_global.h:38
Style
Style of the needle.
Style
Style of the needle.
Base class for needles that can be used in a QwtDial.
Style
Style of the arrow.
An indicator for the wind direction.
A needle pointing to the center.
A needle for dial widgets.
A needle with a triangular shape.
#define QWT_OVERRIDE
Definition: qwt_global.h:53


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10