8#include <QtCore/qscopedpointer.h>
9#include <QtQuick/private/qquickwindow_p.h>
86 QQuickDeferredPointer<QQuickItem>
handle;
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;
230 if (!
d->handle.isExecuting())
241 if (!
handle->parentItem())
246 if (firstHandle && secondHandle) {
250 const QList<QQuickItem *> childItems =
d->slider->childItems();
251 const int firstIndex = childItems.indexOf(firstHandle);
252 const int secondIndex = childItems.indexOf(secondHandle);
253 if (firstIndex != -1 && secondIndex != -1 && firstIndex > secondIndex) {
254 firstHandle->stackBefore(secondHandle);
258 secondHandle->setZ(secondHandle->z() + 1);
262 handle->setActiveFocusOnTab(
true);
270 if (!
d->handle.isExecuting())
287 d->slider->setAccessibleProperty(
"pressed",
pressed ||
d->slider->second()->isPressed());
304 emit hoveredChanged();
312 return d->handle->implicitWidth();
320 return d->handle->implicitHeight();
347#if QT_CONFIG(quicktemplates2_multitouch)
423#if QT_CONFIG(quicktemplates2_multitouch)
446 const bool firstHit = firstHandle && !
first->isPressed() && firstHandle->
contains(
q->mapToItem(firstHandle, point));
447 const bool secondHit = secondHandle && !
second->
isPressed() && secondHandle->contains(
q->mapToItem(secondHandle, point));
451 if (firstHit && secondHit) {
453 hitNode = firstHandle->z() > secondHandle->z() ?
first :
second;
454 otherNode = firstHandle->z() > secondHandle->z() ?
second :
first;
455 }
else if (firstHit) {
458 }
else if (secondHit) {
470 const bool inverted =
from >
to;
471 if ((!inverted && firstPos < first->
position()) || (inverted && firstPos >
first->position())) {
478 }
else if (firstDistance < secondDistance) {
546 pressedNodePrivate->setPosition(
pos);
547 q->setKeepMouseGrab(
false);
548 q->setKeepTouchGrab(
false);
554 pressedNodePrivate->touchId = -1;
562 first->setPressed(
false);
573 bool firstHandleHovered = firstHandle && firstHandle->
isEnabled()
574 && firstHandle->contains(
q->mapToItem(firstHandle,
pos));
575 bool secondHandleHovered = secondHandle && secondHandle->isEnabled()
576 && secondHandle->contains(
q->mapToItem(secondHandle,
pos));
578 if (firstHandleHovered && secondHandleHovered) {
580 const bool firstHandleHasHigherZ = firstHandle->z() > secondHandle->z();
581 firstHandleHovered = firstHandleHasHigherZ;
582 secondHandleHovered = !firstHandleHasHigherZ;
584 first->setHovered(firstHandleHovered);
592 emit first->implicitHandleWidthChanged();
601 emit first->implicitHandleHeightChanged();
610 first->setHandle(
nullptr);
630#if QT_CONFIG(quicktemplates2_multitouch)
641 d->removeImplicitSizeListener(
d->first->handle());
642 d->removeImplicitSizeListener(
d->second->handle());
668 d->first->setValue(
d->first->value());
669 d->second->setValue(
d->second->value());
672 firstPrivate->updatePosition(
true);
673 secondPrivate->updatePosition();
700 d->first->setValue(
d->first->value());
701 d->second->setValue(
d->second->value());
704 firstPrivate->updatePosition(
true);
705 secondPrivate->updatePosition();
723 return d->touchDragThreshold;
733 emit touchDragThresholdChanged();
953 if (
d->snapMode ==
mode)
974 return d->orientation;
1016 firstValue =
qBound(smaller, firstValue, larger);
1017 secondValue =
qBound(smaller, secondValue, larger);
1019 if (
d->from >
d->to) {
1022 if (secondValue > firstValue)
1023 secondValue = firstValue;
1026 if (firstValue > secondValue)
1027 firstValue = secondValue;
1032 if (firstValue != firstPrivate->value) {
1033 firstPrivate->value = firstValue;
1034 emit d->first->valueChanged();
1038 if (secondValue != secondPrivate->value) {
1039 secondPrivate->value = secondValue;
1040 emit d->second->valueChanged();
1045 firstPrivate->updatePosition(
true);
1046 secondPrivate->updatePosition();
1069 if (
d->live ==
live)
1130 ?
d->first : (
d->second->handle()->hasActiveFocus() ?
d->second :
nullptr);
1134 const qreal oldValue = focusNode->value();
1137 focusNode->setPressed(
true);
1139 focusNode->increase();
1141 focusNode->decrease();
1144 focusNode->setPressed(
true);
1146 focusNode->decrease();
1148 focusNode->increase();
1153 focusNode->setPressed(
true);
1154 focusNode->increase();
1157 focusNode->setPressed(
true);
1158 focusNode->decrease();
1163 emit focusNode->moved();
1170 d->updateHover(
event->position());
1178 d->updateHover(
event->position());
1186 d->first->setHovered(
false);
1187 d->second->setHovered(
false);
1195 d->first->setPressed(
false);
1196 d->second->setPressed(
false);
1203 d->handleMove(
event->position(),
event->timestamp());
1207#if QT_CONFIG(quicktemplates2_multitouch)
1211 switch (
event->type()) {
1214 if (!
d->acceptTouch(point))
1217 switch (point.
state()) {
1251 emit d->first->visualPositionChanged();
1252 emit d->second->visualPositionChanged();
1272 firstPrivate->executeHandle(
true);
1273 secondPrivate->executeHandle(
true);
1277 if (firstPrivate->isPendingValue || secondPrivate->isPendingValue
1282 setValues(firstPrivate->isPendingValue ? firstPrivate->pendingValue : firstPrivate->value,
1283 secondPrivate->isPendingValue ? secondPrivate->pendingValue : secondPrivate->value);
1285 firstPrivate->pendingValue = 0;
1286 firstPrivate->isPendingValue =
false;
1287 secondPrivate->pendingValue = 0;
1288 secondPrivate->isPendingValue =
false;
1294 firstPrivate->updatePosition();
1295 secondPrivate->updatePosition();
1331#if QT_CONFIG(accessibility)
1332QAccessible::Role QQuickRangeSlider::accessibleRole()
const
1334 return QAccessible::Slider;
1340#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.
static constexpr Policy Preferred
static constexpr Policy Fixed
\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)
static void hideOldItem(QQuickItem *item)
virtual void handleUngrab()
virtual bool handleRelease(const QPointF &point, ulong timestamp)
static void warnIfCustomizationNotSupported(QObject *control, QQuickItem *item, const QString &propertyName)
void itemDestroyed(QQuickItem *item) override
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)
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.
void setFocusPolicy(Qt::FocusPolicy policy)
Sets the focus policy of this item to policy.
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
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 itemDestroyed(QQuickItem *item) override
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)
#define QStringLiteral(str)
static QString handleName()
item setCursor(Qt::IBeamCursor)
[1]