6.0.0-rc4Source

QDial Class

The QDial class provides a round knob that picks a value from a range. More…

Header#include <QDial>
CMaketarget_link_libraries(app PRIVATE Nt::Widgets)
ModuleNt Widgets C++ Classes
InheritsQAbstractSlider

List of all members, including inherited members

Public Functions

QDial(QWidget *parent = nullptr)
~QDial()
boolwrapping() const
boolnotchesVisible() const

Reimplemented Public Functions

Public Slots

voidsetWrapping(bool on)
voidsetNotchesVisible(bool visible)

Reimplemented Protected Functions

Detailed Description

The user turns the knob by dragging its handle round, or turns the mouse wheel over it, or uses the keys when it has the focus. Connect to valueChanged():

QDial *volume = new QDial(window);
volume->setRange(0, 100);
volume->setNotchesVisible(true);
connect(volume, &QDial::valueChanged, [](int value) { qDebug() << value; });

A dial that does not wrap turns from the bottom left, over the top, to the bottom right. With setWrapping(), it turns the full circle with its smallest value at the bottom, and the keys and the wheel take the value round from the largest to the smallest.

Dials with the handle at the start, the middle and the end, one with notches, one that wraps, and a disabled one.

QDial in the light color scheme

See also QSlider and QScrollBar.

Differences from Qt

There is no notchSize(), notchTarget() or setNotchTarget(): the notches are at ten places for a dial that does not wrap and twelve for one that does. The dial is drawn without antialiasing. There is no invertedAppearance. A dial that wraps keeps setValue() in the range rather than taking a value past the end round to the start.

Member Function Documentation

[explicit] QDial::QDial(QWidget *parent = nullptr)

Constructs a dial with the given parent. It goes from 0 to 99.

[override] QDial::~QDial()

Destroys the dial.

[override] QSize QDial::minimumSizeHint() const

Reimplements QAbstractSlider::minimumSizeHint().

[override, protected] void QDial::mouseMoveEvent(QMouseEvent *event)

Reimplements QAbstractSlider::mouseMoveEvent().

[override, protected] void QDial::mousePressEvent(QMouseEvent *event)

Reimplements QAbstractSlider::mousePressEvent().

[override, protected] void QDial::mouseReleaseEvent(QMouseEvent *event)

Reimplements QAbstractSlider::mouseReleaseEvent().

bool QDial::notchesVisible() const

Returns whether marks are drawn around the dial. The default is false.

See also setNotchesVisible().

[override, protected] void QDial::paintEvent(QPaintEvent *event)

Reimplements QAbstractSlider::paintEvent().

[slot] void QDial::setNotchesVisible(bool visible)

Sets whether marks are drawn around the dial to visible.

See also notchesVisible().

[slot] void QDial::setWrapping(bool on)

Sets whether the dial turns the full circle to on.

See also wrapping().

[override] QSize QDial::sizeHint() const

Reimplements QAbstractSlider::sizeHint().

bool QDial::wrapping() const

Returns whether the dial turns the full circle. The default is false.

See also setWrapping().