Controls: ignore mouse events unless handling is implemented
In Qt, input events are accepted by default, and item event handlers
ignore the event. Overrides of the event handlers don't have to do
anything explicit to mark events as handled, but can explicitly ignore
events (i.e. such events that hit transparent areas or are from devices
or buttons the item doesn't care about).
Controls, as of d88d9d6342
, always
accepted events, even if they didn't do anything with it. This is
fundamentally breaking event delivery semantics, preventing control
implementations from selectively accepting or ignoring events depending
on event attributes.
Revert that behavior, and ignore events unless the handler override
returns true. Change all existing handlers to return true so that we
don't break existing controls. Controls that don't override handlers
will ignore the event, which will then propagate as per Qt's event
handling semantics.
The odd control out is Pane, which doesn't do anything with events, but
nevertheless returns true to stop propagation to controls covered by it.
In QWidget world we have special attributes for this kind of UI element,
WA_NoMousePropagation and WA_TransparentForMouseEvents. We might need
something similar in Quick to fix the bug that Drawer eats events in the
(invisible) drag margin, preventing controls underneath to receive them
with priority.
Task-number: QTBUG-59141
Change-Id: Ic1a347ce293c8e11dab958c076ee488834060839
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
5065eb3de4
commit
cd08e08ca0
|
@ -138,7 +138,7 @@ void QQuickAbstractButtonPrivate::setMovePoint(const QPointF &point)
|
||||||
emit q->pressYChanged();
|
emit q->pressYChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickAbstractButtonPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickAbstractButtonPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickAbstractButton);
|
Q_Q(QQuickAbstractButton);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
|
@ -153,9 +153,10 @@ void QQuickAbstractButtonPrivate::handlePress(const QPointF &point, ulong timest
|
||||||
startPressAndHold();
|
startPressAndHold();
|
||||||
else
|
else
|
||||||
stopPressAndHold();
|
stopPressAndHold();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickAbstractButtonPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickAbstractButtonPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickAbstractButton);
|
Q_Q(QQuickAbstractButton);
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
|
@ -166,9 +167,10 @@ void QQuickAbstractButtonPrivate::handleMove(const QPointF &point, ulong timesta
|
||||||
stopPressRepeat();
|
stopPressRepeat();
|
||||||
else if (holdTimer > 0 && (!pressed || QLineF(pressPoint, point).length() > QGuiApplication::styleHints()->startDragDistance()))
|
else if (holdTimer > 0 && (!pressed || QLineF(pressPoint, point).length() > QGuiApplication::styleHints()->startDragDistance()))
|
||||||
stopPressAndHold();
|
stopPressAndHold();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickAbstractButtonPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickAbstractButtonPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickAbstractButton);
|
Q_Q(QQuickAbstractButton);
|
||||||
// Store this here since the base class' handleRelease clears it.
|
// Store this here since the base class' handleRelease clears it.
|
||||||
|
@ -216,6 +218,7 @@ void QQuickAbstractButtonPrivate::handleRelease(const QPointF &point, ulong time
|
||||||
}
|
}
|
||||||
|
|
||||||
wasDoubleClick = false;
|
wasDoubleClick = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickAbstractButtonPrivate::handleUngrab()
|
void QQuickAbstractButtonPrivate::handleUngrab()
|
||||||
|
|
|
@ -75,9 +75,9 @@ public:
|
||||||
void setPressPoint(const QPointF &point);
|
void setPressPoint(const QPointF &point);
|
||||||
void setMovePoint(const QPointF &point);
|
void setMovePoint(const QPointF &point);
|
||||||
|
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
virtual bool acceptKeyClick(Qt::Key key) const;
|
virtual bool acceptKeyClick(Qt::Key key) const;
|
||||||
|
|
|
@ -273,9 +273,9 @@ public:
|
||||||
|
|
||||||
void createDelegateModel();
|
void createDelegateModel();
|
||||||
|
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
void cancelIndicator();
|
void cancelIndicator();
|
||||||
|
@ -753,21 +753,23 @@ void QQuickComboBoxPrivate::createDelegateModel()
|
||||||
delete oldModel;
|
delete oldModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickComboBoxPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickComboBoxPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickComboBox);
|
Q_Q(QQuickComboBox);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
q->setPressed(true);
|
q->setPressed(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickComboBoxPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickComboBoxPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickComboBox);
|
Q_Q(QQuickComboBox);
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
q->setPressed(q->contains(point));
|
q->setPressed(q->contains(point));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickComboBoxPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickComboBoxPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickComboBox);
|
Q_Q(QQuickComboBox);
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
|
@ -775,6 +777,7 @@ void QQuickComboBoxPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
q->setPressed(false);
|
q->setPressed(false);
|
||||||
togglePopup(false);
|
togglePopup(false);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickComboBoxPrivate::handleUngrab()
|
void QQuickComboBoxPrivate::handleUngrab()
|
||||||
|
|
|
@ -194,14 +194,17 @@ static void setActiveFocus(QQuickControl *control, Qt::FocusReason reason)
|
||||||
control->forceActiveFocus(reason);
|
control->forceActiveFocus(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickControlPrivate::handlePress(const QPointF &, ulong)
|
bool QQuickControlPrivate::handlePress(const QPointF &, ulong)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickControl);
|
Q_Q(QQuickControl);
|
||||||
if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && !QGuiApplication::styleHints()->setFocusOnTouchRelease())
|
if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && !QGuiApplication::styleHints()->setFocusOnTouchRelease()) {
|
||||||
setActiveFocus(q, Qt::MouseFocusReason);
|
setActiveFocus(q, Qt::MouseFocusReason);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickControlPrivate::handleMove(const QPointF &point, ulong)
|
bool QQuickControlPrivate::handleMove(const QPointF &point, ulong)
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(quicktemplates2_hover)
|
#if QT_CONFIG(quicktemplates2_hover)
|
||||||
Q_Q(QQuickControl);
|
Q_Q(QQuickControl);
|
||||||
|
@ -209,14 +212,19 @@ void QQuickControlPrivate::handleMove(const QPointF &point, ulong)
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(point);
|
Q_UNUSED(point);
|
||||||
#endif
|
#endif
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickControlPrivate::handleRelease(const QPointF &, ulong)
|
bool QQuickControlPrivate::handleRelease(const QPointF &, ulong)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickControl);
|
Q_Q(QQuickControl);
|
||||||
if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && QGuiApplication::styleHints()->setFocusOnTouchRelease())
|
bool accepted = true;
|
||||||
|
if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && QGuiApplication::styleHints()->setFocusOnTouchRelease()) {
|
||||||
setActiveFocus(q, Qt::MouseFocusReason);
|
setActiveFocus(q, Qt::MouseFocusReason);
|
||||||
|
accepted = true;
|
||||||
|
}
|
||||||
touchId = -1;
|
touchId = -1;
|
||||||
|
return accepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickControlPrivate::handleUngrab()
|
void QQuickControlPrivate::handleUngrab()
|
||||||
|
@ -1969,22 +1977,19 @@ void QQuickControl::hoverLeaveEvent(QHoverEvent *event)
|
||||||
void QQuickControl::mousePressEvent(QMouseEvent *event)
|
void QQuickControl::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
Q_D(QQuickControl);
|
Q_D(QQuickControl);
|
||||||
d->handlePress(event->position(), event->timestamp());
|
event->setAccepted(d->handlePress(event->position(), event->timestamp()));
|
||||||
event->accept();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickControl::mouseMoveEvent(QMouseEvent *event)
|
void QQuickControl::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
Q_D(QQuickControl);
|
Q_D(QQuickControl);
|
||||||
d->handleMove(event->position(), event->timestamp());
|
event->setAccepted(d->handleMove(event->position(), event->timestamp()));
|
||||||
event->accept();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickControl::mouseReleaseEvent(QMouseEvent *event)
|
void QQuickControl::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
Q_D(QQuickControl);
|
Q_D(QQuickControl);
|
||||||
d->handleRelease(event->position(), event->timestamp());
|
event->setAccepted(d->handleRelease(event->position(), event->timestamp()));
|
||||||
event->accept();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickControl::mouseUngrabEvent()
|
void QQuickControl::mouseUngrabEvent()
|
||||||
|
|
|
@ -92,9 +92,9 @@ public:
|
||||||
#if QT_CONFIG(quicktemplates2_multitouch)
|
#if QT_CONFIG(quicktemplates2_multitouch)
|
||||||
virtual bool acceptTouch(const QTouchEvent::TouchPoint &point);
|
virtual bool acceptTouch(const QTouchEvent::TouchPoint &point);
|
||||||
#endif
|
#endif
|
||||||
virtual void handlePress(const QPointF &point, ulong timestamp);
|
virtual bool handlePress(const QPointF &point, ulong timestamp);
|
||||||
virtual void handleMove(const QPointF &point, ulong timestamp);
|
virtual bool handleMove(const QPointF &point, ulong timestamp);
|
||||||
virtual void handleRelease(const QPointF &point, ulong timestamp);
|
virtual bool handleRelease(const QPointF &point, ulong timestamp);
|
||||||
virtual void handleUngrab();
|
virtual void handleUngrab();
|
||||||
|
|
||||||
void mirrorChange() override;
|
void mirrorChange() override;
|
||||||
|
|
|
@ -113,9 +113,9 @@ public:
|
||||||
bool isLargeChange(const QPointF &eventPos, qreal proposedPosition) const;
|
bool isLargeChange(const QPointF &eventPos, qreal proposedPosition) const;
|
||||||
bool isHorizontalOrVertical() const;
|
bool isHorizontalOrVertical() const;
|
||||||
|
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
void cancelHandle();
|
void cancelHandle();
|
||||||
|
@ -244,16 +244,17 @@ bool QQuickDialPrivate::isHorizontalOrVertical() const
|
||||||
return inputMode == QQuickDial::Horizontal || inputMode == QQuickDial::Vertical;
|
return inputMode == QQuickDial::Horizontal || inputMode == QQuickDial::Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickDialPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickDialPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickDial);
|
Q_Q(QQuickDial);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
pressPoint = point;
|
pressPoint = point;
|
||||||
positionBeforePress = position;
|
positionBeforePress = position;
|
||||||
q->setPressed(true);
|
q->setPressed(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickDialPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickDialPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickDial);
|
Q_Q(QQuickDial);
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
|
@ -270,9 +271,10 @@ void QQuickDialPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
if (!qFuzzyCompare(pos, oldPos))
|
if (!qFuzzyCompare(pos, oldPos))
|
||||||
emit q->moved();
|
emit q->moved();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickDialPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickDialPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickDial);
|
Q_Q(QQuickDial);
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
|
@ -294,6 +296,7 @@ void QQuickDialPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
q->setPressed(false);
|
q->setPressed(false);
|
||||||
pressPoint = QPointF();
|
pressPoint = QPointF();
|
||||||
positionBeforePress = 0;
|
positionBeforePress = 0;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickDialPrivate::handleUngrab()
|
void QQuickDialPrivate::handleUngrab()
|
||||||
|
|
|
@ -112,9 +112,9 @@ public:
|
||||||
void updatePress(const QPointF &pos);
|
void updatePress(const QPointF &pos);
|
||||||
void clearPress(bool clicked);
|
void clearPress(bool clicked);
|
||||||
|
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
static void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
|
static void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
|
||||||
|
@ -185,25 +185,28 @@ void QQuickMonthGridPrivate::clearPress(bool clicked)
|
||||||
pressedItem = nullptr;
|
pressedItem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickMonthGridPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickMonthGridPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickMonthGrid);
|
Q_Q(QQuickMonthGrid);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
updatePress(point);
|
updatePress(point);
|
||||||
if (pressedDate.isValid())
|
if (pressedDate.isValid())
|
||||||
pressTimer = q->startTimer(qGuiApp->styleHints()->mousePressAndHoldInterval());
|
pressTimer = q->startTimer(qGuiApp->styleHints()->mousePressAndHoldInterval());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickMonthGridPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickMonthGridPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
updatePress(point);
|
updatePress(point);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickMonthGridPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickMonthGridPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
clearPress(true);
|
clearPress(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickMonthGridPrivate::handleUngrab()
|
void QQuickMonthGridPrivate::handleUngrab()
|
||||||
|
|
|
@ -91,9 +91,9 @@ class QQuickPageIndicatorPrivate : public QQuickControlPrivate
|
||||||
Q_DECLARE_PUBLIC(QQuickPageIndicator)
|
Q_DECLARE_PUBLIC(QQuickPageIndicator)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
QQuickItem *itemAt(const QPointF &pos) const;
|
QQuickItem *itemAt(const QPointF &pos) const;
|
||||||
|
@ -109,21 +109,27 @@ public:
|
||||||
QQuickItem *pressedItem = nullptr;
|
QQuickItem *pressedItem = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
void QQuickPageIndicatorPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickPageIndicatorPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
if (interactive)
|
if (interactive) {
|
||||||
updatePressed(true, point);
|
updatePressed(true, point);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickPageIndicatorPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickPageIndicatorPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
if (interactive)
|
if (interactive) {
|
||||||
updatePressed(true, point);
|
updatePressed(true, point);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickPageIndicatorPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickPageIndicatorPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickPageIndicator);
|
Q_Q(QQuickPageIndicator);
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
|
@ -131,7 +137,9 @@ void QQuickPageIndicatorPrivate::handleRelease(const QPointF &point, ulong times
|
||||||
if (pressedItem && contentItem)
|
if (pressedItem && contentItem)
|
||||||
q->setCurrentIndex(contentItem->childItems().indexOf(pressedItem));
|
q->setCurrentIndex(contentItem->childItems().indexOf(pressedItem));
|
||||||
updatePressed(false);
|
updatePressed(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickPageIndicatorPrivate::handleUngrab()
|
void QQuickPageIndicatorPrivate::handleUngrab()
|
||||||
|
|
|
@ -249,6 +249,16 @@ void QQuickPanePrivate::updateContentHeight()
|
||||||
emit q->contentHeightChanged();
|
emit q->contentHeightChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
A pane needs to be opaque to mouse events, so that events don't get
|
||||||
|
propagated through to controls covered by the pane.
|
||||||
|
*/
|
||||||
|
bool QQuickPanePrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
|
{
|
||||||
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QQuickPane::QQuickPane(QQuickItem *parent)
|
QQuickPane::QQuickPane(QQuickItem *parent)
|
||||||
: QQuickControl(*(new QQuickPanePrivate), parent)
|
: QQuickControl(*(new QQuickPanePrivate), parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,8 @@ public:
|
||||||
void updateContentWidth();
|
void updateContentWidth();
|
||||||
void updateContentHeight();
|
void updateContentHeight();
|
||||||
|
|
||||||
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
|
|
||||||
bool hasContentWidth = false;
|
bool hasContentWidth = false;
|
||||||
bool hasContentHeight = false;
|
bool hasContentHeight = false;
|
||||||
qreal contentWidth = 0;
|
qreal contentWidth = 0;
|
||||||
|
|
|
@ -383,9 +383,9 @@ public:
|
||||||
#if QT_CONFIG(quicktemplates2_multitouch)
|
#if QT_CONFIG(quicktemplates2_multitouch)
|
||||||
bool acceptTouch(const QTouchEvent::TouchPoint &point) override;
|
bool acceptTouch(const QTouchEvent::TouchPoint &point) override;
|
||||||
#endif
|
#endif
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
void updateHover(const QPointF &pos);
|
void updateHover(const QPointF &pos);
|
||||||
|
@ -470,7 +470,7 @@ bool QQuickRangeSliderPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void QQuickRangeSliderPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickRangeSliderPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickRangeSlider);
|
Q_Q(QQuickRangeSlider);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
|
@ -529,9 +529,10 @@ void QQuickRangeSliderPrivate::handlePress(const QPointF &point, ulong timestamp
|
||||||
if (QQuickItem *handle = otherNode->handle())
|
if (QQuickItem *handle = otherNode->handle())
|
||||||
handle->setZ(0);
|
handle->setZ(0);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickRangeSliderPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickRangeSliderPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickRangeSlider);
|
Q_Q(QQuickRangeSlider);
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
|
@ -549,9 +550,10 @@ void QQuickRangeSliderPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
if (!qFuzzyCompare(pressedNode->position(), oldPos))
|
if (!qFuzzyCompare(pressedNode->position(), oldPos))
|
||||||
emit pressedNode->moved();
|
emit pressedNode->moved();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickRangeSliderPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickRangeSliderPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickRangeSlider);
|
Q_Q(QQuickRangeSlider);
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
|
@ -559,7 +561,7 @@ void QQuickRangeSliderPrivate::handleRelease(const QPointF &point, ulong timesta
|
||||||
|
|
||||||
QQuickRangeSliderNode *pressedNode = QQuickRangeSliderPrivate::pressedNode(touchId);
|
QQuickRangeSliderNode *pressedNode = QQuickRangeSliderPrivate::pressedNode(touchId);
|
||||||
if (!pressedNode)
|
if (!pressedNode)
|
||||||
return;
|
return true;
|
||||||
QQuickRangeSliderNodePrivate *pressedNodePrivate = QQuickRangeSliderNodePrivate::get(pressedNode);
|
QQuickRangeSliderNodePrivate *pressedNodePrivate = QQuickRangeSliderNodePrivate::get(pressedNode);
|
||||||
|
|
||||||
if (q->keepMouseGrab() || q->keepTouchGrab()) {
|
if (q->keepMouseGrab() || q->keepTouchGrab()) {
|
||||||
|
@ -580,6 +582,7 @@ void QQuickRangeSliderPrivate::handleRelease(const QPointF &point, ulong timesta
|
||||||
}
|
}
|
||||||
pressedNode->setPressed(false);
|
pressedNode->setPressed(false);
|
||||||
pressedNodePrivate->touchId = -1;
|
pressedNodePrivate->touchId = -1;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickRangeSliderPrivate::handleUngrab()
|
void QQuickRangeSliderPrivate::handleUngrab()
|
||||||
|
|
|
@ -288,7 +288,7 @@ void QQuickScrollBarPrivate::itemImplicitHeightChanged(QQuickItem *item)
|
||||||
emit indicatorButton->implicitIndicatorHeightChanged();
|
emit indicatorButton->implicitIndicatorHeightChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickScrollBarPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickScrollBarPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickScrollBar);
|
Q_Q(QQuickScrollBar);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
|
@ -297,7 +297,7 @@ void QQuickScrollBarPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
if (decreaseArrow && decreaseArrow->contains(q->mapToItem(decreaseArrow, point + QPointF(0.5, 0.5)))) {
|
if (decreaseArrow && decreaseArrow->contains(q->mapToItem(decreaseArrow, point + QPointF(0.5, 0.5)))) {
|
||||||
indicatorButton->setPressed(true);
|
indicatorButton->setPressed(true);
|
||||||
q->decrease();
|
q->decrease();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ void QQuickScrollBarPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
if (increaseArrow && increaseArrow->contains(q->mapToItem(increaseArrow, point + QPointF(0.5, 0.5)))) {
|
if (increaseArrow && increaseArrow->contains(q->mapToItem(increaseArrow, point + QPointF(0.5, 0.5)))) {
|
||||||
increaseObject->setPressed(true);
|
increaseObject->setPressed(true);
|
||||||
q->increase();
|
q->increase();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,9 +315,10 @@ void QQuickScrollBarPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
if (offset < 0 || offset > sz)
|
if (offset < 0 || offset > sz)
|
||||||
offset = sz / 2;
|
offset = sz / 2;
|
||||||
q->setPressed(true);
|
q->setPressed(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickScrollBarPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickScrollBarPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickScrollBar);
|
Q_Q(QQuickScrollBar);
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
|
@ -330,25 +331,26 @@ void QQuickScrollBarPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
* scrollbar gently.
|
* scrollbar gently.
|
||||||
*/
|
*/
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
qreal pos = qBound<qreal>(0.0, positionAt(point) - offset, 1.0 - size);
|
qreal pos = qBound<qreal>(0.0, positionAt(point) - offset, 1.0 - size);
|
||||||
if (snapMode == QQuickScrollBar::SnapAlways)
|
if (snapMode == QQuickScrollBar::SnapAlways)
|
||||||
pos = snapPosition(pos);
|
pos = snapPosition(pos);
|
||||||
q->setPosition(pos);
|
q->setPosition(pos);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickScrollBarPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickScrollBarPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickScrollBar);
|
Q_Q(QQuickScrollBar);
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
|
|
||||||
if (orientation == Qt::Vertical) {
|
if (orientation == Qt::Vertical) {
|
||||||
if (point.y() < q->topPadding() || point.y() >= (q->height() - q->bottomPadding()))
|
if (point.y() < q->topPadding() || point.y() >= (q->height() - q->bottomPadding()))
|
||||||
return;
|
return true;
|
||||||
} else /* orientation == Qt::Horizontal */{
|
} else /* orientation == Qt::Horizontal */{
|
||||||
if (point.x() < q->leftPadding() || point.x() >= (q->width() - q->rightPadding()))
|
if (point.x() < q->leftPadding() || point.x() >= (q->width() - q->rightPadding()))
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal pos = qBound<qreal>(0.0, positionAt(point) - offset, 1.0 - size);
|
qreal pos = qBound<qreal>(0.0, positionAt(point) - offset, 1.0 - size);
|
||||||
|
@ -357,6 +359,7 @@ void QQuickScrollBarPrivate::handleRelease(const QPointF &point, ulong timestamp
|
||||||
q->setPosition(pos);
|
q->setPosition(pos);
|
||||||
offset = 0.0;
|
offset = 0.0;
|
||||||
q->setPressed(false);
|
q->setPressed(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickScrollBarPrivate::handleUngrab()
|
void QQuickScrollBarPrivate::handleUngrab()
|
||||||
|
|
|
@ -89,9 +89,9 @@ public:
|
||||||
void itemImplicitWidthChanged(QQuickItem *item) override;
|
void itemImplicitWidthChanged(QQuickItem *item) override;
|
||||||
void itemImplicitHeightChanged(QQuickItem *item) override;
|
void itemImplicitHeightChanged(QQuickItem *item) override;
|
||||||
|
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
void visualAreaChange(const VisualArea &newVisualArea, const VisualArea &oldVisualArea);
|
void visualAreaChange(const VisualArea &newVisualArea, const VisualArea &oldVisualArea);
|
||||||
|
|
|
@ -100,9 +100,9 @@ public:
|
||||||
void setPosition(qreal position);
|
void setPosition(qreal position);
|
||||||
void updatePosition();
|
void updatePosition();
|
||||||
|
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
void cancelHandle();
|
void cancelHandle();
|
||||||
|
@ -182,15 +182,16 @@ void QQuickSliderPrivate::updatePosition()
|
||||||
setPosition(pos);
|
setPosition(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSliderPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickSliderPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSlider);
|
Q_Q(QQuickSlider);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
pressPoint = point;
|
pressPoint = point;
|
||||||
q->setPressed(true);
|
q->setPressed(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSliderPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickSliderPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSlider);
|
Q_Q(QQuickSlider);
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
|
@ -204,9 +205,10 @@ void QQuickSliderPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
setPosition(pos);
|
setPosition(pos);
|
||||||
if (!qFuzzyCompare(pos, oldPos))
|
if (!qFuzzyCompare(pos, oldPos))
|
||||||
emit q->moved();
|
emit q->moved();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSliderPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickSliderPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSlider);
|
Q_Q(QQuickSlider);
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
|
@ -225,6 +227,7 @@ void QQuickSliderPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
q->setKeepMouseGrab(false);
|
q->setKeepMouseGrab(false);
|
||||||
q->setKeepTouchGrab(false);
|
q->setKeepTouchGrab(false);
|
||||||
q->setPressed(false);
|
q->setPressed(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSliderPrivate::handleUngrab()
|
void QQuickSliderPrivate::handleUngrab()
|
||||||
|
|
|
@ -134,9 +134,9 @@ public:
|
||||||
void startPressRepeat();
|
void startPressRepeat();
|
||||||
void stopPressRepeat();
|
void stopPressRepeat();
|
||||||
|
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
void itemImplicitWidthChanged(QQuickItem *item) override;
|
void itemImplicitWidthChanged(QQuickItem *item) override;
|
||||||
|
@ -340,7 +340,7 @@ void QQuickSpinBoxPrivate::stopPressRepeat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSpinBoxPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickSpinBoxPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSpinBox);
|
Q_Q(QQuickSpinBox);
|
||||||
QQuickControlPrivate::handlePress(point, timestamp);
|
QQuickControlPrivate::handlePress(point, timestamp);
|
||||||
|
@ -353,9 +353,10 @@ void QQuickSpinBoxPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
q->setAccessibleProperty("pressed", pressed);
|
q->setAccessibleProperty("pressed", pressed);
|
||||||
if (pressed)
|
if (pressed)
|
||||||
startRepeatDelay();
|
startRepeatDelay();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSpinBoxPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickSpinBoxPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSpinBox);
|
Q_Q(QQuickSpinBox);
|
||||||
QQuickControlPrivate::handleMove(point, timestamp);
|
QQuickControlPrivate::handleMove(point, timestamp);
|
||||||
|
@ -370,9 +371,10 @@ void QQuickSpinBoxPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
q->setAccessibleProperty("pressed", pressed);
|
q->setAccessibleProperty("pressed", pressed);
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
stopPressRepeat();
|
stopPressRepeat();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSpinBoxPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickSpinBoxPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSpinBox);
|
Q_Q(QQuickSpinBox);
|
||||||
QQuickControlPrivate::handleRelease(point, timestamp);
|
QQuickControlPrivate::handleRelease(point, timestamp);
|
||||||
|
@ -394,6 +396,7 @@ void QQuickSpinBoxPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
|
|
||||||
q->setAccessibleProperty("pressed", false);
|
q->setAccessibleProperty("pressed", false);
|
||||||
stopPressRepeat();
|
stopPressRepeat();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSpinBoxPrivate::handleUngrab()
|
void QQuickSpinBoxPrivate::handleUngrab()
|
||||||
|
|
|
@ -980,7 +980,7 @@ QQuickItem *QQuickSplitViewPrivate::getContentItem()
|
||||||
return new QQuickContentItem(q);
|
return new QQuickContentItem(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSplitViewPrivate::handlePress(const QPointF &point, ulong timestamp)
|
bool QQuickSplitViewPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSplitView);
|
Q_Q(QQuickSplitView);
|
||||||
QQuickContainerPrivate::handlePress(point, timestamp);
|
QQuickContainerPrivate::handlePress(point, timestamp);
|
||||||
|
@ -1031,9 +1031,10 @@ void QQuickSplitViewPrivate::handlePress(const QPointF &point, ulong timestamp)
|
||||||
<< " size before press=" << m_rightOrBottomItemSizeBeforePress
|
<< " size before press=" << m_rightOrBottomItemSizeBeforePress
|
||||||
<< " item=" << rightOrBottomItem;
|
<< " item=" << rightOrBottomItem;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSplitViewPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickSplitViewPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
QQuickContainerPrivate::handleMove(point, timestamp);
|
QQuickContainerPrivate::handleMove(point, timestamp);
|
||||||
|
|
||||||
|
@ -1043,9 +1044,10 @@ void QQuickSplitViewPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
// resizing to be as responsive and smooth as possible.
|
// resizing to be as responsive and smooth as possible.
|
||||||
updatePolish();
|
updatePolish();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSplitViewPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickSplitViewPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSplitView);
|
Q_Q(QQuickSplitView);
|
||||||
QQuickContainerPrivate::handleRelease(point, timestamp);
|
QQuickContainerPrivate::handleRelease(point, timestamp);
|
||||||
|
@ -1066,6 +1068,7 @@ void QQuickSplitViewPrivate::handleRelease(const QPointF &point, ulong timestamp
|
||||||
m_leftOrTopItemSizeBeforePress = 0.0;
|
m_leftOrTopItemSizeBeforePress = 0.0;
|
||||||
m_rightOrBottomItemSizeBeforePress = 0.0;
|
m_rightOrBottomItemSizeBeforePress = 0.0;
|
||||||
q->setKeepMouseGrab(false);
|
q->setKeepMouseGrab(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSplitViewPrivate::itemVisibilityChanged(QQuickItem *item)
|
void QQuickSplitViewPrivate::itemVisibilityChanged(QQuickItem *item)
|
||||||
|
|
|
@ -98,9 +98,9 @@ public:
|
||||||
int handleIndexForSplitIndex(int splitIndex) const;
|
int handleIndexForSplitIndex(int splitIndex) const;
|
||||||
|
|
||||||
QQuickItem *getContentItem() override;
|
QQuickItem *getContentItem() override;
|
||||||
void handlePress(const QPointF &point, ulong timestamp) override;
|
bool handlePress(const QPointF &point, ulong timestamp) override;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
|
|
||||||
void itemVisibilityChanged(QQuickItem *item) override;
|
void itemVisibilityChanged(QQuickItem *item) override;
|
||||||
void itemImplicitWidthChanged(QQuickItem *item) override;
|
void itemImplicitWidthChanged(QQuickItem *item) override;
|
||||||
|
|
|
@ -88,8 +88,8 @@ public:
|
||||||
qreal positionAt(const QPointF &point) const;
|
qreal positionAt(const QPointF &point) const;
|
||||||
|
|
||||||
bool canDrag(const QPointF &movePoint) const;
|
bool canDrag(const QPointF &movePoint) const;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
|
|
||||||
QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::Switch); }
|
QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::Switch); }
|
||||||
|
|
||||||
|
@ -117,20 +117,22 @@ bool QQuickSwitchPrivate::canDrag(const QPointF &movePoint) const
|
||||||
return (pressPos >= 0.0 && pressPos <= 1.0) || (movePos >= 0.0 && movePos <= 1.0);
|
return (pressPos >= 0.0 && pressPos <= 1.0) || (movePos >= 0.0 && movePos <= 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSwitchPrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickSwitchPrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSwitch);
|
Q_Q(QQuickSwitch);
|
||||||
QQuickAbstractButtonPrivate::handleMove(point, timestamp);
|
QQuickAbstractButtonPrivate::handleMove(point, timestamp);
|
||||||
if (q->keepMouseGrab() || q->keepTouchGrab())
|
if (q->keepMouseGrab() || q->keepTouchGrab())
|
||||||
q->setPosition(positionAt(point));
|
q->setPosition(positionAt(point));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSwitchPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickSwitchPrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSwitch);
|
Q_Q(QQuickSwitch);
|
||||||
QQuickAbstractButtonPrivate::handleRelease(point, timestamp);
|
QQuickAbstractButtonPrivate::handleRelease(point, timestamp);
|
||||||
q->setKeepMouseGrab(false);
|
q->setKeepMouseGrab(false);
|
||||||
q->setKeepTouchGrab(false);
|
q->setKeepTouchGrab(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickSwitch::QQuickSwitch(QQuickItem *parent)
|
QQuickSwitch::QQuickSwitch(QQuickItem *parent)
|
||||||
|
|
|
@ -85,8 +85,8 @@ public:
|
||||||
qreal positionAt(const QPointF &point) const;
|
qreal positionAt(const QPointF &point) const;
|
||||||
|
|
||||||
bool canDrag(const QPointF &movePoint) const;
|
bool canDrag(const QPointF &movePoint) const;
|
||||||
void handleMove(const QPointF &point, ulong timestamp) override;
|
bool handleMove(const QPointF &point, ulong timestamp) override;
|
||||||
void handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
|
|
||||||
QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::ListView); }
|
QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::ListView); }
|
||||||
|
|
||||||
|
@ -114,20 +114,22 @@ bool QQuickSwitchDelegatePrivate::canDrag(const QPointF &movePoint) const
|
||||||
return (pressPos >= 0.0 && pressPos <= 1.0) || (movePos >= 0.0 && movePos <= 1.0);
|
return (pressPos >= 0.0 && pressPos <= 1.0) || (movePos >= 0.0 && movePos <= 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSwitchDelegatePrivate::handleMove(const QPointF &point, ulong timestamp)
|
bool QQuickSwitchDelegatePrivate::handleMove(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSwitchDelegate);
|
Q_Q(QQuickSwitchDelegate);
|
||||||
QQuickItemDelegatePrivate::handleMove(point, timestamp);
|
QQuickItemDelegatePrivate::handleMove(point, timestamp);
|
||||||
if (q->keepMouseGrab() || q->keepTouchGrab())
|
if (q->keepMouseGrab() || q->keepTouchGrab())
|
||||||
q->setPosition(positionAt(point));
|
q->setPosition(positionAt(point));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickSwitchDelegatePrivate::handleRelease(const QPointF &point, ulong timestamp)
|
bool QQuickSwitchDelegatePrivate::handleRelease(const QPointF &point, ulong timestamp)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickSwitchDelegate);
|
Q_Q(QQuickSwitchDelegate);
|
||||||
QQuickItemDelegatePrivate::handleRelease(point, timestamp);
|
QQuickItemDelegatePrivate::handleRelease(point, timestamp);
|
||||||
q->setKeepMouseGrab(false);
|
q->setKeepMouseGrab(false);
|
||||||
q->setKeepTouchGrab(false);
|
q->setKeepTouchGrab(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickSwitchDelegate::QQuickSwitchDelegate(QQuickItem *parent)
|
QQuickSwitchDelegate::QQuickSwitchDelegate(QQuickItem *parent)
|
||||||
|
|
Loading…
Reference in New Issue