Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

QwtKnob Class Reference

The Knob Widget. More...

#include <qwt_knob.h>

Inheritance diagram for QwtKnob:

QwtSliderBase QwtScaleIf QwtDblRange List of all members.

Public Types

enum  Symbol { Line, Dot }

Public Member Functions

 QwtKnob (QWidget *parent=0, const char *name=0)
virtual ~QwtKnob ()
void setKnobWidth (int w)
int knobWidth () const
void setTotalAngle (double angle)
double totalAngle () const
void setBorderWidth (int bw)
int borderWidth () const
void setSymbol (Symbol)
Symbol symbol () const
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
virtual QSizePolicy sizePolicy () const

Protected Member Functions

virtual void paintEvent (QPaintEvent *e)
virtual void resizeEvent (QResizeEvent *e)
void draw (QPainter *p, const QRect &ur)
void drawKnob (QPainter *p, const QRect &r)
void drawMarker (QPainter *p, double arc, const QColor &c)

Private Member Functions

void layoutKnob (bool update=TRUE)
double getValue (const QPoint &p)
void getScrollMode (const QPoint &p, int &scrollMode, int &direction)
void recalcAngle ()
virtual void valueChange ()
virtual void rangeChange ()
virtual void scaleChange ()
virtual void fontChange (const QFont &oldFont)

Private Attributes

int d_borderWidth
int d_borderDist
int d_hasScale
int d_scaleDist
int d_maxScaleTicks
int d_knobWidth
int d_dotWidth
Symbol d_symbol
double d_angle
double d_oldAngle
double d_totalAngle
double d_nTurns
QRect d_kRect

Detailed Description

The Knob Widget.

The QwtKnob widget imitates look and behaviour of a volume knob on a radio. It contains a scale around the knob which is set up automatically or can be configured manually (see QwtScaleIf). Automatic scrolling is enabled when the user presses a mouse button on the scale. For a description of signals, slots and other members, see QwtSliderBase.

knob.gif
See also:
QwtSliderBase and QwtScaleIf for the descriptions of the inherited members.

Definition at line 32 of file qwt_knob.h.


Member Enumeration Documentation

enum QwtKnob::Symbol
 

Symbol

See also:
QwtKnob::QwtKnob()
Enumeration values:
Line 
Dot 

Definition at line 47 of file qwt_knob.h.

Referenced by symbol().


Constructor & Destructor Documentation

QwtKnob::QwtKnob QWidget *  parent = 0,
const char *  name = 0
 

Constructor.

Parameters:
parent Parent widget
name Name

Definition at line 22 of file qwt_knob.cpp.

References d_angle, d_borderDist, d_borderWidth, d_dotWidth, d_hasScale, d_knobWidth, d_maxScaleTicks, d_nTurns, d_oldAngle, d_scaleDist, QwtScaleIf::d_scaleDraw, d_symbol, d_totalAngle, Line, recalcAngle(), QwtScaleDraw::Round, QwtScaleDraw::setGeometry(), setTotalAngle(), and QwtSliderBase::setUpdateTime().

QwtKnob::~QwtKnob  )  [virtual]
 

Destructor.

Definition at line 46 of file qwt_knob.cpp.


Member Function Documentation

int QwtKnob::borderWidth  )  const [inline]
 

Definition at line 57 of file qwt_knob.h.

void QwtKnob::draw QPainter *  painter,
const QRect &  ur
[protected]
 

Repaint the knob.

Definition at line 271 of file qwt_knob.cpp.

References d_kRect, QwtScaleIf::d_scaleDraw, QwtScaleDraw::draw(), and drawKnob().

Referenced by paintEvent().

void QwtKnob::drawKnob QPainter *  p,
const QRect &  r
[protected]
 

Draw the knob.

Parameters:
p painter
r borders of the knob

Definition at line 96 of file qwt_knob.cpp.

References d_angle, d_borderWidth, and drawMarker().

Referenced by draw().

void QwtKnob::drawMarker QPainter *  p,
double  arc,
const QColor &  c
[protected]
 

Draw the marker at the knob's front.

Parameters:
p Painter
arc Angle of the marker
c Marker color

Definition at line 297 of file qwt_knob.cpp.

References d_borderWidth, d_dotWidth, d_kRect, d_symbol, Dot, Line, M_PI, and qwtMax.

Referenced by drawKnob().

void QwtKnob::fontChange const QFont &  f  )  [private, virtual]
 

Recalculates the layout

See also:
QwtKnob::layoutKnob()

Definition at line 401 of file qwt_knob.cpp.

References layoutKnob().

void QwtKnob::getScrollMode const QPoint &  p,
int &  scrollMode,
int &  direction
[private, virtual]
 

Set the scrolling mode and direction.

Called by QwtSliderBase

Parameters:
p Point in question

Implements QwtSliderBase.

Definition at line 179 of file qwt_knob.cpp.

References d_angle, d_kRect, M_PI, QwtSliderBase::ScrMouse, and QwtSliderBase::ScrTimer.

double QwtKnob::getValue const QPoint &  p  )  [private, virtual]
 

Determine the value corresponding to a specified position.

Called by QwtSliderBase

Parameters:
p point

Implements QwtSliderBase.

Definition at line 148 of file qwt_knob.cpp.

References QwtSliderBase::d_mouseOffset, d_nTurns, d_totalAngle, M_PI, QwtDblRange::maxValue(), QwtDblRange::minValue(), and QwtDblRange::value().

int QwtKnob::knobWidth  )  const [inline]
 

Definition at line 53 of file qwt_knob.h.

void QwtKnob::layoutKnob bool  update = TRUE  )  [private]
 

Recalculate the slider's geometry and layout based on.

Definition at line 233 of file qwt_knob.cpp.

References d_knobWidth, d_kRect, d_scaleDist, QwtScaleIf::d_scaleDraw, qwtMin, QwtScaleDraw::Round, and QwtScaleDraw::setGeometry().

Referenced by fontChange(), rangeChange(), resizeEvent(), scaleChange(), setBorderWidth(), setKnobWidth(), and setTotalAngle().

QSize QwtKnob::minimumSizeHint  )  const [virtual]
 

Return a minimum size hint.

Warning:
The return value of QwtKnob::minimumSizeHint() depends on the font and the scale.

Definition at line 429 of file qwt_knob.cpp.

References d_knobWidth, d_scaleDist, QwtScaleIf::d_scaleDraw, and QwtScaleDraw::minHeight().

Referenced by sizeHint().

void QwtKnob::paintEvent QPaintEvent *  e  )  [protected, virtual]
 

Repaint the knob.

Definition at line 258 of file qwt_knob.cpp.

References draw(), and QwtPaintBuffer::painter().

void QwtKnob::rangeChange  )  [private, virtual]
 

Notify a change of the range.

Called by QwtSliderBase

Reimplemented from QwtDblRange.

Definition at line 210 of file qwt_knob.cpp.

References QwtScaleIf::d_maxMajor, QwtScaleIf::d_maxMinor, QwtScaleIf::d_scaleDraw, QwtScaleIf::hasUserScale(), layoutKnob(), QwtDblRange::maxValue(), QwtDblRange::minValue(), recalcAngle(), and QwtScaleDraw::setScale().

void QwtKnob::recalcAngle  )  [private]
 

Recalculate the marker angle corresponding to the current value.

Definition at line 366 of file qwt_knob.cpp.

References d_angle, d_nTurns, d_oldAngle, d_totalAngle, QwtDblRange::maxValue(), QwtDblRange::minValue(), and QwtDblRange::value().

Referenced by QwtKnob(), rangeChange(), and valueChange().

void QwtKnob::resizeEvent QResizeEvent *  e  )  [protected, virtual]
 

Qt Resize Event.

Definition at line 224 of file qwt_knob.cpp.

References layoutKnob().

void QwtKnob::scaleChange  )  [private, virtual]
 

Recalculates the layout

See also:
QwtKnob::layoutKnob()

Implements QwtScaleIf.

Definition at line 392 of file qwt_knob.cpp.

References layoutKnob().

void QwtKnob::setBorderWidth int  bw  ) 
 

Set the knob's border width.

Parameters:
bw new border width

Definition at line 356 of file qwt_knob.cpp.

References d_borderWidth, layoutKnob(), and qwtMax.

void QwtKnob::setKnobWidth int  w  ) 
 

Change the knob's width.

The specified width must be >= 5, or it will be clipped.

Parameters:
w New width

Definition at line 346 of file qwt_knob.cpp.

References d_knobWidth, layoutKnob(), and qwtMax.

void QwtKnob::setSymbol QwtKnob::Symbol  s  ) 
 

Set the symbol of the knob.

See also:
QwtKnob::symbol()

Definition at line 54 of file qwt_knob.cpp.

References d_symbol.

void QwtKnob::setTotalAngle double  angle  ) 
 

Set the total angle by which the knob can be turned.

Parameters:
angle Angle in degrees.
The default angle is 270 degrees. It is possible to specify an angle of more than 360 degrees so that the knob can be turned several times around its axis.

Definition at line 80 of file qwt_knob.cpp.

References QwtScaleIf::d_scaleDraw, d_totalAngle, layoutKnob(), and QwtScaleDraw::setAngleRange().

Referenced by QwtKnob().

QSize QwtKnob::sizeHint  )  const [virtual]
 

Returns:
QwtKnob::minimumSizeHint()

Definition at line 419 of file qwt_knob.cpp.

References minimumSizeHint().

QSizePolicy QwtKnob::sizePolicy  )  const [virtual]
 

Returns:
Fixed/Fixed

Definition at line 408 of file qwt_knob.cpp.

QwtKnob::Symbol QwtKnob::symbol  )  const
 

Returns:
symbol of the knob
See also:
QwtKnob::setSymbol()

Definition at line 67 of file qwt_knob.cpp.

References d_symbol, and Symbol.

double QwtKnob::totalAngle  )  const [inline]
 

Definition at line 55 of file qwt_knob.h.

void QwtKnob::valueChange  )  [private, virtual]
 

Notify change of value.

Sets the slider's value to the nearest multiple of the step size.

Reimplemented from QwtSliderBase.

Definition at line 135 of file qwt_knob.cpp.

References recalcAngle(), and QwtSliderBase::valueChange().


Member Data Documentation

double QwtKnob::d_angle [private]
 

Definition at line 93 of file qwt_knob.h.

Referenced by drawKnob(), getScrollMode(), QwtKnob(), and recalcAngle().

int QwtKnob::d_borderDist [private]
 

Definition at line 85 of file qwt_knob.h.

Referenced by QwtKnob().

int QwtKnob::d_borderWidth [private]
 

Definition at line 84 of file qwt_knob.h.

Referenced by drawKnob(), drawMarker(), QwtKnob(), and setBorderWidth().

int QwtKnob::d_dotWidth [private]
 

Definition at line 90 of file qwt_knob.h.

Referenced by drawMarker(), and QwtKnob().

int QwtKnob::d_hasScale [private]
 

Definition at line 86 of file qwt_knob.h.

Referenced by QwtKnob().

int QwtKnob::d_knobWidth [private]
 

Definition at line 89 of file qwt_knob.h.

Referenced by layoutKnob(), minimumSizeHint(), QwtKnob(), and setKnobWidth().

QRect QwtKnob::d_kRect [private]
 

Definition at line 98 of file qwt_knob.h.

Referenced by draw(), drawMarker(), getScrollMode(), and layoutKnob().

int QwtKnob::d_maxScaleTicks [private]
 

Definition at line 88 of file qwt_knob.h.

Referenced by QwtKnob().

double QwtKnob::d_nTurns [private]
 

Definition at line 96 of file qwt_knob.h.

Referenced by getValue(), QwtKnob(), and recalcAngle().

double QwtKnob::d_oldAngle [private]
 

Definition at line 94 of file qwt_knob.h.

Referenced by QwtKnob(), and recalcAngle().

int QwtKnob::d_scaleDist [private]
 

Definition at line 87 of file qwt_knob.h.

Referenced by layoutKnob(), minimumSizeHint(), and QwtKnob().

Symbol QwtKnob::d_symbol [private]
 

Definition at line 92 of file qwt_knob.h.

Referenced by drawMarker(), QwtKnob(), setSymbol(), and symbol().

double QwtKnob::d_totalAngle [private]
 

Definition at line 95 of file qwt_knob.h.

Referenced by getValue(), QwtKnob(), recalcAngle(), and setTotalAngle().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:48 2003 for Qwt Developer's Guide by doxygen 1.3.2