NDEVR
API Documentation
QCustomDial

Provides a rounded range control (like a speedometer or potentiometer). More...

Public Member Functions

 QCustomDial (QWidget *parent=nullptr)
 Constructs a QCustomDial with the given parent widget.
 ~QCustomDial ()
 Destroys the dial and its resources.
void addIcon (const DialIcon &icon)
 Adds a fully configured DialIcon to the dial.
void addIcon (const String &icon, bool show_full_icon, bool rotate_icon)
 Adds an icon to the dial by resource name.
QCustomLineEditcenterLineEdit ()
 Returns the center line edit widget, creating one if it does not exist.
void clearIcons ()
 Removes all icons from the dial.
void edited ()
 Emitted when the user interactively edits the dial value.
bool event (QEvent *event) override
 Handles generic events such as tooltip and theme updates.
fltp08 getValue ()
 Returns the current dial value as a floating-point number.
int heightForWidth (int w) const override
 Returns the height for a given width, maintaining a square aspect ratio.
const Buffer< DialIcon > & icons () const
 Returns the list of icons currently displayed on the dial.
void keyPressEvent (QKeyEvent *event) override
 Handles key press events for keyboard-based dial control.
QSize minimumSizeHint () const override
 Returns the minimum size hint for layout purposes.
void mouseMoveEvent (QMouseEvent *event) override
 Handles mouse movement for interactive dial rotation.
void mousePressEvent (QMouseEvent *event) override
 Handles mouse press to begin interactive dial rotation.
void mouseReleaseEvent (QMouseEvent *event) override
 Handles mouse release to finalize dial value changes.
void paintEvent (QPaintEvent *event) override
 Paints the dial including any overlay icons.
void resizeEvent (QResizeEvent *event) override
 Handles resize events and updates icon caches accordingly.
void setColor (const RGBColor &color)
 Sets the color of the dial track and grip indicator.
void setGrip (fltp04 grip_size)
 Sets the size of the grip indicator on the dial.
void setIcon (const QPixmap &map, bool show_full_icon, bool rotate_icon)
 Sets the dial icon from a pixmap with display options.
void setIcons (const Buffer< DialIcon > &icons)
 Replaces all icons with the given buffer.
void setMaxValue (fltp08 max)
 Sets the maximum value of the dial range.
void setMinValue (fltp08 min)
 Sets the minimum value of the dial range.
void setValue (fltp08 value)
 Sets the dial to the given floating-point value.
void showLineEdit (bool show)
 Shows or hides the center line edit overlay.
QSize sizeHint () const override
 Returns the recommended size for the dial.
void tieToLineEdit (QCustomLineEdit *edit, bool is_offset=false)
 Ties a QCustomLineEdit to this dial so they stay synchronized.
void wheelEvent (QWheelEvent *e) override
 Handles mouse wheel events for scrolling the dial value.

Protected Member Functions

void onValueChanged ()
 Slot invoked when the underlying QDial value changes.

Detailed Description

Provides a rounded range control (like a speedometer or potentiometer).


QCustomDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (for example, with angles measured from 0 to 359 degrees) or the dialog layout needs a square widget.

Contains logic for adding one or more images to the dial that may or may not rotate with the dial.

Definition at line 75 of file QCustomDial.h.

Constructor & Destructor Documentation

◆ QCustomDial()

QCustomDial::QCustomDial ( QWidget * parent = nullptr)

Constructs a QCustomDial with the given parent widget.

Parameters
[in]parentThe parent widget.

Member Function Documentation

◆ addIcon() [1/2]

void QCustomDial::addIcon ( const DialIcon & icon)

Adds a fully configured DialIcon to the dial.

Parameters
[in]iconThe DialIcon to add.

◆ addIcon() [2/2]

void QCustomDial::addIcon ( const String & icon,
bool show_full_icon,
bool rotate_icon )

Adds an icon to the dial by resource name.

Parameters
[in]iconThe resource name of the icon.
[in]show_full_iconWhether the icon should fill the entire dial.
[in]rotate_iconWhether the icon should rotate with the dial.

◆ centerLineEdit()

QCustomLineEdit * QCustomDial::centerLineEdit ( )

Returns the center line edit widget, creating one if it does not exist.

Returns
A pointer to the center QCustomLineEdit.

◆ event()

bool QCustomDial::event ( QEvent * event)
override

Handles generic events such as tooltip and theme updates.

Parameters
[in]eventThe event to process.
Returns
True if the event was handled, false otherwise.

References event().

Referenced by event(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), paintEvent(), and resizeEvent().

◆ getValue()

fltp08 QCustomDial::getValue ( )

Returns the current dial value as a floating-point number.

Returns
The current value.

◆ heightForWidth()

int QCustomDial::heightForWidth ( int w) const
inlineoverride

Returns the height for a given width, maintaining a square aspect ratio.

Parameters
[in]wThe width.
Returns
The same value as the width.

Definition at line 100 of file QCustomDial.h.

◆ icons()

const Buffer< DialIcon > & QCustomDial::icons ( ) const
inline

Returns the list of icons currently displayed on the dial.

Returns
A const reference to the buffer of DialIcon objects.

Definition at line 154 of file QCustomDial.h.

Referenced by setIcons().

◆ keyPressEvent()

void QCustomDial::keyPressEvent ( QKeyEvent * event)
override

Handles key press events for keyboard-based dial control.

Parameters
[in]eventThe key event.

References event().

◆ minimumSizeHint()

QSize QCustomDial::minimumSizeHint ( ) const
override

Returns the minimum size hint for layout purposes.

Returns
The minimum size hint.

◆ mouseMoveEvent()

void QCustomDial::mouseMoveEvent ( QMouseEvent * event)
override

Handles mouse movement for interactive dial rotation.

Parameters
[in]eventThe mouse event.

References event().

◆ mousePressEvent()

void QCustomDial::mousePressEvent ( QMouseEvent * event)
override

Handles mouse press to begin interactive dial rotation.

Parameters
[in]eventThe mouse event.

References event().

◆ mouseReleaseEvent()

void QCustomDial::mouseReleaseEvent ( QMouseEvent * event)
override

Handles mouse release to finalize dial value changes.

Parameters
[in]eventThe mouse event.

References event().

◆ paintEvent()

void QCustomDial::paintEvent ( QPaintEvent * event)
override

Paints the dial including any overlay icons.

Parameters
[in]eventThe paint event.

References event().

◆ resizeEvent()

void QCustomDial::resizeEvent ( QResizeEvent * event)
override

Handles resize events and updates icon caches accordingly.

Parameters
[in]eventThe resize event.

References event().

◆ setColor()

void QCustomDial::setColor ( const RGBColor & color)

Sets the color of the dial track and grip indicator.

Parameters
[in]colorThe color to apply.

◆ setGrip()

void QCustomDial::setGrip ( fltp04 grip_size)
inline

Sets the size of the grip indicator on the dial.

Parameters
[in]grip_sizeThe grip size as a fraction of the dial radius.

Definition at line 189 of file QCustomDial.h.

◆ setIcon()

void QCustomDial::setIcon ( const QPixmap & map,
bool show_full_icon,
bool rotate_icon )

Sets the dial icon from a pixmap with display options.

Parameters
[in]mapThe pixmap to use as the icon.
[in]show_full_iconWhether the icon should fill the entire dial.
[in]rotate_iconWhether the icon should rotate with the dial.

◆ setIcons()

void QCustomDial::setIcons ( const Buffer< DialIcon > & icons)

Replaces all icons with the given buffer.

Parameters
[in]iconsThe new set of icons to display.

References icons().

◆ setMaxValue()

void QCustomDial::setMaxValue ( fltp08 max)

Sets the maximum value of the dial range.

Parameters
[in]maxThe maximum value.

◆ setMinValue()

void QCustomDial::setMinValue ( fltp08 min)

Sets the minimum value of the dial range.

Parameters
[in]minThe minimum value.

◆ setValue()

void QCustomDial::setValue ( fltp08 value)

Sets the dial to the given floating-point value.

Parameters
[in]valueThe value to set.

◆ showLineEdit()

void QCustomDial::showLineEdit ( bool show)

Shows or hides the center line edit overlay.

Parameters
[in]showWhether to show the line edit.

◆ sizeHint()

QSize QCustomDial::sizeHint ( ) const
override

Returns the recommended size for the dial.

Returns
The size hint.

◆ tieToLineEdit()

void QCustomDial::tieToLineEdit ( QCustomLineEdit * edit,
bool is_offset = false )

Ties a QCustomLineEdit to this dial so they stay synchronized.

Parameters
[in]editThe line edit to synchronize with.
[in]is_offsetWhether the line edit value represents an offset from the dial value.

◆ wheelEvent()

void QCustomDial::wheelEvent ( QWheelEvent * e)
override

Handles mouse wheel events for scrolling the dial value.

Parameters
[in]eThe wheel event.

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