QwtKnob(3)
π QwtKnob β Library Functions Manual, but make it group chat β¨
okay bestie, we are in the Library Functions Manual and the main character is QwtKnob(3). This is part 1, so get comfy. π
πΈ NAME πΈ
QwtKnob β The Knob Widget. periodt. π
β¨ SYNOPSIS β¨
#include <qwt_knob.h>
Inherits QwtAbstractSlider. π
π¦ Public Types π¦
enum KnobStyle { Flat, Raised, Sunken, Styled }β style of the knob surface. πenum MarkerStyle { NoMarker = -1, Tick, Triangle, Dot, Nub, Notch }β marker type. π
π Public Member Functions π
These are the functions QwtKnob brings to the group chat:
QwtKnob (QWidget *parent=NULL)β constructor. π«Άvirtual ~QwtKnob ()β destructor.void setAlignment (Qt::Alignment)β set the alignment of the knob.Qt::Alignment alignment () constβ signature only in the original, bestie.void setKnobWidth (int)β change the knob's width.int knobWidth () constβ return the width of the knob.void setNumTurns (int)β set the number of turns.int numTurns () constβ signature only in the original.void setTotalAngle (double angle)β set the total angle by which the knob can be turned.double totalAngle () constβ signature only in the original.void setKnobStyle (KnobStyle)β set the knob type.KnobStyle knobStyle () constβ signature only in the original.void setBorderWidth (int)β set the knob's border width.int borderWidth () constβ return the border width.void setMarkerStyle (MarkerStyle)β set the marker type of the knob.MarkerStyle markerStyle () constβ signature only in the original.void setMarkerSize (int)β set the size of the marker.int markerSize () constβ signature only in the original.virtual QSize sizeHint () const overrideβ signature only in the original.virtual QSize minimumSizeHint () const overrideβ signature only in the original.void setScaleDraw (QwtRoundScaleDraw *)β signature only in the original.const QwtRoundScaleDraw * scaleDraw () constβ signature only in the original.QwtRoundScaleDraw * scaleDraw ()β signature only in the original.QRect knobRect () constβ signature only in the original.
π Public Member Functions inherited from QwtAbstractSlider π
QwtAbstractSlider (QWidget *parent=NULL)β constructor.virtual ~QwtAbstractSlider ()β destructor.void setValid (bool)β signature only in the original.bool isValid () constβ signature only in the original.double value () constβ returns the current value.void setWrapping (bool)β signature only in the original.bool wrapping () constβ signature only in the original.void setTotalSteps (uint)β set the number of steps.uint totalSteps () constβ signature only in the original.void setSingleSteps (uint)β set the number of steps for a single increment.uint singleSteps () constβ signature only in the original.void setPageSteps (uint)β set the number of steps for a page increment.uint pageSteps () constβ signature only in the original.void setStepAlignment (bool)β enable step alignment.bool stepAlignment () constβ signature only in the original.void setTracking (bool)β enables or disables tracking.bool isTracking () constβ signature only in the original.void setReadOnly (bool)β signature only in the original.bool isReadOnly () constβ signature only in the original.void setInvertedControls (bool)β signature only in the original.bool invertedControls () constβ signature only in the original.
π Public Member Functions inherited from QwtAbstractScale π
QwtAbstractScale (QWidget *parent=NULL)β signature only in the original.virtual ~QwtAbstractScale ()β destructor.void setScale (double lowerBound, double upperBound)β specify a scale.void setScale (const QwtInterval &)β specify a scale.void setScale (const QwtScaleDiv &)β specify a scale.const QwtScaleDiv & scaleDiv () constβ signature only in the original.void setLowerBound (double value)β signature only in the original.double lowerBound () constβ signature only in the original.void setUpperBound (double value)β signature only in the original.double upperBound () constβ signature only in the original.void setScaleStepSize (double stepSize)β set the step size used for calculating a scale division.double scaleStepSize () constβ signature only in the original.void setScaleMaxMajor (int ticks)β set the maximum number of major tick intervals.int scaleMaxMinor () constβ signature only in the original. yes, the original lists it right here, no cap.void setScaleMaxMinor (int ticks)β set the maximum number of minor tick intervals.int scaleMaxMajor () constβ signature only in the original.void setScaleEngine (QwtScaleEngine *)β set a scale engine.const QwtScaleEngine * scaleEngine () constβ signature only in the original.QwtScaleEngine * scaleEngine ()β signature only in the original.int transform (double) constβ signature only in the original.double invTransform (int) constβ signature only in the original.bool isInverted () constβ signature only in the original.double minimum () constβ signature only in the original.double maximum () constβ signature only in the original.const QwtScaleMap & scaleMap () constβ signature only in the original.
π‘οΈ Protected Member Functions π‘οΈ
virtual void paintEvent (QPaintEvent *) overrideβ signature only in the original.virtual void changeEvent (QEvent *) overrideβ signature only in the original.virtual void drawKnob (QPainter *, const QRectF &) constβ draw the knob.virtual void drawFocusIndicator (QPainter *) constβ signature only in the original.virtual void drawMarker (QPainter *, const QRectF &, double angle) constβ draw the marker at the knob's front.virtual double scrolledTo (const QPoint &) const overrideβ determine the value for a new position of the mouse.virtual bool isScrollPosition (const QPoint &) const overrideβ determine what to do when the user presses a mouse button.
π§ Protected Member Functions inherited from QwtAbstractSlider π§
virtual void mousePressEvent (QMouseEvent *) overrideβ signature only in the original.virtual void mouseReleaseEvent (QMouseEvent *) overrideβ signature only in the original.virtual void mouseMoveEvent (QMouseEvent *) overrideβ signature only in the original.virtual void keyPressEvent (QKeyEvent *) overrideβ signature only in the original.virtual void wheelEvent (QWheelEvent *) overrideβ signature only in the original.void incrementValue (int stepCount)β signature only in the original.virtual void scaleChange () overrideβ signature only in the original.virtual void sliderChange ()β callingupdate().double incrementedValue (double value, int stepCount) constβ signature only in the original.
π Protected Member Functions inherited from QwtAbstractScale π
void rescale (double lowerBound, double upperBound, double stepSize)β signature only in the original.void setAbstractScaleDraw (QwtAbstractScaleDraw *)β set a scale draw.const QwtAbstractScaleDraw * abstractScaleDraw () constβ signature only in the original.QwtAbstractScaleDraw * abstractScaleDraw ()β signature only in the original.void updateScaleDraw ()β signature only in the original.
π Additional Inherited Members π
π Public Slots inherited from QwtAbstractSlider π
void setValue (double value)β signature only in the original.
π₯ Signals inherited from QwtAbstractSlider π₯
void valueChanged (double value)β notify a change of value. πvoid sliderPressed ()β signature only in the original.void sliderReleased ()β signature only in the original.void sliderMoved (double value)β signature only in the original.
π 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().
width > 0β the diameter of the knob is fixed and the knob is aligned according to thealignment()flags inside of thecontentsRect().width <= 0β the knob is extended to the minimum of width/height of thecontentsRect()and aligned in the other direction according toalignment().
Setting a fixed knobWidth() is helpful to align several knobs with different scale labels. π
Definition at line 42 of file qwt_knob.h.
π§ Member Enumeration Documentation π§
πΈ enum QwtKnob::KnobStyle πΈ
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 fromQPalette::Button.Raisedβ build a gradient fromQPalette::MidlightandQPalette::Button.Sunkenβ build a gradient fromQPalette::Midlight,QPalette::ButtonandQPalette::Midlight.Styledβ build a radial gradient fromQPalette::Buttonlike it is used forQDialin various Qt styles.
Definition at line 66 of file qwt_knob.h.
π¦ enum QwtKnob::MarkerStyle π¦
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 inQPalette::ButtonTextcolor.Triangleβ paint a triangle inQPalette::ButtonTextcolor.Dotβ paint a circle inQPalette::ButtonTextcolor.Nubβ draw a raised ellipse with a gradient build fromQPalette::LightandQPalette::Mid.Notchβ draw a sunken ellipse with a gradient build fromQPalette::LightandQPalette::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:
- parent β parent widget.
See also setTotalAngle().
Definition at line 103 of file qwt_knob.cpp.
π QwtKnob::~QwtKnob () [virtual] π
Destructor.
Definition at line 120 of file qwt_knob.cpp.
π MEMBER FUNCTION DOCUMENTATION π
Ok bestie, this is the part where we go function by function, one by one, no skipping, no cap. Every single one, with its exact signature and its exact line number. Buckle up π
Qt::Alignment QwtKnob::alignment () const
Returns the alignment of the knob inside of contentsRect() β¨
See also: setAlignment(), knobWidth(), knobRect()
Defined at line 743 of file qwt_knob.cpp.
int QwtKnob::borderWidth () const
Gives you back the border width. That's it, that's the whole vibe π
Defined at line 799 of file qwt_knob.cpp.
void QwtKnob::changeEvent (QEvent * event) [override], [protected], [virtual]
Handles QEvent::StyleChange and QEvent::FontChange β so when the style or the font switches up, this is the function that's paying attention π
Parameters:
eventβ the change event
Reimplemented from QwtAbstractScale.
Defined at line 431 of file qwt_knob.cpp.
void QwtKnob::drawFocusIndicator (QPainter * painter) const [protected], [virtual]
Draws the focus indicator. You know, the little "hey, I'm the one you're focused on" moment π«Ά
Parameters:
painterβ painter
Defined at line 697 of file qwt_knob.cpp.
void QwtKnob::drawKnob (QPainter * painter, const QRectF & knobRect) const [protected], [virtual]
Draws the knob itself. Main character energy, obviously π
Parameters:
painterβ painterknobRectβ bounding rectangle of the knob (without scale)
Defined at line 489 of file qwt_knob.cpp.
void QwtKnob::drawMarker (QPainter * painter, const QRectF & rect, double angle) const [protected], [virtual]
Draws the marker at the knob's front β the little pointer that says "I'm pointing here" π
Parameters:
painterβ painterrectβ bounding rectangle of the knob without scaleangleβ angle of the marker in degrees (clockwise,0at the 12 o'clock position)
Defined at line 576 of file qwt_knob.cpp.
bool QwtKnob::isScrollPosition (const QPoint & pos) const [override], [protected], [virtual]
Figures out what to do when the user presses a mouse button π±οΈ
Parameters:
posβ mouse position
Return values:
- True, when
posis inside the circle of the knob.
See also: scrolledTo()
Implements QwtAbstractSlider.
Defined at line 347 of file qwt_knob.cpp.
QRect QwtKnob::knobRect () const
Calculates the bounding rectangle of the knob without the scale. Very "just the knob, nothing else" of it π
Returns: bounding rectangle of the knob
See also: knobWidth(), alignment(), QWidget::contentsRect()
Defined at line 292 of file qwt_knob.cpp.
QwtKnob::KnobStyle QwtKnob::knobStyle () const
Returns: marker type of the knob
See also: setKnobStyle(), setBorderWidth()
Defined at line 144 of file qwt_knob.cpp.
int QwtKnob::knobWidth () const
Returns the width of the knob β¨
Defined at line 781 of file qwt_knob.cpp.
int QwtKnob::markerSize () const
Returns: marker size
See also: setMarkerSize()
Defined at line 825 of file qwt_knob.cpp.
QwtKnob::MarkerStyle QwtKnob::markerStyle () const
Returns: marker type of the knob
See also: setMarkerStyle(), setMarkerSize()
Defined at line 168 of file qwt_knob.cpp.
QSize QwtKnob::minimumSizeHint () const [override], [virtual]
Returns: minimum size hint
See also: sizeHint()
Defined at line 843 of file qwt_knob.cpp.
int QwtKnob::numTurns () const
Returns: number of turns.
Careful bestie β when the total angle is below 360Β°, numTurns() is ceiled to 1. So no fractional turns sneaking in π
See also: setNumTurns(), setTotalAngle(), totalAngle()
Defined at line 245 of file qwt_knob.cpp.
void QwtKnob::paintEvent (QPaintEvent * event) [override], [protected], [virtual]
Repaints the knob. Glow-up on demand β¨
Parameters:
eventβ paint event
Defined at line 451 of file qwt_knob.cpp.
QwtRoundScaleDraw * QwtKnob::scaleDraw ()
Returns: the scale draw of the knob
See also: setScaleDraw()
Defined at line 281 of file qwt_knob.cpp.
const QwtRoundScaleDraw * QwtKnob::scaleDraw () const
Returns: the scale draw of the knob
See also: setScaleDraw()
Defined at line 272 of file qwt_knob.cpp.
Two of them! One const, one not. Same energy, different promises π«Ά
double QwtKnob::scrolledTo (const QPoint & pos) const [override], [protected], [virtual]
Works out the value for a new position of the mouse π±οΈπ«
Parameters:
posβ mouse position
Returns: value for the mouse position
See also: isScrollPosition()
Implements QwtAbstractSlider.
Defined at line 373 of file qwt_knob.cpp.
void QwtKnob::setAlignment (Qt::Alignment alignment)
Sets 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:
alignmentβ or'd alignment flags
See also: alignment(), setKnobWidth(), knobRect()
Defined at line 730 of file qwt_knob.cpp.
void QwtKnob::setBorderWidth (int borderWidth)
Sets the knob's border width.
Parameters:
borderWidthβ new border width
Defined at line 790 of file qwt_knob.cpp.
void QwtKnob::setKnobStyle (KnobStyle knobStyle)
Sets the knob type.
Parameters:
knobStyleβ knob type
See also: knobStyle(), setBorderWidth()
Defined at line 131 of file qwt_knob.cpp.
void QwtKnob::setKnobWidth (int width)
Changes the knob's width. Setting a fixed value for the diameter of the knob is genuinely helpful for lining several knobs up in a row β matching set, no chaos π
Parameters:
widthβ new width
See also: knobWidth(), setAlignment()
Note: modifies the sizePolicy(). Yeah. It does a little side quest π
Defined at line 759 of file qwt_knob.cpp.
void QwtKnob::setMarkerSize (int size)
Sets the size of the marker. When you set a size <= 0, the marker will automatically be scaled to 40% of the radius of the knob. Auto-glow-up, we love to see it β¨
See also: markerSize(), markerStyle()
Defined at line 812 of file qwt_knob.cpp.
void QwtKnob::setMarkerStyle (MarkerStyle markerStyle)
Sets the marker type of the knob.
Parameters:
markerStyleβ marker type
See also: markerStyle(), setMarkerSize()
Defined at line 155 of file qwt_knob.cpp.
void QwtKnob::setNumTurns (int numTurns)
Sets 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()
Defined at line 219 of file qwt_knob.cpp.
void QwtKnob::setScaleDraw (QwtRoundScaleDraw * scaleDraw)
Changes the scale draw of the knob.
Heads up bestie: for changing the labels of the scales, it is necessary to derive from QwtRoundScaleDraw and overload QwtRoundScaleDraw::label(). You can't just swap the text out, you gotta go through the subclass π§
See also: scaleDraw()
Defined at line 259 of file qwt_knob.cpp.
void QwtKnob::setTotalAngle (double angle)
Sets the total angle by which the knob can be turned.
Parameters:
angleβ angle 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()
Defined at line 185 of file qwt_knob.cpp.
QSize QwtKnob::sizeHint () const [override], [virtual]
Returns: sizeHint()
Defined at line 833 of file qwt_knob.cpp.
double QwtKnob::totalAngle () const
Returns: the total angle
See also: setTotalAngle(), setNumTurns(), numTurns()
Defined at line 205 of file qwt_knob.cpp.
πΈ AUTHOR πΈ
Generated automatically by Doxygen for Qwt User's Guide from the source code. Not a human, not a bestie, just Doxygen doing its thing π€β¨
And that's a wrap on QwtKnob(3) π This came from the Qwt User's Guide β QwtKnob(3), the one and only. Go forth and turn those knobs, icon ππ¦
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms