Revert "Fixed MouseArea threshold with preventStealing"
This reverts commit e1400b5b4d
,
which breaks qtlocation unit tests for drag support.
It is no longer possible to drag markers in mapviewer.
Task-number: QTBUG-52534
Change-Id: If713a8e45f64ea898f38fe3e39561ebc266403b2
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
This commit is contained in:
parent
d50a57f408
commit
9c8dab5378
|
@ -52,7 +52,7 @@ DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING)
|
|||
QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
|
||||
: enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false),
|
||||
moved(false), stealMouse(false), doubleClick(false), preventStealing(false),
|
||||
propagateComposedEvents(false), overThreshold(false), pressed(0)
|
||||
propagateComposedEvents(false), pressed(0)
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
, drag(0)
|
||||
#endif
|
||||
|
@ -715,7 +715,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
|
|||
curLocalPos = event->windowPos();
|
||||
}
|
||||
|
||||
if (keepMouseGrab() && d->stealMouse && d->overThreshold && !d->drag->active())
|
||||
if (keepMouseGrab() && d->stealMouse && !d->drag->active())
|
||||
d->drag->setActive(true);
|
||||
|
||||
QPointF startPos = d->drag->target()->parentItem()
|
||||
|
@ -741,17 +741,14 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
|
|||
if (d->drag->active())
|
||||
d->drag->target()->setPosition(dragPos);
|
||||
|
||||
if (!d->overThreshold && (QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), Qt::XAxis, event, d->drag->threshold())
|
||||
|| QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), Qt::YAxis, event, d->drag->threshold())))
|
||||
{
|
||||
d->overThreshold = true;
|
||||
if (d->drag->smoothed())
|
||||
d->startScene = event->windowPos();
|
||||
}
|
||||
|
||||
if (!keepMouseGrab() && d->overThreshold) {
|
||||
if (!keepMouseGrab()
|
||||
&& (QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), Qt::XAxis, event, d->drag->threshold())
|
||||
|| QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), Qt::YAxis, event, d->drag->threshold()))) {
|
||||
setKeepMouseGrab(true);
|
||||
d->stealMouse = true;
|
||||
|
||||
if (d->drag->smoothed())
|
||||
d->startScene = event->windowPos();
|
||||
}
|
||||
|
||||
d->moved = true;
|
||||
|
@ -770,7 +767,6 @@ void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event)
|
|||
{
|
||||
Q_D(QQuickMouseArea);
|
||||
d->stealMouse = false;
|
||||
d->overThreshold = false;
|
||||
if (!d->enabled && !d->pressed) {
|
||||
QQuickItem::mouseReleaseEvent(event);
|
||||
} else {
|
||||
|
@ -879,7 +875,6 @@ void QQuickMouseArea::ungrabMouse()
|
|||
d->pressed = 0;
|
||||
d->stealMouse = false;
|
||||
d->doubleClick = false;
|
||||
d->overThreshold = false;
|
||||
setKeepMouseGrab(false);
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
|
|
@ -86,7 +86,6 @@ public:
|
|||
bool doubleClick : 1;
|
||||
bool preventStealing : 1;
|
||||
bool propagateComposedEvents : 1;
|
||||
bool overThreshold : 1;
|
||||
Qt::MouseButtons pressed;
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QQuickDrag *drag;
|
||||
|
|
|
@ -79,7 +79,6 @@ private slots:
|
|||
void dragging_data() { acceptedButton_data(); }
|
||||
void dragging();
|
||||
void dragSmoothed();
|
||||
void dragThreshold_data();
|
||||
void dragThreshold();
|
||||
void invalidDrag_data() { rejectedButton_data(); }
|
||||
void invalidDrag();
|
||||
|
@ -376,17 +375,8 @@ void tst_QQuickMouseArea::dragSmoothed()
|
|||
QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 122));
|
||||
}
|
||||
|
||||
void tst_QQuickMouseArea::dragThreshold_data()
|
||||
{
|
||||
QTest::addColumn<bool>("preventStealing");
|
||||
QTest::newRow("without preventStealing") << false;
|
||||
QTest::newRow("with preventStealing") << true;
|
||||
}
|
||||
|
||||
void tst_QQuickMouseArea::dragThreshold()
|
||||
{
|
||||
QFETCH(bool, preventStealing);
|
||||
|
||||
QQuickView window;
|
||||
QByteArray errorMessage;
|
||||
QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData());
|
||||
|
@ -396,7 +386,6 @@ void tst_QQuickMouseArea::dragThreshold()
|
|||
QVERIFY(window.rootObject() != 0);
|
||||
|
||||
QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion");
|
||||
mouseRegion->setPreventStealing(preventStealing);
|
||||
QQuickDrag *drag = mouseRegion->drag();
|
||||
|
||||
drag->setThreshold(5);
|
||||
|
|
Loading…
Reference in New Issue