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 () β€” calling update().
  • 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 the alignment() flags inside of the contentsRect().
  • width <= 0 β€” the knob is extended to the minimum of width/height of the contentsRect() and aligned in the other direction according to alignment().

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 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.

πŸ¦‹ 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 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:

  • 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 β€” painter
  • knobRect β€” 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 β€” painter
  • rect β€” bounding rectangle of the knob without scale
  • angle β€” angle of the marker in degrees (clockwise, 0 at 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 pos is 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