1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
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
*****************************************************************************/
17
#include "qwt_global.h"
18
#include "qwt_abstract_slider.h"
19
#include "qwt_round_scale_draw.h"
25
\brief A special scale draw made for QwtDial
27
\sa QwtDial, QwtCompass
29
class QWT_EXPORT QwtDialScaleDraw: public QwtRoundScaleDraw
32
explicit QwtDialScaleDraw(QwtDial *);
33
virtual QwtText label(double value) const;
35
void setPenWidth(uint);
36
uint penWidth() const;
44
\brief QwtDial class provides a rounded range control.
46
QwtDial is intended as base class for dial widgets like
47
speedometers, compass widgets, clocks ...
49
\image html dials2.png
51
A dial contains a scale and a needle indicating the current value
52
of the dial. Depending on Mode one of them is fixed and the
53
other is rotating. If not isReadOnly() the
54
dial can be rotated by dragging the mouse or using keyboard inputs
55
(see keyPressEvent()). A dial might be wrapping, what means
56
a rotation below/above one limit continues on the other limit (f.e compass).
57
The scale might cover any arc of the dial, its values are related to
58
the origin() of the dial.
60
Qwt is missing a set of good looking needles (QwtDialNeedle).
61
Contributions are very welcome.
63
\sa QwtCompass, QwtAnalogClock, QwtDialNeedle
64
\note The examples/dials example shows different types of dials.
67
class QWT_EXPORT QwtDial: public QwtAbstractSlider
74
Q_PROPERTY(bool visibleBackground READ hasVisibleBackground WRITE showBackground)
75
Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
76
Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow)
77
Q_PROPERTY(Mode mode READ mode WRITE setMode)
78
Q_PROPERTY(double origin READ origin WRITE setOrigin)
79
Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
81
friend class QwtDialScaleDraw;
87
Unfortunately it is not possible to use QFrame::Shadow
88
as a property of a widget that is not derived from QFrame.
89
The following enum is made for the designer only. It is safe
90
to use QFrame::Shadow instead.
94
Plain = QFrame::Plain,
95
Raised = QFrame::Raised,
96
Sunken = QFrame::Sunken
99
//! see QwtDial::setScaleOptions
108
In case of RotateNeedle the needle is rotating, in case of
109
RotateScale, the needle points to origin()
110
and the scale is rotating.
118
explicit QwtDial( QWidget *parent = NULL);
119
#if QT_VERSION < 0x040000
120
explicit QwtDial( QWidget *parent, const char *name);
125
void setFrameShadow(Shadow);
126
Shadow frameShadow() const;
128
bool hasVisibleBackground() const;
129
void showBackground(bool);
131
void setLineWidth(int);
132
int lineWidth() const;
137
virtual void setWrapping(bool);
138
bool wrapping() const;
140
virtual void setScale(int maxMajIntv, int maxMinIntv, double step = 0.0);
142
void setScaleArc(double min, double max);
143
void setScaleOptions(int);
144
void setScaleTicks(int minLen, int medLen, int majLen, int penWidth = 1);
146
double minScaleArc() const;
147
double maxScaleArc() const;
149
virtual void setOrigin(double);
150
double origin() const;
152
virtual void setNeedle(QwtDialNeedle *);
153
const QwtDialNeedle *needle() const;
154
QwtDialNeedle *needle();
156
QRect boundingRect() const;
157
QRect contentsRect() const;
158
virtual QRect scaleContentsRect() const;
160
virtual QSize sizeHint() const;
161
virtual QSize minimumSizeHint() const;
163
virtual void setScaleDraw(QwtDialScaleDraw *);
165
QwtDialScaleDraw *scaleDraw();
166
const QwtDialScaleDraw *scaleDraw() const;
169
virtual void paintEvent(QPaintEvent *);
170
virtual void resizeEvent(QResizeEvent *);
171
virtual void keyPressEvent(QKeyEvent *);
173
virtual void updateMask();
175
virtual void drawFrame(QPainter *p);
176
virtual void drawContents(QPainter *) const;
177
virtual void drawFocusIndicator(QPainter *) const;
179
virtual void drawScale(QPainter *, const QPoint ¢er,
180
int radius, double origin, double arcMin, double arcMax) const;
183
Draw the contents inside the scale
187
\param painter Painter
188
\param center Center of the contents circle
189
\param radius Radius of the contents circle
191
virtual void drawScaleContents(QPainter *painter, const QPoint ¢er,
194
virtual void drawNeedle(QPainter *, const QPoint &,
195
int radius, double direction, QPalette::ColorGroup) const;
197
virtual QwtText scaleLabel(double) const;
200
virtual void rangeChange();
201
virtual void valueChange();
203
virtual double getValue(const QPoint &);
204
virtual void getScrollMode(const QPoint &,
205
int &scrollMode, int &direction);