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
*****************************************************************************/
13
#include "qwt_global.h"
14
#include "qwt_abstract_slider.h"
15
#include "qwt_abstract_scale.h"
17
class QwtRoundScaleDraw;
20
\brief The Knob Widget
22
The QwtKnob widget imitates look and behaviour of a volume knob on a radio.
23
It contains a scale around the knob which is set up automatically or can
24
be configured manually (see QwtAbstractScale).
25
Automatic scrolling is enabled when the user presses a mouse
26
button on the scale. For a description of signals, slots and other
27
members, see QwtAbstractSlider.
30
\sa QwtAbstractSlider and QwtAbstractScale for the descriptions
31
of the inherited members.
34
class QWT_EXPORT QwtKnob : public QwtAbstractSlider, public QwtAbstractScale
38
Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth )
39
Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
40
Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
41
Q_PROPERTY( Symbol symbol READ symbol WRITE setSymbol )
46
\sa QwtKnob::QwtKnob()
49
enum Symbol { Line, Dot };
51
explicit QwtKnob(QWidget* parent = NULL);
52
#if QT_VERSION < 0x040000
53
explicit QwtKnob(QWidget* parent, const char *name);
57
void setKnobWidth(int w);
58
int knobWidth() const;
60
void setTotalAngle (double angle);
61
double totalAngle() const;
63
void setBorderWidth(int bw);
64
int borderWidth() const;
66
void setSymbol(Symbol);
67
Symbol symbol() const;
69
virtual QSize sizeHint() const;
70
virtual QSize minimumSizeHint() const;
72
void setScaleDraw(QwtRoundScaleDraw *);
73
const QwtRoundScaleDraw *scaleDraw() const;
74
QwtRoundScaleDraw *scaleDraw();
77
virtual void paintEvent(QPaintEvent *e);
78
virtual void resizeEvent(QResizeEvent *e);
80
void draw(QPainter *p, const QRect& ur);
81
void drawKnob(QPainter *p, const QRect &r);
82
void drawMarker(QPainter *p, double arc, const QColor &c);
86
void layoutKnob( bool update = true );
87
double getValue(const QPoint &p);
88
void getScrollMode( const QPoint &p, int &scrollMode, int &direction );
91
virtual void valueChange();
92
virtual void rangeChange();
93
virtual void scaleChange();
94
virtual void fontChange(const QFont &oldFont);