Classes | Public Types | Public Member Functions | Protected Member Functions | Properties | Private Attributes | List of all members
QwtKnob Class Reference

The Knob Widget. More...

#include <qwt_knob.h>

Inheritance diagram for QwtKnob:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Types

enum  KnobStyle { Flat, Raised, Sunken, Styled }
 Style of the knob surface. More...
 
enum  MarkerStyle {
  NoMarker = -1, Tick, Triangle, Dot,
  Nub, Notch
}
 Marker type. More...
 

Public Member Functions

Qt::Alignment alignment () const
 
int borderWidth () const
 
QRect knobRect () const
 
KnobStyle knobStyle () const
 
int knobWidth () const
 
int markerSize () const
 
MarkerStyle markerStyle () const
 
virtual QSize minimumSizeHint () const
 
int numTurns () const
 
 QwtKnob (QWidget *parent=NULL)
 Constructor. More...
 
const QwtRoundScaleDrawscaleDraw () const
 
QwtRoundScaleDrawscaleDraw ()
 
void setAlignment (Qt::Alignment)
 Set the alignment of the knob. More...
 
void setBorderWidth (int bw)
 Set the knob's border width. More...
 
void setKnobStyle (KnobStyle)
 Set the knob type. More...
 
void setKnobWidth (int)
 Change the knob's width. More...
 
void setMarkerSize (int)
 Set the size of the marker. More...
 
void setMarkerStyle (MarkerStyle)
 Set the marker type of the knob. More...
 
void setNumTurns (int)
 Set the number of turns. More...
 
void setScaleDraw (QwtRoundScaleDraw *)
 
void setTotalAngle (double angle)
 Set the total angle by which the knob can be turned. More...
 
virtual QSize sizeHint () const
 
double totalAngle () const
 
virtual ~QwtKnob ()
 Destructor. More...
 
- Public Member Functions inherited from QwtAbstractSlider
bool invertedControls () const
 
bool isReadOnly () const
 
bool isTracking () const
 
bool isValid () const
 
uint pageSteps () const
 
 QwtAbstractSlider (QWidget *parent=NULL)
 Constructor. More...
 
void setInvertedControls (bool)
 
void setPageSteps (uint)
 Set the number of steps for a page increment. More...
 
void setReadOnly (bool)
 
void setSingleSteps (uint)
 Set the number of steps for a single increment. More...
 
void setStepAlignment (bool)
 Enable step alignment. More...
 
void setTotalSteps (uint)
 Set the number of steps. More...
 
void setTracking (bool)
 Enables or disables tracking. More...
 
void setValid (bool)
 
void setWrapping (bool)
 
uint singleSteps () const
 
bool stepAlignment () const
 
uint totalSteps () const
 
double value () const
 
bool wrapping () const
 
virtual ~QwtAbstractSlider ()
 Destructor. More...
 
- Public Member Functions inherited from QwtAbstractScale
double invTransform (int) const
 
bool isInverted () const
 
double lowerBound () const
 
double maximum () const
 
double minimum () const
 
 QwtAbstractScale (QWidget *parent=NULL)
 
const QwtScaleDivscaleDiv () const
 
const QwtScaleEnginescaleEngine () const
 
QwtScaleEnginescaleEngine ()
 
const QwtScaleMapscaleMap () const
 
int scaleMaxMajor () const
 
int scaleMaxMinor () const
 
double scaleStepSize () const
 
void setLowerBound (double value)
 
void setScale (double lowerBound, double upperBound)
 Specify a scale. More...
 
void setScale (const QwtInterval &)
 Specify a scale. More...
 
void setScale (const QwtScaleDiv &)
 Specify a scale. More...
 
void setScaleEngine (QwtScaleEngine *)
 Set a scale engine. More...
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals. More...
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals. More...
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating a scale division. More...
 
void setUpperBound (double value)
 
int transform (double) const
 
double upperBound () const
 
virtual ~QwtAbstractScale ()
 Destructor. More...
 

Protected Member Functions

virtual void changeEvent (QEvent *)
 
virtual void drawFocusIndicator (QPainter *) const
 
virtual void drawKnob (QPainter *, const QRectF &) const
 Draw the knob. More...
 
virtual void drawMarker (QPainter *, const QRectF &, double arc) const
 Draw the marker at the knob's front. More...
 
virtual bool isScrollPosition (const QPoint &) const
 Determine what to do when the user presses a mouse button. More...
 
virtual void paintEvent (QPaintEvent *)
 
virtual double scrolledTo (const QPoint &) const
 Determine the value for a new position of the mouse. More...
 
- Protected Member Functions inherited from QwtAbstractSlider
double incrementedValue (double value, int stepCount) const
 
void incrementValue (int numSteps)
 
virtual void keyPressEvent (QKeyEvent *)
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void mousePressEvent (QMouseEvent *)
 
virtual void mouseReleaseEvent (QMouseEvent *)
 
virtual void scaleChange ()
 
virtual void sliderChange ()
 Calling update() More...
 
virtual void wheelEvent (QWheelEvent *)
 
- Protected Member Functions inherited from QwtAbstractScale
const QwtAbstractScaleDrawabstractScaleDraw () const
 
QwtAbstractScaleDrawabstractScaleDraw ()
 
void rescale (double lowerBound, double upperBound, double stepSize)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set a scale draw. More...
 
void updateScaleDraw ()
 

Properties

Qt::Alignment alignment
 
int borderWidth
 Return the border width. More...
 
KnobStyle knobStyle
 
int knobWidth
 Return the width of the knob. More...
 
int markerSize
 
MarkerStyle markerStyle
 
int numTurns
 
double totalAngle
 
- Properties inherited from QwtAbstractSlider
bool invertedControls
 
uint pageSteps
 
bool readOnly
 
uint singleSteps
 
bool stepAlignment
 
uint totalSteps
 
bool tracking
 
double value
 Returns the current value. More...
 
bool wrapping
 
- Properties inherited from QwtAbstractScale
double lowerBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 
double upperBound
 

Private Attributes

PrivateDatad_data
 

Additional Inherited Members

- Public Slots inherited from QwtAbstractSlider
void setValue (double val)
 
- Signals inherited from QwtAbstractSlider
void sliderMoved (double value)
 
void sliderPressed ()
 
void sliderReleased ()
 
void valueChanged (double value)
 Notify a change of value. More...
 

Detailed Description

The Knob Widget.

The QwtKnob widget imitates look and behavior of a volume knob on a radio. It looks similar to QDial - not to QwtDial.

The value range of a knob might be divided into several turns.

The layout of the knob depends on the knobWidth().

Setting a fixed knobWidth() is helpful to align several knobs with different scale labels.

knob.png

Definition at line 42 of file qwt_knob.h.

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
Flat 

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

Styled 

Build a radial gradient from QPalette::Button like it is used for QDial in various Qt styles.

Definition at line 66 of file qwt_knob.h.

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.

Triangle 

Paint a triangle 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

Definition at line 95 of file qwt_knob.h.

Constructor & Destructor Documentation

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

Constructor.

Construct a knob with an angle of 270°. The style is QwtKnob::Raised and the marker style is QwtKnob::Notch. The width of the knob is set to 50 pixels.

Parameters
parentParent widget
See also
setTotalAngle()

Definition at line 110 of file qwt_knob.cpp.

QwtKnob::~QwtKnob ( )
virtual

Destructor.

Definition at line 127 of file qwt_knob.cpp.

Member Function Documentation

Qt::Alignment QwtKnob::alignment ( ) const
int QwtKnob::borderWidth ( ) const
void QwtKnob::changeEvent ( QEvent *  event)
protectedvirtual

Handle QEvent::StyleChange and QEvent::FontChange;

Parameters
eventChange event

Reimplemented from QwtAbstractScale.

Definition at line 438 of file qwt_knob.cpp.

void QwtKnob::drawFocusIndicator ( QPainter *  painter) const
protectedvirtual

Draw the focus indicator

Parameters
painterPainter

Definition at line 706 of file qwt_knob.cpp.

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

Draw the knob.

Parameters
painterpainter
knobRectBounding rectangle of the knob (without scale)

Definition at line 496 of file qwt_knob.cpp.

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 ( clockwise, 0 at the 12 o'clock position )

Definition at line 583 of file qwt_knob.cpp.

bool QwtKnob::isScrollPosition ( const QPoint &  pos) const
protectedvirtual

Determine what to do when the user presses a mouse button.

Parameters
posMouse position
Return values
True,whenpos is inside the circle of the knob.
See also
scrolledTo()

Implements QwtAbstractSlider.

Definition at line 354 of file qwt_knob.cpp.

QRect QwtKnob::knobRect ( ) const

Calculate the bounding rectangle of the knob without the scale

Returns
Bounding rectangle of the knob
See also
knobWidth(), alignment(), QWidget::contentsRect()

Definition at line 299 of file qwt_knob.cpp.

KnobStyle QwtKnob::knobStyle ( ) const
int QwtKnob::knobWidth ( ) const
int QwtKnob::markerSize ( ) const
MarkerStyle QwtKnob::markerStyle ( ) const
QSize QwtKnob::minimumSizeHint ( ) const
virtual
Returns
Minimum size hint
See also
sizeHint()

Definition at line 852 of file qwt_knob.cpp.

int QwtKnob::numTurns ( ) const
void QwtKnob::paintEvent ( QPaintEvent *  event)
protectedvirtual

Repaint the knob

Parameters
eventPaint event

Definition at line 458 of file qwt_knob.cpp.

const QwtRoundScaleDraw * QwtKnob::scaleDraw ( ) const
Returns
the scale draw of the knob
See also
setScaleDraw()

Definition at line 279 of file qwt_knob.cpp.

QwtRoundScaleDraw * QwtKnob::scaleDraw ( )
Returns
the scale draw of the knob
See also
setScaleDraw()

Definition at line 288 of file qwt_knob.cpp.

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

Determine the value for a new position of the mouse.

Parameters
posMouse position
Returns
Value for the mouse position
See also
isScrollPosition()

Implements QwtAbstractSlider.

Definition at line 380 of file qwt_knob.cpp.

void QwtKnob::setAlignment ( Qt::Alignment  alignment)

Set the alignment of the knob.

Similar to a QLabel::alignment() the flags decide how to align the knob inside of contentsRect().

The default setting is Qt::AlignCenter

Parameters
alignmentOr'd alignment flags
See also
alignment(), setKnobWidth(), knobRect()

Definition at line 739 of file qwt_knob.cpp.

void QwtKnob::setBorderWidth ( int  borderWidth)

Set the knob's border width.

Parameters
borderWidthnew border width

Definition at line 799 of file qwt_knob.cpp.

void QwtKnob::setKnobStyle ( KnobStyle  knobStyle)

Set the knob type.

Parameters
knobStyleKnob type
See also
knobStyle(), setBorderWidth()

Definition at line 138 of file qwt_knob.cpp.

void QwtKnob::setKnobWidth ( int  width)

Change the knob's width.

Setting a fixed value for the diameter of the knob is helpful for aligning several knobs in a row.

Parameters
widthNew width
See also
knobWidth(), setAlignment()
Note
Modifies the sizePolicy()

Definition at line 768 of file qwt_knob.cpp.

void QwtKnob::setMarkerSize ( int  size)

Set the size of the marker.

When setting a size <= 0 the marker will automatically scaled to 40% of the radius of the knob.

See also
markerSize(), markerStyle()

Definition at line 821 of file qwt_knob.cpp.

void QwtKnob::setMarkerStyle ( MarkerStyle  markerStyle)

Set the marker type of the knob.

Parameters
markerStyleMarker type
See also
markerStyle(), setMarkerSize()

Definition at line 162 of file qwt_knob.cpp.

void QwtKnob::setNumTurns ( int  numTurns)

Set the number of turns.

When numTurns > 1 the knob can be turned several times around its axis

  • otherwise the total angle is floored to 360°.
See also
numTurns(), totalAngle(), setTotalAngle()

Definition at line 226 of file qwt_knob.cpp.

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()

Definition at line 266 of file qwt_knob.cpp.

void QwtKnob::setTotalAngle ( double  angle)

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

Parameters
angleAngle in degrees.

The angle has to be between [10, 360] degrees. Angles above 360 ( so that the knob can be turned several times around its axis ) have to be set using setNumTurns().

The default angle is 270 degrees.

See also
totalAngle(), setNumTurns()

Definition at line 192 of file qwt_knob.cpp.

QSize QwtKnob::sizeHint ( ) const
virtual
Returns
sizeHint()

Definition at line 842 of file qwt_knob.cpp.

double QwtKnob::totalAngle ( ) const

Member Data Documentation

PrivateData* QwtKnob::d_data
private

Definition at line 174 of file qwt_knob.h.

Property Documentation

Qt::Alignment QwtKnob::alignment
readwrite
Returns
Alignment of the knob inside of contentsRect()
See also
setAlignment(), knobWidth(), knobRect()

Definition at line 50 of file qwt_knob.h.

int QwtKnob::borderWidth
readwrite

Return the border width.

Definition at line 55 of file qwt_knob.h.

QwtKnob::KnobStyle QwtKnob::knobStyle
readwrite
Returns
Marker type of the knob
See also
setKnobStyle(), setBorderWidth()

Definition at line 48 of file qwt_knob.h.

int QwtKnob::knobWidth
readwrite

Return the width of the knob.

Definition at line 49 of file qwt_knob.h.

int QwtKnob::markerSize
readwrite
Returns
Marker size
See also
setMarkerSize()

Definition at line 54 of file qwt_knob.h.

QwtKnob::MarkerStyle QwtKnob::markerStyle
readwrite
Returns
Marker type of the knob
See also
setMarkerStyle(), setMarkerSize()

Definition at line 53 of file qwt_knob.h.

int QwtKnob::numTurns
readwrite
Returns
Number of turns.

When the total angle is below 360° numTurns() is ceiled to 1.

See also
setNumTurns(), setTotalAngle(), totalAngle()

Definition at line 52 of file qwt_knob.h.

double QwtKnob::totalAngle
readwrite
Returns
the total angle
See also
setTotalAngle(), setNumTurns(), numTurns()

Definition at line 51 of file qwt_knob.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18