5#if QT_CONFIG(accessibility)
14#include "private/qapplication_p.h"
15#include "private/qabstractslider_p.h"
58 QStyleOptionSlider
opt;
61 q->initStyleOption(&
opt);
68 QStyleOptionSlider
opt;
69 q->initStyleOption(&
opt);
72 int sliderMin, sliderMax, sliderLength;
75 sliderLength = sr.
width();
77 sliderMax = gr.
right() - sliderLength + 1;
79 sliderLength = sr.
height();
81 sliderMax = gr.
bottom() - sliderLength + 1;
84 sliderMax - sliderMin,
opt.upsideDown);
108 option->orientation =
d->orientation;
112 option->tickInterval =
d->tickInterval;
115 : (!
d->invertedAppearance);
117 option->sliderPosition =
d->position;
118 option->sliderValue =
d->value;
119 option->singleStep =
d->singleStep;
120 option->pageStep =
d->pageStep;
124 if (
d->pressedControl) {
125 option->activeSubControls =
d->pressedControl;
128 option->activeSubControls =
d->hoverControl;
139 q->update(lastHoverRect);
149 QStyleOptionSlider
opt;
150 q->initStyleOption(&
opt);
286 QStyleOptionSlider
opt;
304 switch(
event->type()) {
309 d->updateHoverControl(he->position().toPoint());
313 d->resetLayoutItemMargins();
331#ifdef QT_KEYPAD_NAVIGATION
332 if (QApplicationPrivate::keypadNavigationEnabled())
337 QStyleOptionSlider
opt;
349 QStyleOptionSlider
opt;
357 d->pressValue = pressValue;
358 if (pressValue >
d->value)
360 else if (pressValue < d->
value)
373 QStyleOptionSlider
opt;
394 int newPosition =
d->pixelPosToRangeValue(
d->pick(ev->
position().
toPoint()) -
d->clickOffset);
415 QStyleOptionSlider
opt;
417 opt.subControls = oldPressed;
428 const int SliderLength = 84, TickSpace = 5;
429 QStyleOptionSlider
opt;
436 int w = thick,
h = SliderLength;
451 QStyleOptionSlider
opt;
476 d->resetLayoutItemMargins();
483 return d_func()->tickPosition;
500 d_func()->tickInterval =
qMax(0, ts);
506 return d_func()->tickInterval;
511 QStyleOptionSlider sliderOption;
518#include "moc_qslider.cpp"
Qt::Orientation orientation
The QAbstractSlider class provides an integer value within a range.
void setRepeatAction(SliderAction action, int thresholdTime=500, int repeatTime=50)
Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of...
SliderAction
\value SliderNoAction \value SliderSingleStepAdd \value SliderSingleStepSub \value SliderPageStepAdd ...
Qt::Orientation orientation
the orientation of the slider
bool event(QEvent *e) override
\reimp
void setSliderPosition(int)
void triggerAction(SliderAction action)
Triggers a slider action.
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
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
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 QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
QStyle::SubControl hoverControl
QSlider::TickPosition tickPosition
int pixelPosToRangeValue(int pos) const
QStyle::SubControl newHoverControl(const QPoint &pos)
int pick(const QPoint &pt) const
void resetLayoutItemMargins()
bool updateHoverControl(const QPoint &pos)
QStyle::SubControl pressedControl
The QSlider widget provides a vertical or horizontal slider.
TickPosition
This enum specifies where the tick marks are to be drawn relative to the slider's groove and the hand...
void setTickInterval(int ti)
~QSlider()
Destroys this slider.
void mouseReleaseEvent(QMouseEvent *ev) override
\reimp
void mousePressEvent(QMouseEvent *ev) override
\reimp
bool event(QEvent *event) override
\reimp
QSize minimumSizeHint() const override
\reimp
void setTickPosition(TickPosition position)
virtual void initStyleOption(QStyleOptionSlider *option) const
Initialize option with the values from this QSlider.
void paintEvent(QPaintEvent *ev) override
\reimp
QSlider(QWidget *parent=nullptr)
Constructs a vertical slider with the given parent.
TickPosition tickPosition
the tickmark position for this slider
void mouseMoveEvent(QMouseEvent *ev) override
\reimp
QSize sizeHint() const override
\reimp
int tickInterval
the interval between tickmarks
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=nullptr) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
@ SH_Slider_PageSetButtons
@ SH_Slider_AbsoluteSetButtons
virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget=nullptr) const =0
Returns the sub control at the given position in the given complex control (with the style options sp...
static int sliderValueFromPosition(int min, int max, int pos, int space, bool upsideDown=false)
Converts the given pixel position to a logical value.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
SubControl
This enum describes the available sub controls.
Combined button and popup list for selecting options.
@ WA_WState_OwnSizePolicy
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMax(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLenum GLsizei length
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent