8#include <QtCore/qscopedpointer.h>
9#include <QtQuick/private/qquickwindow_p.h>
107 emit q->positionChanged();
108 emit q->visualPositionChanged();
140 return node->d_func();
161 if (!
d->slider->isComponentComplete()) {
163 d->isPendingValue =
true;
168 const qreal smaller =
qMin(
d->slider->to(),
d->slider->from());
169 const qreal larger =
qMax(
d->slider->to(),
d->slider->from());
174 const bool invertedRange =
d->slider->from() >
d->slider->to();
177 if (value < d->slider->second()->value())
178 value =
d->slider->second()->value();
180 if (
value >
d->slider->second()->value())
181 value =
d->slider->second()->value();
185 if (
value >
d->slider->first()->value())
186 value =
d->slider->first()->value();
188 if (value < d->slider->first()->value())
189 value =
d->slider->first()->value();
209 if (
d->slider->orientation() ==
Qt::Vertical ||
d->slider->isMirrored())
210 return 1.0 -
d->position;
228 if (!
d->handle.isExecuting())
239 if (!
handle->parentItem())
244 if (firstHandle && secondHandle) {
249 const int firstIndex = childItems.
indexOf(firstHandle);
250 const int secondIndex = childItems.
indexOf(secondHandle);
251 if (firstIndex != -1 && secondIndex != -1 && firstIndex > secondIndex) {
256 secondHandle->
setZ(secondHandle->
z() + 1);
260 handle->setActiveFocusOnTab(
true);
268 if (!
d->handle.isExecuting())
285 d->slider->setAccessibleProperty(
"pressed",
pressed ||
d->slider->second()->isPressed());
302 emit hoveredChanged();
310 return d->handle->implicitWidth();
318 return d->handle->implicitHeight();
345#if QT_CONFIG(quicktemplates2_multitouch)
420#if QT_CONFIG(quicktemplates2_multitouch)
443 const bool firstHit = firstHandle && !
first->isPressed() && firstHandle->
contains(
q->mapToItem(firstHandle, point));
444 const bool secondHit = secondHandle && !
second->
isPressed() && secondHandle->
contains(
q->mapToItem(secondHandle, point));
448 if (firstHit && secondHit) {
450 hitNode = firstHandle->
z() > secondHandle->
z() ?
first :
second;
451 otherNode = firstHandle->
z() > secondHandle->
z() ?
second :
first;
452 }
else if (firstHit) {
455 }
else if (secondHit) {
467 const bool inverted =
from >
to;
468 if ((!inverted && firstPos < first->
position()) || (inverted && firstPos >
first->position())) {
475 }
else if (firstDistance < secondDistance) {
538 q->setKeepMouseGrab(
false);
539 q->setKeepTouchGrab(
false);
545 pressedNodePrivate->
touchId = -1;
553 first->setPressed(
false);
564 bool firstHandleHovered = firstHandle && firstHandle->
isEnabled()
565 && firstHandle->
contains(
q->mapToItem(firstHandle,
pos));
566 bool secondHandleHovered = secondHandle && secondHandle->
isEnabled()
567 && secondHandle->
contains(
q->mapToItem(secondHandle,
pos));
569 if (firstHandleHovered && secondHandleHovered) {
571 const bool firstHandleHasHigherZ = firstHandle->
z() > secondHandle->
z();
572 firstHandleHovered = firstHandleHasHigherZ;
573 secondHandleHovered = !firstHandleHasHigherZ;
575 first->setHovered(firstHandleHovered);
583 emit first->implicitHandleWidthChanged();
592 emit first->implicitHandleHeightChanged();
606#if QT_CONFIG(quicktemplates2_multitouch)
617 d->removeImplicitSizeListener(
d->first->handle());
618 d->removeImplicitSizeListener(
d->second->handle());
644 d->first->setValue(
d->first->value());
645 d->second->setValue(
d->second->value());
648 firstPrivate->updatePosition(
true);
649 secondPrivate->updatePosition();
676 d->first->setValue(
d->first->value());
677 d->second->setValue(
d->second->value());
680 firstPrivate->updatePosition(
true);
681 secondPrivate->updatePosition();
699 return d->touchDragThreshold;
709 emit touchDragThresholdChanged();
929 if (
d->snapMode ==
mode)
950 return d->orientation;
987 firstValue =
qBound(smaller, firstValue, larger);
988 secondValue =
qBound(smaller, secondValue, larger);
990 if (
d->from >
d->to) {
993 if (secondValue > firstValue)
994 secondValue = firstValue;
997 if (firstValue > secondValue)
998 firstValue = secondValue;
1003 if (firstValue != firstPrivate->
value) {
1004 firstPrivate->
value = firstValue;
1005 emit d->first->valueChanged();
1009 if (secondValue != secondPrivate->
value) {
1010 secondPrivate->
value = secondValue;
1011 emit d->second->valueChanged();
1040 if (
d->live ==
live)
1101 ?
d->first : (
d->second->handle()->hasActiveFocus() ?
d->second :
nullptr);
1141 d->updateHover(
event->position());
1149 d->updateHover(
event->position());
1157 d->first->setHovered(
false);
1158 d->second->setHovered(
false);
1166 d->first->setPressed(
false);
1167 d->second->setPressed(
false);
1174 d->handleMove(
event->position(),
event->timestamp());
1178#if QT_CONFIG(quicktemplates2_multitouch)
1182 switch (
event->type()) {
1185 if (!
d->acceptTouch(point))
1188 switch (point.
state()) {
1222 emit d->first->visualPositionChanged();
1223 emit d->second->visualPositionChanged();
1302#if QT_CONFIG(accessibility)
1303QAccessible::Role QQuickRangeSlider::accessibleRole()
const
1305 return QAccessible::Slider;
1311#include "moc_qquickrangeslider_p.cpp"
The QEventPoint class provides information about a point in a QPointerEvent.
QPointF pressPosition
the position at which this point was pressed.
int id
the ID number of this event point.
State state
the current state of the event point.
QPointF position
the position of this point.
The QFocusEvent class contains event parameters for widget focus events.
The QKeyEvent class describes a key event.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
The QQmlContext class defines a context within a QML engine.
static void setContextForObject(QObject *, QQmlContext *)
Sets the QQmlContext for the object to context.
void itemImplicitWidthChanged(QQuickItem *item) override
virtual bool handlePress(const QPointF &point, ulong timestamp)
void removeImplicitSizeListener(QQuickItem *item, ChangeTypes changes=ImplicitSizeChanges)
void addImplicitSizeListener(QQuickItem *item, ChangeTypes changes=ImplicitSizeChanges)
static void hideOldItem(QQuickItem *item)
virtual void handleUngrab()
virtual bool handleRelease(const QPointF &point, ulong timestamp)
virtual bool handleMove(const QPointF &point, ulong timestamp)
static QQuickControlPrivate * get(QQuickControl *control)
void itemImplicitHeightChanged(QQuickItem *item) override
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void classBegin() override
Invoked after class creation, but before any properties have been set.
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
bool isMirrored() const
\qmlproperty bool QtQuick.Controls::Control::mirrored \readonly
virtual void mirrorChange()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
virtual void hoverEnterEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
void setKeepTouchGrab(bool)
Sets whether the touch points grabbed by this item should remain exclusively with this item.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
virtual void keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key press events for an item.
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
virtual void hoverMoveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
void setAcceptTouchEvents(bool accept)
If enabled is true, this sets the item to accept touch events; otherwise, touch events are not accept...
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
bool keepTouchGrab() const
Returns whether the touch points grabbed by this item should exclusively remain with this item.
qreal width
This property holds the width of this item.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
void setKeepMouseGrab(bool)
Sets whether the mouse input should remain exclusively with this item.
virtual void touchEvent(QTouchEvent *event)
This event handler can be reimplemented in a subclass to receive touch events for an item.
qreal height
This property holds the height of this item.
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key release events for an item.
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void stackBefore(const QQuickItem *)
Moves the specified sibling item to the index before this item within the list of children.
Used to select a range of values by sliding two handles along a track.
void setPosition(qreal position, bool ignoreOtherPosition=false)
void executeHandle(bool complete=false)
QQuickRangeSlider * slider
QQuickDeferredPointer< QQuickItem > handle
static QQuickRangeSliderNodePrivate * get(QQuickRangeSliderNode *node)
QQuickRangeSliderNodePrivate(qreal value, QQuickRangeSlider *slider)
void updatePosition(bool ignoreOtherPosition=false)
void setValue(qreal value)
QQuickRangeSliderNode(qreal value, QQuickRangeSlider *slider)
void implicitHandleHeightChanged()
qreal implicitHandleHeight
void setHandle(QQuickItem *handle)
qreal implicitHandleWidth
void setPressed(bool pressed)
void implicitHandleWidthChanged()
void setHovered(bool hovered)
QQuickRangeSlider::SnapMode snapMode
QQuickRangeSliderNode * second
bool handleMove(const QPointF &point, ulong timestamp) override
QQuickRangeSliderNode * first
Qt::Orientation orientation
void handleUngrab() override
bool handleRelease(const QPointF &point, ulong timestamp) override
QQuickRangeSliderNode * pressedNode(int touchId=-1) const
void itemImplicitHeightChanged(QQuickItem *item) override
bool handlePress(const QPointF &point, ulong timestamp) override
void updateHover(const QPointF &pos)
void itemImplicitWidthChanged(QQuickItem *item) override
void classBegin() override
Invoked after class creation, but before any properties have been set.
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
void hoverEnterEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
void keyReleaseEvent(QKeyEvent *event) override
This event handler can be reimplemented in a subclass to receive key release events for an item.
void mirrorChange() override
void hoverMoveEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
void setStepSize(qreal step)
Q_INVOKABLE void setValues(qreal firstValue, qreal secondValue)
\qmlmethod void QtQuick.Controls::RangeSlider::setValues(real firstValue, real secondValue)
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QQuickRangeSliderNode * second
QQuickRangeSlider(QQuickItem *parent=nullptr)
void setSnapMode(SnapMode mode)
Qt::Orientation orientation
void setTouchDragThreshold(qreal touchDragThreshold)
void resetTouchDragThreshold()
friend class QQuickRangeSliderNode
void setOrientation(Qt::Orientation orientation)
bool isHorizontal() const
QQuickRangeSliderNode * first
void keyPressEvent(QKeyEvent *event) override
This event handler can be reimplemented in a subclass to receive key press events for an item.
void hoverLeaveEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void orientationChanged()
static bool dragOverThreshold(qreal d, Qt::Axis axis, const QEventPoint *tp, int startDragThreshold=-1)
The QTouchEvent class contains parameters that describe a touch event.
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
n void setPosition(void) \n\
GLuint64 GLenum void * handle
GLenum GLuint GLintptr offset
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble GLdouble GLdouble q
QQmlContext * qmlContext(const QObject *obj)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
void quickCancelDeferred(QObject *object, const QString &property)
void quickCompleteDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
void quickBeginDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
static const qreal defaultTo
static const qreal defaultFrom
static qreal valueAt(const QQuickRangeSlider *slider, qreal position)
static qreal positionAt(const QQuickRangeSlider *slider, QQuickItem *handle, const QPointF &point)
static qreal snapPosition(const QQuickRangeSlider *slider, qreal position)
static QString handleName()
item setCursor(Qt::IBeamCursor)
[1]
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent