Qwt User's Guide  6.0.2
Public Types | Public Member Functions | Protected Member Functions
QwtKnob Class Reference

#include <qwt_knob.h>

Inheritance diagram for QwtKnob:
Inheritance graph
[legend]

List of all members.

Public Types

enum  KnobStyle {
  NoStyle = -1,
  Raised,
  Sunken
}
enum  MarkerStyle {
  NoMarker = -1,
  Tick,
  Dot,
  Nub,
  Notch
}
- Public Types inherited from QwtAbstractSlider
enum  ScrollMode {
  ScrNone,
  ScrMouse,
  ScrTimer,
  ScrDirect,
  ScrPage
}

Public Member Functions

 QwtKnob (QWidget *parent=NULL)
virtual ~QwtKnob ()
int borderWidth () const
KnobStyle knobStyle () const
int knobWidth () const
int markerSize () const
MarkerStyle markerStyle () const
virtual QSize minimumSizeHint () const
const QwtRoundScaleDrawscaleDraw () const
QwtRoundScaleDrawscaleDraw ()
void setBorderWidth (int bw)
void setKnobStyle (KnobStyle)
void setKnobWidth (int w)
void setMarkerSize (int)
void setMarkerStyle (MarkerStyle)
void setScaleDraw (QwtRoundScaleDraw *)
void setTotalAngle (double angle)
virtual QSize sizeHint () const
double totalAngle () const
- Public Member Functions inherited from QwtAbstractSlider
 QwtAbstractSlider (Qt::Orientation, QWidget *parent=NULL)
virtual ~QwtAbstractSlider ()
bool isReadOnly () const
bool isValid () const
virtual double mass () const
Qt::Orientation orientation () const
virtual void setMass (double val)
virtual void setOrientation (Qt::Orientation o)
void setTracking (bool enable)
void setUpdateTime (int t)
void setValid (bool valid)
void stopMoving ()
- Public Member Functions inherited from QwtDoubleRange
 QwtDoubleRange ()
virtual ~QwtDoubleRange ()
virtual void incPages (int)
double maxValue () const
double minValue () const
int pageSize () const
bool periodic () const
void setPeriodic (bool tf)
void setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1)
void setStep (double)
double step () const
double value () const
- Public Member Functions inherited from QwtAbstractScale
 QwtAbstractScale ()
virtual ~QwtAbstractScale ()
bool autoScale () const
const QwtScaleEnginescaleEngine () const
QwtScaleEnginescaleEngine ()
const QwtScaleMapscaleMap () const
int scaleMaxMajor () const
int scaleMaxMinor () const
void setAutoScale ()
void setScale (double vmin, double vmax, double step=0.0)
void setScale (const QwtInterval &, double step=0.0)
void setScale (const QwtScaleDiv &)
void setScaleEngine (QwtScaleEngine *)
void setScaleMaxMajor (int ticks)
void setScaleMaxMinor (int ticks)

Protected Member Functions

virtual void changeEvent (QEvent *)
virtual void drawKnob (QPainter *, const QRectF &) const
virtual void drawMarker (QPainter *, const QRectF &, double arc) const
virtual void getScrollMode (const QPoint &, QwtAbstractSlider::ScrollMode &, int &direction) const
virtual double getValue (const QPoint &p)
virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *)
- Protected Member Functions inherited from QwtAbstractSlider
virtual void keyPressEvent (QKeyEvent *e)
virtual void mouseMoveEvent (QMouseEvent *e)
double mouseOffset () const
virtual void mousePressEvent (QMouseEvent *e)
virtual void mouseReleaseEvent (QMouseEvent *e)
int scrollMode () const
void setMouseOffset (double)
virtual void setPosition (const QPoint &)
virtual void timerEvent (QTimerEvent *e)
virtual void wheelEvent (QWheelEvent *e)
- Protected Member Functions inherited from QwtDoubleRange
double exactPrevValue () const
double exactValue () const
double prevValue () const
virtual void stepChange ()
- Protected Member Functions inherited from QwtAbstractScale
const QwtAbstractScaleDrawabstractScaleDraw () const
QwtAbstractScaleDrawabstractScaleDraw ()
void rescale (double vmin, double vmax, double step=0.0)
void setAbstractScaleDraw (QwtAbstractScaleDraw *)

Additional Inherited Members

- Public Slots inherited from QwtAbstractSlider
virtual void fitValue (double val)
virtual void incValue (int steps)
virtual void setReadOnly (bool)
virtual void setValue (double val)
- Signals inherited from QwtAbstractSlider
void sliderMoved (double value)
void sliderPressed ()
void sliderReleased ()
void valueChanged (double value)

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 QwtAbstractScale). Automatic scrolling is enabled when the user presses a mouse button on the scale. For a description of signals, slots and other members, see QwtAbstractSlider.

knob.png
See also:
QwtAbstractSlider and QwtAbstractScale for the descriptions of the inherited members.

Member Enumeration Documentation

Style of the knob surface.

Depending on the KnobStyle the surface of the knob is filled from the brushes of the widget palette().

See also:
setKnobStyle(), knobStyle()
Enumerator:
NoStyle 

Fill the knob with a brush from QPalette::Button.

Raised 

Build a gradient from QPalette::Midlight and QPalette::Button.

Sunken 

Build a gradient from QPalette::Midlight, QPalette::Button and QPalette::Midlight

Marker type.

The marker indicates the current value on the knob The default setting is a Notch marker.

See also:
setMarkerStyle(), setMarkerSize()
Enumerator:
NoMarker 

Don't paint any marker.

Tick 

Paint a single tick in QPalette::ButtonText color.

Dot 

Paint a circle in QPalette::ButtonText color.

Nub 

Draw a raised ellipse with a gradient build from QPalette::Light and QPalette::Mid

Notch 

Draw a sunken ellipse with a gradient build from QPalette::Light and QPalette::Mid


Constructor & Destructor Documentation

QwtKnob::QwtKnob ( QWidget *  parent = NULL)
explicit

Constructor

Parameters:
parentParent widget

Member Function Documentation

void QwtKnob::changeEvent ( QEvent *  event)
protectedvirtual

Handle QEvent::StyleChange and QEvent::FontChange;

Parameters:
eventChange event
void QwtKnob::drawKnob ( QPainter *  painter,
const QRectF &  knobRect 
) const
protectedvirtual

Draw the knob.

Parameters:
painterpainter
knobRectBounding rectangle of the knob (without scale)
void QwtKnob::drawMarker ( QPainter *  painter,
const QRectF &  rect,
double  angle 
) const
protectedvirtual

Draw the marker at the knob's front.

Parameters:
painterPainter
rectBounding rectangle of the knob without scale
angleAngle of the marker in degrees
void QwtKnob::getScrollMode ( const QPoint &  pos,
QwtAbstractSlider::ScrollMode scrollMode,
int &  direction 
) const
protectedvirtual

Set the scrolling mode and direction.

Called by QwtAbstractSlider

Parameters:
posPoint in question
scrollModeScrolling mode
directionDirection

Implements QwtAbstractSlider.

double QwtKnob::getValue ( const QPoint &  pos)
protectedvirtual

Determine the value corresponding to a specified position.

Called by QwtAbstractSlider

Parameters:
pospoint

Implements QwtAbstractSlider.

QwtKnob::KnobStyle QwtKnob::knobStyle ( ) const
Returns:
Marker type of the knob
See also:
setKnobStyle(), setBorderWidth()
QwtKnob::MarkerStyle QwtKnob::markerStyle ( ) const
Returns:
Marker type of the knob
See also:
setMarkerStyle(), setMarkerSize()
QSize QwtKnob::minimumSizeHint ( ) const
virtual

Return a minimum size hint.

Warning:
The return value of QwtKnob::minimumSizeHint() depends on the font and the scale.
void QwtKnob::paintEvent ( QPaintEvent *  event)
protectedvirtual

Repaint the knob

Parameters:
eventPaint event
void QwtKnob::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Qt Resize Event

Parameters:
eventResize event
const QwtRoundScaleDraw * QwtKnob::scaleDraw ( ) const
Returns:
the scale draw of the knob
See also:
setScaleDraw()
QwtRoundScaleDraw * QwtKnob::scaleDraw ( )
Returns:
the scale draw of the knob
See also:
setScaleDraw()
void QwtKnob::setBorderWidth ( int  borderWidth)

Set the knob's border width.

Parameters:
borderWidthnew border width
void QwtKnob::setKnobStyle ( KnobStyle  knobStyle)

Set the knob type.

Parameters:
knobStyleKnob type
See also:
knobStyle(), setBorderWidth()
void QwtKnob::setKnobWidth ( int  width)

Change the knob's width.

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

Parameters:
widthNew width
void QwtKnob::setMarkerSize ( int  size)

Set the size of the marker.

See also:
markerSize(), markerStyle()
void QwtKnob::setMarkerStyle ( MarkerStyle  markerStyle)

Set the marker type of the knob.

Parameters:
markerStyleMarker type
See also:
markerStyle(), setMarkerSize()
void QwtKnob::setScaleDraw ( QwtRoundScaleDraw scaleDraw)

Change the scale draw of the knob

For changing the labels of the scales, it is necessary to derive from QwtRoundScaleDraw and overload QwtRoundScaleDraw::label().

See also:
scaleDraw()
void QwtKnob::setTotalAngle ( double  angle)

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

Parameters:
angleAngle 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.

QSize QwtKnob::sizeHint ( ) const
virtual