17#include <private/qabstractslider_p.h>
18#include <private/qmath_p.h>
19#if QT_CONFIG(accessibility)
28 Q_DECLARE_PUBLIC(
QDial)
46 virtual int bound(
int val)
const override;
88 option->sliderPosition =
d->position;
90 option->singleStep =
d->singleStep;
92 option->upsideDown = !
d->invertedAppearance;
93 option->notchTarget =
d->target;
94 option->dialWrapping =
d->wrapping;
97 if (!
d->showNotches) {
109 double yy =
q->height()/2.0 -
p.y();
110 double xx =
p.x() -
q->width()/2.0;
111 double a = (xx || yy) ? std::atan2(yy, xx) : 0;
128 v = (int)(0.5 + minv +
r * (
Q_PI * 3 / 2 -
a) / (2 *
Q_PI));
130 v = (int)(0.5 + minv +
r* (
Q_PI * 4 / 3 -
a) / (
Q_PI * 10 / 6));
230 QStyleOptionSlider
option;
242 if (
d->maximum ==
d->minimum ||
290 d->doNotEmit =
false;
352 int l =
qRound(
r * (
d->wrapping ? 6.0 : 5.0) *
Q_PI / 6.0);
354 if (
d->maximum >
d->minimum +
d->pageStep)
355 l =
qRound(l *
d->pageStep /
double(
d->maximum -
d->minimum));
357 l =
qMax(l *
d->singleStep / (
d->pageStep ?
d->pageStep : 1), 1);
361 return d->singleStep * l;
409 return d->showNotches;
418 return QSize(50, 50);
427 return QSize(100, 100);
440#include "moc_qdial.cpp"
virtual int bound(int val) const
The QAbstractSlider class provides an integer value within a range.
virtual void sliderChange(SliderChange change)
Reimplement this virtual function to track slider changes such as \l SliderRangeChange,...
bool event(QEvent *e) override
\reimp
void setSliderPosition(int)
SliderChange
\value SliderRangeChange \value SliderOrientationChange \value SliderStepsChange \value SliderValueCh...
virtual int bound(int val) const override
double angle(const QPoint &, const QPoint &) const
int valueFromPoint(const QPoint &) const
The QDial class provides a rounded range control (like a speedometer or potentiometer).
void mousePressEvent(QMouseEvent *me) override
\reimp
void setNotchesVisible(bool visible)
bool notchesVisible
whether the notches are shown
bool wrapping
whether wrapping is enabled
QDial(QWidget *parent=nullptr)
Constructs a dial.
bool event(QEvent *e) override
\reimp
void mouseMoveEvent(QMouseEvent *me) override
\reimp
void sliderChange(SliderChange change) override
\reimp
void setNotchTarget(double target)
void setWrapping(bool on)
void resizeEvent(QResizeEvent *re) override
\reimp
void paintEvent(QPaintEvent *pe) override
\reimp
int notchSize
the current notch size
~QDial()
Destroys the dial.
void mouseReleaseEvent(QMouseEvent *me) override
\reimp
QSize minimumSizeHint() const override
\reimp
virtual void initStyleOption(QStyleOptionSlider *option) const
Initialize option with the values from this QDial.
QSize sizeHint() const override
\reimp
qreal notchTarget
the target number of pixels between notches
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
The QPaintEvent class contains event parameters for paint events.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
The QResizeEvent class contains event parameters for resize events.
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
Qt::MouseButton button() const
Returns the button that caused the event.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
Combined button and popup list for selecting options.
int qRound(qfloat16 d) noexcept
static QT_BEGIN_NAMESPACE const qreal Q_PI
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLdouble GLdouble GLdouble GLdouble q
std::uniform_real_distribution dist(1, 2.5)
[2]