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;
86 option->sliderPosition =
d->position;
88 option->singleStep =
d->singleStep;
90 option->upsideDown = !
d->invertedAppearance;
91 option->notchTarget =
d->target;
92 option->dialWrapping =
d->wrapping;
95 if (!
d->showNotches) {
107 double yy =
q->height()/2.0 -
p.y();
108 double xx =
p.x() -
q->width()/2.0;
109 double a = (xx || yy) ? std::atan2(yy, xx) : 0;
126 v = (int)(0.5 + minv +
r * (
Q_PI * 3 / 2 -
a) / (2 *
Q_PI));
128 v = (int)(0.5 + minv +
r* (
Q_PI * 4 / 3 -
a) / (
Q_PI * 10 / 6));
228 QStyleOptionSlider
option;
240 if (
d->maximum ==
d->minimum ||
242 (
e->buttons() ^
e->button())) {
263 if (
e->buttons() & (~
e->button()) ||
269 setValue(
d->valueFromPoint(
e->position().toPoint()));
288 d->doNotEmit =
false;
350 int l =
qRound(
r * (
d->wrapping ? 6.0 : 5.0) *
Q_PI / 6.0);
352 if (
d->maximum >
d->minimum +
d->pageStep)
353 l =
qRound(l *
d->pageStep /
double(
d->maximum -
d->minimum));
355 l =
qMax(l *
d->singleStep / (
d->pageStep ?
d->pageStep : 1), 1);
359 return d->singleStep * l;
407 return d->showNotches;
416 return QSize(50, 50);
425 return QSize(100, 100);
438#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
The QPaintEvent class contains event parameters for paint events.
\inmodule QtCore\reentrant
The QResizeEvent class contains event parameters for resize events.
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]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent