aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-08 09:21:58 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-11 22:00:19 +0200
commit212c2bffbb041aee0e3c9a7f0551ef151ed2d3ad (patch)
treea9e5265252c2ccfead34d4e42fe8149358bff0f1
parent974c8da34d79cd8fc417ff5d69bc00c1e910e5ac (diff)
Replace calls to deprecated QEvent accessor functions
Several event accessors were deprecated in qtbase/24e52c10deedbaef833c0e2c3ee7bee03eacc4f5. Replacements were generated by clazy using the new qevent-accessors check: $ export CLAZY_CHECKS=qevent-accessors $ export CLAZY_EXPORT_FIXES=1 $ ../qt6/configure -platform linux-clang -developer-build -debug -no-optimize-debug -opensource -confirm-license -no-pch QMAKE_CXX=clazy $ make $ cd ../../qt6/qtdeclarative $ find . -name "*.clazy.yaml" $ clang-apply-replacements . Task-number: QTBUG-20885 Task-number: QTBUG-84775 Change-Id: I1be5819506fd5039e86b4494223acbe193e6b0c9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--examples/quick/customitems/maskedmousearea/maskedmousearea.cpp6
-rw-r--r--examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp12
-rw-r--r--src/quick/items/qquickdroparea.cpp6
-rw-r--r--src/quick/items/qquickdroparea_p.h4
-rw-r--r--src/quick/items/qquickevents.cpp16
-rw-r--r--src/quick/items/qquickflickable.cpp16
-rw-r--r--src/quick/items/qquickmousearea.cpp24
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp48
-rw-r--r--src/quick/items/qquickpathview.cpp14
-rw-r--r--src/quick/items/qquickpincharea.cpp44
-rw-r--r--src/quick/items/qquicktext.cpp6
-rw-r--r--src/quick/items/qquicktextcontrol.cpp10
-rw-r--r--src/quick/items/qquicktextinput.cpp16
-rw-r--r--src/quick/items/qquickwindow.cpp74
-rw-r--r--src/quickwidgets/qquickwidget.cpp12
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp14
-rw-r--r--tests/auto/quick/qquickdrag/tst_qquickdrag.cpp6
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp2
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp6
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp28
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp16
-rw-r--r--tools/qmleasing/splineeditor.cpp8
23 files changed, 196 insertions, 196 deletions
diff --git a/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp b/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp
index 9a107e0143..55fce54ac0 100644
--- a/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp
+++ b/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp
@@ -115,7 +115,7 @@ bool MaskedMouseArea::contains(const QPointF &point) const
void MaskedMouseArea::mousePressEvent(QMouseEvent *event)
{
setPressed(true);
- m_pressPoint = event->pos();
+ m_pressPoint = event->position().toPoint();
emit pressed();
}
@@ -125,8 +125,8 @@ void MaskedMouseArea::mouseReleaseEvent(QMouseEvent *event)
emit released();
const int threshold = qApp->styleHints()->startDragDistance();
- const bool isClick = (threshold >= qAbs(event->x() - m_pressPoint.x()) &&
- threshold >= qAbs(event->y() - m_pressPoint.y()));
+ const bool isClick = (threshold >= qAbs(event->position().toPoint().x() - m_pressPoint.x()) &&
+ threshold >= qAbs(event->position().toPoint().y() - m_pressPoint.y()));
if (isClick)
emit clicked();
diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp
index dc9d310ff2..9435c004a7 100644
--- a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp
+++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp
@@ -324,12 +324,12 @@ void WindowSingleThreaded::mousePressEvent(QMouseEvent *e)
// event's localPos and windowPos, and screenPos into the event's screenPos. This way
// the windowPos in e is ignored and is replaced by localPos. This is necessary
// because QQuickWindow thinks of itself as a top-level window always.
- QMouseEvent mappedEvent(e->type(), e->localPos(), e->screenPos(), e->button(), e->buttons(), e->modifiers());
+ QMouseEvent mappedEvent(e->type(), e->position(), e->globalPosition(), e->button(), e->buttons(), e->modifiers());
QCoreApplication::sendEvent(m_quickWindow, &mappedEvent);
}
void WindowSingleThreaded::mouseReleaseEvent(QMouseEvent *e)
{
- QMouseEvent mappedEvent(e->type(), e->localPos(), e->screenPos(), e->button(), e->buttons(), e->modifiers());
+ QMouseEvent mappedEvent(e->type(), e->position(), e->globalPosition(), e->button(), e->buttons(), e->modifiers());
QCoreApplication::sendEvent(m_quickWindow, &mappedEvent);
}
diff --git a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp
index 1781670cf3..a9a3534769 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp
@@ -83,7 +83,7 @@ void InspectTool::leaveEvent(QEvent *)
void InspectTool::mousePressEvent(QMouseEvent *event)
{
- m_mousePosition = event->localPos();
+ m_mousePosition = event->position();
if (event->button() == Qt::LeftButton) {
selectItem();
m_hoverHighlight->setVisible(false);
@@ -92,7 +92,7 @@ void InspectTool::mousePressEvent(QMouseEvent *event)
void InspectTool::mouseDoubleClickEvent(QMouseEvent *event)
{
- m_mousePosition = event->localPos();
+ m_mousePosition = event->position();
if (event->button() == Qt::LeftButton) {
selectNextItem();
m_hoverHighlight->setVisible(false);
@@ -106,8 +106,8 @@ void InspectTool::mouseMoveEvent(QMouseEvent *event)
void InspectTool::hoverMoveEvent(QMouseEvent *event)
{
- m_mousePosition = event->localPos();
- QQuickItem *item = inspector()->topVisibleItemAt(event->pos());
+ m_mousePosition = event->position();
+ QQuickItem *item = inspector()->topVisibleItemAt(event->position().toPoint());
if (!item || item == m_lastClickedItem) {
m_hoverHighlight->setVisible(false);
} else {
@@ -123,7 +123,7 @@ void InspectTool::touchEvent(QTouchEvent *event)
switch (event->type()) {
case QEvent::TouchBegin:
if (touchPoints.count() == 1 && (event->touchPointStates() & Qt::TouchPointPressed)) {
- m_mousePosition = touchPoints.first().pos();
+ m_mousePosition = touchPoints.first().position();
m_tapEvent = true;
} else {
m_tapEvent = false;
@@ -133,7 +133,7 @@ void InspectTool::touchEvent(QTouchEvent *event)
if (touchPoints.count() > 1)
m_tapEvent = false;
else if ((touchPoints.count() == 1) && (event->touchPointStates() & Qt::TouchPointMoved))
- m_mousePosition = touchPoints.first().pos();
+ m_mousePosition = touchPoints.first().position();
break;
}
case QEvent::TouchEnd: {
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index d90ee209d6..f8b4d91bda 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -220,7 +220,7 @@ void QQuickDropArea::dragMoveEvent(QDragMoveEvent *event)
if (!d->containsDrag)
return;
- d->dragPosition = event->pos();
+ d->dragPosition = event->position().toPoint();
if (d->drag)
emit d->drag->positionChanged();
@@ -261,7 +261,7 @@ void QQuickDropArea::dragEnterEvent(QDragEnterEvent *event)
if (!d->effectiveEnable || d->containsDrag || !mimeData || !d->hasMatchingKey(d->getKeys(mimeData)))
return;
- d->dragPosition = event->pos();
+ d->dragPosition = event->position().toPoint();
event->accept();
@@ -275,7 +275,7 @@ void QQuickDropArea::dragEnterEvent(QDragEnterEvent *event)
d->source = dragMime->source();
else
d->source = event->source();
- d->dragPosition = event->pos();
+ d->dragPosition = event->position().toPoint();
if (d->drag) {
emit d->drag->positionChanged();
emit d->drag->sourceChanged();
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h
index b1d3d78a37..cabb54011d 100644
--- a/src/quick/items/qquickdroparea_p.h
+++ b/src/quick/items/qquickdroparea_p.h
@@ -85,8 +85,8 @@ class QQuickDropEvent : public QObject
public:
QQuickDropEvent(QQuickDropAreaPrivate *d, QDropEvent *event) : d(d), event(event) {}
- qreal x() const { return event->pos().x(); }
- qreal y() const { return event->pos().y(); }
+ qreal x() const { return event->position().x(); }
+ qreal y() const { return event->position().y(); }
QObject *source() const;
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 783034fd18..80f572d3b5 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -1206,7 +1206,7 @@ QQuickEventTouchPoint::QQuickEventTouchPoint(QQuickPointerTouchEvent *parent)
void QQuickEventTouchPoint::reset(const QTouchEvent::TouchPoint &tp, ulong timestamp)
{
- QQuickEventPoint::reset(tp.state(), tp.scenePos(), tp.id(), timestamp, tp.velocity());
+ QQuickEventPoint::reset(tp.state(), tp.scenePosition(), tp.id(), timestamp, tp.velocity());
m_exclusiveGrabber.clear();
m_passiveGrabbers.clear();
m_rotation = tp.rotation();
@@ -1396,7 +1396,7 @@ QQuickPointerEvent *QQuickPointerMouseEvent::reset(QEvent *event)
default:
break;
}
- m_point->reset(state, ev->windowPos(), quint64(1) << 24, ev->timestamp()); // mouse has device ID 1
+ m_point->reset(state, ev->scenePosition(), quint64(1) << 24, ev->timestamp()); // mouse has device ID 1
return this;
}
@@ -1509,7 +1509,7 @@ QQuickPointerEvent *QQuickPointerNativeGestureEvent::reset(QEvent *event)
break;
}
quint64 deviceId = QTouchDevicePrivate::get(const_cast<QTouchDevice *>(ev->device()))->id; // a bit roundabout since QTouchDevice::mTouchDeviceId is protected
- m_point->reset(state, ev->windowPos(), deviceId << 24, ev->timestamp());
+ m_point->reset(state, ev->scenePosition(), deviceId << 24, ev->timestamp());
return this;
}
#endif // QT_CONFIG(gestures)
@@ -1919,8 +1919,8 @@ QMouseEvent *QQuickPointerTouchEvent::syntheticMouseEvent(int pointID, QQuickIte
Q_ASSERT(false);
return nullptr;
}
- m_synthMouseEvent = QMouseEvent(type, relativeTo->mapFromScene(p->scenePos()),
- p->scenePos(), p->screenPos(), Qt::LeftButton, buttons, m_event->modifiers());
+ m_synthMouseEvent = QMouseEvent(type, relativeTo->mapFromScene(p->scenePosition()),
+ p->scenePosition(), p->globalPosition(), Qt::LeftButton, buttons, m_event->modifiers());
m_synthMouseEvent.setAccepted(true);
m_synthMouseEvent.setTimestamp(m_event->timestamp());
// In the future we will try to always have valid velocity in every QQuickEventPoint.
@@ -1980,7 +1980,7 @@ void QQuickEventTabletPoint::reset(const QTabletEvent *ev)
default:
break;
}
- QQuickEventPoint::reset(state, ev->posF(), 1, ev->timestamp());
+ QQuickEventPoint::reset(state, ev->position(), 1, ev->timestamp());
m_rotation = ev->rotation();
m_pressure = ev->pressure();
m_tangentialPressure = ev->tangentialPressure();
@@ -2176,9 +2176,9 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i
anyStationaryWithModifiedPropertyInside = true;
eventStates |= tp->state();
QTouchEvent::TouchPoint tpCopy = *tp;
- tpCopy.setPos(item->mapFromScene(tpCopy.scenePos()));
+ tpCopy.setPos(item->mapFromScene(tpCopy.scenePosition()));
tpCopy.setLastPos(item->mapFromScene(tpCopy.lastScenePos()));
- tpCopy.setStartPos(item->mapFromScene(tpCopy.startScenePos()));
+ tpCopy.setStartPos(item->mapFromScene(tpCopy.scenePressPosition()));
tpCopy.setEllipseDiameters(tpCopy.ellipseDiameters());
tpCopy.setVelocity(transformMatrix.mapVector(tpCopy.velocity()).toVector2D());
touchPoints << tpCopy;
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 979548e737..0d9183315d 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1060,7 +1060,7 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event)
}
q->setKeepMouseGrab(stealMouse);
- maybeBeginDrag(computeCurrentTime(event), event->localPos());
+ maybeBeginDrag(computeCurrentTime(event), event->position());
}
void QQuickFlickablePrivate::maybeBeginDrag(qint64 currentTimestamp, const QPointF &pressPosn)
@@ -1318,7 +1318,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
return;
qint64 currentTimestamp = computeCurrentTime(event);
- QVector2D deltas = QVector2D(event->localPos() - pressPos);
+ QVector2D deltas = QVector2D(event->position() - pressPos);
bool overThreshold = false;
QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event);
// TODO guarantee that events always have velocity so that it never needs to be computed here
@@ -1327,7 +1327,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if (currentTimestamp == lastTimestamp)
return; // events are too close together: velocity would be infinite
qreal elapsed = qreal(currentTimestamp - lastTimestamp) / 1000.;
- velocity = QVector2D(event->localPos() - (lastPos.isNull() ? pressPos : lastPos)) / elapsed;
+ velocity = QVector2D(event->position() - (lastPos.isNull() ? pressPos : lastPos)) / elapsed;
}
if (q->yflick())
@@ -1335,7 +1335,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if (q->xflick())
overThreshold |= QQuickWindowPrivate::dragOverThreshold(deltas.x(), Qt::XAxis, event);
- drag(currentTimestamp, event->type(), event->localPos(), deltas, overThreshold, false, false, velocity);
+ drag(currentTimestamp, event->type(), event->position(), deltas, overThreshold, false, false, velocity);
}
void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event)
@@ -1394,7 +1394,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event)
bool flickedVertically = false;
vVelocity *= flickBoost;
- bool isVerticalFlickAllowed = q->yflick() && qAbs(vVelocity) > MinimumFlickVelocity && qAbs(event->localPos().y() - pressPos.y()) > FlickThreshold;
+ bool isVerticalFlickAllowed = q->yflick() && qAbs(vVelocity) > MinimumFlickVelocity && qAbs(event->position().y() - pressPos.y()) > FlickThreshold;
if (isVerticalFlickAllowed) {
velocityTimeline.reset(vData.smoothVelocity);
vData.smoothVelocity.setValue(-vVelocity);
@@ -1403,7 +1403,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event)
bool flickedHorizontally = false;
hVelocity *= flickBoost;
- bool isHorizontalFlickAllowed = q->xflick() && qAbs(hVelocity) > MinimumFlickVelocity && qAbs(event->localPos().x() - pressPos.x()) > FlickThreshold;
+ bool isHorizontalFlickAllowed = q->xflick() && qAbs(hVelocity) > MinimumFlickVelocity && qAbs(event->position().x() - pressPos.x()) > FlickThreshold;
if (isHorizontalFlickAllowed) {
velocityTimeline.reset(hData.smoothVelocity);
hData.smoothVelocity.setValue(-hVelocity);
@@ -1453,7 +1453,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event)
// Now send the release
if (window() && window()->mouseGrabberItem()) {
- QPointF localPos = window()->mouseGrabberItem()->mapFromScene(event->windowPos());
+ QPointF localPos = window()->mouseGrabberItem()->mapFromScene(event->scenePosition());
QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));
QCoreApplication::sendEvent(window(), mouseEvent.data());
}
@@ -2383,7 +2383,7 @@ void QQuickFlickablePrivate::addPointerHandler(QQuickPointerHandler *h)
bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event)
{
Q_D(QQuickFlickable);
- QPointF localPos = mapFromScene(event->windowPos());
+ QPointF localPos = mapFromScene(event->scenePosition());
Q_ASSERT_X(receiver != this, "", "Flickable received a filter event for itself");
if (receiver == this && d->stealMouse) {
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 642cbf07b1..9598684e26 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -96,8 +96,8 @@ void QQuickMouseAreaPrivate::init()
void QQuickMouseAreaPrivate::saveEvent(QMouseEvent *event)
{
- lastPos = event->localPos();
- lastScenePos = event->windowPos();
+ lastPos = event->position();
+ lastScenePos = event->scenePosition();
lastButton = event->button();
lastButtons = event->buttons();
lastModifiers = event->modifiers();
@@ -672,7 +672,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event)
d->drag->setActive(false);
#endif
setHovered(true);
- d->startScene = event->windowPos();
+ d->startScene = event->scenePosition();
setKeepMouseGrab(d->stealMouse);
event->setAccepted(setPressed(event->button(), true, event->source()));
if (event->isAccepted())
@@ -690,7 +690,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
// ### we should skip this if these signals aren't used
// ### can GV handle this for us?
- setHovered(contains(event->localPos()));
+ setHovered(contains(event->position()));
if ((event->buttons() & acceptedMouseButtons()) == 0) {
QQuickItem::mouseMoveEvent(event);
@@ -712,10 +712,10 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
QPointF curLocalPos;
if (drag()->target()->parentItem()) {
startLocalPos = drag()->target()->parentItem()->mapFromScene(d->startScene);
- curLocalPos = drag()->target()->parentItem()->mapFromScene(event->windowPos());
+ curLocalPos = drag()->target()->parentItem()->mapFromScene(event->scenePosition());
} else {
startLocalPos = d->startScene;
- curLocalPos = event->windowPos();
+ curLocalPos = event->scenePosition();
}
if (keepMouseGrab() && d->stealMouse && d->overThreshold && !d->drag->active())
@@ -762,7 +762,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
{
d->overThreshold = true;
if (d->drag->smoothed())
- d->startScene = event->windowPos();
+ d->startScene = event->scenePosition();
}
if (!keepMouseGrab() && d->overThreshold) {
@@ -836,7 +836,7 @@ void QQuickMouseArea::hoverEnterEvent(QHoverEvent *event)
if (!d->enabled && !d->pressed) {
QQuickItem::hoverEnterEvent(event);
} else {
- d->lastPos = event->posF();
+ d->lastPos = event->position();
d->lastModifiers = event->modifiers();
setHovered(true);
QQuickMouseEvent &me = d->quickMouseEvent;
@@ -853,8 +853,8 @@ void QQuickMouseArea::hoverMoveEvent(QHoverEvent *event)
Q_D(QQuickMouseArea);
if (!d->enabled && !d->pressed) {
QQuickItem::hoverMoveEvent(event);
- } else if (d->lastPos != event->posF()) {
- d->lastPos = event->posF();
+ } else if (d->lastPos != event->position()) {
+ d->lastPos = event->position();
d->lastModifiers = event->modifiers();
QQuickMouseEvent &me = d->quickMouseEvent;
me.reset(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, Qt::NoButton, d->lastModifiers, false, false);
@@ -937,13 +937,13 @@ void QQuickMouseArea::touchUngrabEvent()
bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event)
{
Q_D(QQuickMouseArea);
- QPointF localPos = mapFromScene(event->windowPos());
+ QPointF localPos = mapFromScene(event->scenePosition());
QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
bool stealThisEvent = d->stealMouse;
if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) {
- QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(),
+ QMouseEvent mouseEvent(event->type(), localPos, event->scenePosition(), event->globalPosition(),
event->button(), event->buttons(), event->modifiers());
mouseEvent.setAccepted(false);
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 383718c979..d2fc476038 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -592,9 +592,9 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
case QEvent::MouseMove:
case QEvent::MouseButtonRelease: {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
- _mouseQpaTouchPoint.setPos(me->localPos());
- _mouseQpaTouchPoint.setScenePos(me->windowPos());
- _mouseQpaTouchPoint.setScreenPos(me->screenPos());
+ _mouseQpaTouchPoint.setPos(me->position());
+ _mouseQpaTouchPoint.setScenePos(me->scenePosition());
+ _mouseQpaTouchPoint.setScreenPos(me->globalPosition());
if (event->type() == QEvent::MouseMove)
_mouseQpaTouchPoint.setState(Qt::TouchPointMoved);
else if (event->type() == QEvent::MouseButtonRelease)
@@ -602,9 +602,9 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
else { // QEvent::MouseButtonPress
addTouchPoint(me);
started = true;
- _mouseQpaTouchPoint.setStartPos(me->localPos());
- _mouseQpaTouchPoint.setStartScenePos(me->windowPos());
- _mouseQpaTouchPoint.setStartScreenPos(me->screenPos());
+ _mouseQpaTouchPoint.setStartPos(me->position());
+ _mouseQpaTouchPoint.setStartScenePos(me->scenePosition());
+ _mouseQpaTouchPoint.setStartScreenPos(me->globalPosition());
_mouseQpaTouchPoint.setState(Qt::TouchPointPressed);
}
touchPoints << _mouseQpaTouchPoint;
@@ -662,8 +662,8 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) {
if (p.state() == Qt::TouchPointReleased)
continue;
- const QPointF &currentPos = p.scenePos();
- const QPointF &startPos = p.startScenePos();
+ const QPointF &currentPos = p.scenePosition();
+ const QPointF &startPos = p.scenePressPosition();
if (qAbs(currentPos.x() - startPos.x()) > dragThreshold)
offerGrab = true;
else if (qAbs(currentPos.y() - startPos.y()) > dragThreshold)
@@ -784,33 +784,33 @@ void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QT
//TODO: if !qmlDefined, could bypass setters.
// also, should only emit signals after all values have been set
dtp->setUniqueId(p->uniqueId());
- dtp->setPosition(p->pos());
+ dtp->setPosition(p->position());
dtp->setEllipseDiameters(p->ellipseDiameters());
dtp->setPressure(p->pressure());
dtp->setRotation(p->rotation());
dtp->setVelocity(p->velocity());
QRectF area(QPointF(), p->ellipseDiameters());
- area.moveCenter(p->pos());
+ area.moveCenter(p->position());
dtp->setArea(area);
- dtp->setStartX(p->startPos().x());
- dtp->setStartY(p->startPos().y());
+ dtp->setStartX(p->pressPosition().x());
+ dtp->setStartY(p->pressPosition().y());
dtp->setPreviousX(p->lastPos().x());
dtp->setPreviousY(p->lastPos().y());
- dtp->setSceneX(p->scenePos().x());
- dtp->setSceneY(p->scenePos().y());
+ dtp->setSceneX(p->scenePosition().x());
+ dtp->setSceneY(p->scenePosition().y());
}
void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QMouseEvent *e)
{
dtp->setPreviousX(dtp->x());
dtp->setPreviousY(dtp->y());
- dtp->setPosition(e->localPos());
+ dtp->setPosition(e->position());
if (e->type() == QEvent::MouseButtonPress) {
- dtp->setStartX(e->localPos().x());
- dtp->setStartY(e->localPos().y());
+ dtp->setStartX(e->position().x());
+ dtp->setStartY(e->position().y());
}
- dtp->setSceneX(e->windowPos().x());
- dtp->setSceneY(e->windowPos().y());
+ dtp->setSceneX(e->scenePosition().x());
+ dtp->setSceneY(e->scenePosition().y());
}
void QQuickMultiPointTouchArea::mousePressEvent(QMouseEvent *event)
@@ -823,7 +823,7 @@ void QQuickMultiPointTouchArea::mousePressEvent(QMouseEvent *event)
_stealMouse = false;
setKeepMouseGrab(false);
event->setAccepted(true);
- _mousePos = event->localPos();
+ _mousePos = event->position();
if (event->source() != Qt::MouseEventNotSynthesized && event->source() != Qt::MouseEventSynthesizedByQt)
return;
@@ -904,13 +904,13 @@ void QQuickMultiPointTouchArea::touchUngrabEvent()
bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event)
{
- QPointF localPos = mapFromScene(event->windowPos());
+ QPointF localPos = mapFromScene(event->scenePosition());
QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
bool stealThisEvent = _stealMouse;
if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) {
- QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(),
+ QMouseEvent mouseEvent(event->type(), localPos, event->scenePosition(), event->globalPosition(),
event->button(), event->buttons(), event->modifiers());
mouseEvent.setAccepted(false);
QGuiApplicationPrivate::setMouseEventCapsAndVelocity(&mouseEvent,
@@ -1000,7 +1000,7 @@ bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event)
case QEvent::MouseMove:
case QEvent::MouseButtonRelease: {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
- containsPoint = contains(mapFromScene(me->windowPos()));
+ containsPoint = contains(mapFromScene(me->scenePosition()));
}
break;
case QEvent::TouchBegin:
@@ -1008,7 +1008,7 @@ bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event)
case QEvent::TouchEnd: {
QTouchEvent *te = static_cast<QTouchEvent*>(event);
for (const QTouchEvent::TouchPoint &point : te->touchPoints()) {
- if (contains(mapFromScene(point.scenePos()))) {
+ if (contains(mapFromScene(point.scenePosition()))) {
containsPoint = true;
break;
}
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 4a8089f49c..4860378957 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1657,16 +1657,16 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
int idx = 0;
for (; idx < items.count(); ++idx) {
QQuickItem *item = items.at(idx);
- if (item->contains(item->mapFromScene(event->windowPos())))
+ if (item->contains(item->mapFromScene(event->scenePosition())))
break;
}
if (idx == items.count() && qFuzzyIsNull(dragMargin)) // didn't click on an item
return;
- startPoint = pointNear(event->localPos(), &startPc);
- startPos = event->localPos();
+ startPoint = pointNear(event->position(), &startPc);
+ startPos = event->position();
if (idx == items.count()) {
- qreal distance = qAbs(event->localPos().x() - startPoint.x()) + qAbs(event->localPos().y() - startPoint.y());
+ qreal distance = qAbs(event->position().x() - startPoint.x()) + qAbs(event->position().y() - startPoint.y());
if (distance > dragMargin)
return;
}
@@ -1703,9 +1703,9 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)
qint64 currentTimestamp = computeCurrentTime(event);
qreal newPc;
- QPointF pathPoint = pointNear(event->localPos(), &newPc);
+ QPointF pathPoint = pointNear(event->position(), &newPc);
if (!stealMouse) {
- QPointF posDelta = event->localPos() - startPos;
+ QPointF posDelta = event->position() - startPos;
if (QQuickWindowPrivate::dragOverThreshold(posDelta.y(), Qt::YAxis, event) || QQuickWindowPrivate::dragOverThreshold(posDelta.x(), Qt::XAxis, event)) {
// The touch has exceeded the threshold. If the movement along the path is close to the drag threshold
// then we'll assume that this gesture targets the PathView. This ensures PathView gesture grabbing
@@ -1840,7 +1840,7 @@ void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *event)
bool QQuickPathView::sendMouseEvent(QMouseEvent *event)
{
Q_D(QQuickPathView);
- QPointF localPos = mapFromScene(event->windowPos());
+ QPointF localPos = mapFromScene(event->scenePosition());
QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 5f767bf1f5..9ba0c54b6e 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -469,10 +469,10 @@ void QQuickPinchArea::updatePinch()
QTouchEvent::TouchPoint touchPoint2 = d->touchPoints.at(d->touchPoints. count() >= 2 ? 1 : 0);
if (touchPoint1.state() == Qt::TouchPointPressed)
- d->sceneStartPoint1 = touchPoint1.scenePos();
+ d->sceneStartPoint1 = touchPoint1.scenePosition();
if (touchPoint2.state() == Qt::TouchPointPressed)
- d->sceneStartPoint2 = touchPoint2.scenePos();
+ d->sceneStartPoint2 = touchPoint2.scenePosition();
QRectF bounds = clipRect();
// Pinch is not started unless there are exactly two touch points
@@ -480,7 +480,7 @@ void QQuickPinchArea::updatePinch()
// AND both points are inside the bounds.
if (d->touchPoints.count() == 2
&& (touchPoint1.state() & Qt::TouchPointPressed || touchPoint2.state() & Qt::TouchPointPressed) &&
- bounds.contains(touchPoint1.pos()) && bounds.contains(touchPoint2.pos())) {
+ bounds.contains(touchPoint1.position()) && bounds.contains(touchPoint2.position())) {
d->id1 = touchPoint1.id();
d->pinchActivated = true;
d->initPinch = true;
@@ -494,8 +494,8 @@ void QQuickPinchArea::updatePinch()
}
if (d->pinchActivated && !d->pinchRejected) {
const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
- QPointF p1 = touchPoint1.scenePos();
- QPointF p2 = touchPoint2.scenePos();
+ QPointF p1 = touchPoint1.scenePosition();
+ QPointF p2 = touchPoint2.scenePosition();
qreal dx = p1.x() - p2.x();
qreal dy = p1.y() - p2.y();
qreal dist = qSqrt(dx*dx + dy*dy);
@@ -504,9 +504,9 @@ void QQuickPinchArea::updatePinch()
if (d->touchPoints.count() == 1) {
// If we only have one point then just move the center
if (d->id1 == touchPoint1.id())
- sceneCenter = d->sceneLastCenter + touchPoint1.scenePos() - d->lastPoint1;
+ sceneCenter = d->sceneLastCenter + touchPoint1.scenePosition() - d->lastPoint1;
else
- sceneCenter = d->sceneLastCenter + touchPoint2.scenePos() - d->lastPoint2;
+ sceneCenter = d->sceneLastCenter + touchPoint2.scenePosition() - d->lastPoint2;
angle = d->pinchLastAngle;
}
d->id1 = touchPoint1.id();
@@ -582,14 +582,14 @@ void QQuickPinchArea::updatePinch()
pe.setPreviousScale(d->pinchLastScale);
pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
- pe.setPoint1(touchPoint1.pos());
- pe.setPoint2(touchPoint2.pos());
+ pe.setPoint1(touchPoint1.position());
+ pe.setPoint2(touchPoint2.position());
pe.setPointCount(d->touchPoints.count());
d->pinchLastScale = scale;
d->sceneLastCenter = sceneCenter;
d->pinchLastAngle = angle;
- d->lastPoint1 = touchPoint1.scenePos();
- d->lastPoint2 = touchPoint2.scenePos();
+ d->lastPoint1 = touchPoint1.scenePosition();
+ d->lastPoint2 = touchPoint2.scenePosition();
emit pinchUpdated(&pe);
updatePinchTarget();
}
@@ -681,17 +681,17 @@ bool QQuickPinchArea::event(QEvent *event)
switch (gesture->gestureType()) {
case Qt::BeginNativeGesture:
clearPinch(); // probably not necessary; JIC
- d->pinchStartCenter = gesture->localPos();
+ d->pinchStartCenter = gesture->position();
d->pinchStartAngle = 0.0;
d->pinchStartRotation = 0.0;
d->pinchRotation = 0.0;
d->pinchStartScale = 1.0;
d->pinchLastAngle = 0.0;
d->pinchLastScale = 1.0;
- d->sceneStartPoint1 = gesture->windowPos();
- d->sceneStartPoint2 = gesture->windowPos(); // TODO we never really know
- d->lastPoint1 = gesture->windowPos();
- d->lastPoint2 = gesture->windowPos(); // TODO we never really know
+ d->sceneStartPoint1 = gesture->scenePosition();
+ d->sceneStartPoint2 = gesture->scenePosition(); // TODO we never really know
+ d->lastPoint1 = gesture->scenePosition();
+ d->lastPoint2 = gesture->scenePosition(); // TODO we never really know
if (d->pinch && d->pinch->target()) {
d->pinchStartPos = d->pinch->target()->position();
d->pinchStartScale = d->pinch->target()->scale();
@@ -731,15 +731,15 @@ bool QQuickPinchArea::event(QEvent *event)
d->pinchLastScale = d->pinchStartScale = d->pinch->target()->scale();
d->pinchLastAngle = d->pinchStartRotation = d->pinch->target()->rotation();
}
- QQuickPinchEvent pe(gesture->localPos(), gesture->value(), d->pinchLastAngle, 0.0);
- pe.setStartCenter(gesture->localPos());
+ QQuickPinchEvent pe(gesture->position(), gesture->value(), d->pinchLastAngle, 0.0);
+ pe.setStartCenter(gesture->position());
pe.setPreviousCenter(d->pinchStartCenter);
pe.setPreviousAngle(d->pinchLastAngle);
pe.setPreviousScale(d->pinchLastScale);
- pe.setStartPoint1(gesture->localPos());
- pe.setStartPoint2(gesture->localPos());
- pe.setPoint1(mapFromScene(gesture->windowPos()));
- pe.setPoint2(mapFromScene(gesture->windowPos()));
+ pe.setStartPoint1(gesture->position());
+ pe.setStartPoint2(gesture->position());
+ pe.setPoint1(mapFromScene(gesture->scenePosition()));
+ pe.setPoint2(mapFromScene(gesture->scenePosition()));
pe.setPointCount(2);
emit smartZoom(&pe);
} break;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index af8a0c476e..bbf6e4f8b8 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -2816,7 +2816,7 @@ void QQuickText::mousePressEvent(QMouseEvent *event)
QString link;
if (d->isLinkActivatedConnected())
- link = d->anchorAt(event->localPos());
+ link = d->anchorAt(event->position());
if (link.isEmpty()) {
event->setAccepted(false);
@@ -2840,7 +2840,7 @@ void QQuickText::mouseReleaseEvent(QMouseEvent *event)
QString link;
if (d->isLinkActivatedConnected())
- link = d->anchorAt(event->localPos());
+ link = d->anchorAt(event->position());
if (!link.isEmpty() && d->extra.isAllocated() && d->extra->activeLink == link)
emit linkActivated(d->extra->activeLink);
@@ -2903,7 +2903,7 @@ void QQuickTextPrivate::processHoverEvent(QHoverEvent *event)
QString link;
if (isLinkHoveredConnected()) {
if (event->type() != QEvent::HoverLeave)
- link = anchorAt(event->posF());
+ link = anchorAt(event->position());
if ((!extra.isAllocated() && !link.isEmpty()) || (extra.isAllocated() && extra->hoveredLink != link)) {
extra.value().hoveredLink = link;
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index cc6ecbf23a..30f1e7f405 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -741,25 +741,25 @@ void QQuickTextControl::processEvent(QEvent *e, const QTransform &transform)
break;
case QEvent::MouseButtonPress: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mousePressEvent(ev, transform.map(ev->localPos()));
+ d->mousePressEvent(ev, transform.map(ev->position()));
break; }
case QEvent::MouseMove: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mouseMoveEvent(ev, transform.map(ev->localPos()));
+ d->mouseMoveEvent(ev, transform.map(ev->position()));
break; }
case QEvent::MouseButtonRelease: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mouseReleaseEvent(ev, transform.map(ev->localPos()));
+ d->mouseReleaseEvent(ev, transform.map(ev->position()));
break; }
case QEvent::MouseButtonDblClick: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mouseDoubleClickEvent(ev, transform.map(ev->localPos()));
+ d->mouseDoubleClickEvent(ev, transform.map(ev->position()));
break; }
case QEvent::HoverEnter:
case QEvent::HoverMove:
case QEvent::HoverLeave: {
QHoverEvent *ev = static_cast<QHoverEvent *>(e);
- d->hoverEvent(ev, transform.map(ev->posF()));
+ d->hoverEvent(ev, transform.map(ev->position()));
break; }
#if QT_CONFIG(im)
case QEvent::InputMethod:
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 39424d5f9d..163df3522f 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1544,11 +1544,11 @@ void QQuickTextInput::mouseDoubleClickEvent(QMouseEvent *event)
#if QT_CONFIG(im)
d->commitPreedit();
#endif
- int cursor = d->positionAt(event->localPos());
+ int cursor = d->positionAt(event->position());
d->selectWordAtPos(cursor);
event->setAccepted(true);
if (!d->hasPendingTripleClick()) {
- d->tripleClickStartPoint = event->localPos();
+ d->tripleClickStartPoint = event->position();
d->tripleClickTimer.start();
}
} else {
@@ -1562,7 +1562,7 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickTextInput);
- d->pressPos = event->localPos();
+ d->pressPos = event->position();
if (d->sendMouseEventToInputContext(event))
return;
@@ -1580,7 +1580,7 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event)
}
bool mark = (event->modifiers() & Qt::ShiftModifier) && d->selectByMouse;
- int cursor = d->positionAt(event->localPos());
+ int cursor = d->positionAt(event->position());
d->moveCursor(cursor, mark);
if (d->focusOnPress && !qGuiApp->styleHints()->setFocusOnTouchRelease())
@@ -1594,20 +1594,20 @@ void QQuickTextInput::mouseMoveEvent(QMouseEvent *event)
Q_D(QQuickTextInput);
if (d->selectPressed) {
- if (qAbs(int(event->localPos().x() - d->pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
+ if (qAbs(int(event->position().x() - d->pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
setKeepMouseGrab(true);
#if QT_CONFIG(im)
if (d->composeMode()) {
// start selection
int startPos = d->positionAt(d->pressPos);
- int currentPos = d->positionAt(event->localPos());
+ int currentPos = d->positionAt(event->position());
if (startPos != currentPos)
d->setSelection(startPos, currentPos - startPos);
} else
#endif
{
- moveCursorSelection(d->positionAt(event->localPos()), d->mouseSelectionMode);
+ moveCursorSelection(d->positionAt(event->position()), d->mouseSelectionMode);
}
event->setAccepted(true);
} else {
@@ -1646,7 +1646,7 @@ bool QQuickTextInputPrivate::sendMouseEventToInputContext(QMouseEvent *event)
{
#if QT_CONFIG(im)
if (composeMode()) {
- int tmp_cursor = positionAt(event->localPos());
+ int tmp_cursor = positionAt(event->position());
int mousePos = tmp_cursor - m_cursor;
if (mousePos >= 0 && mousePos <= m_textLayout.preeditAreaText().length()) {
if (event->type() == QEvent::MouseButtonRelease) {
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 262f4d58cf..39f85e1f6d 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -861,7 +861,7 @@ static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::Touc
{
Q_ASSERT(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents));
// The touch point local position and velocity are not yet transformed.
- QMouseEvent *me = new QMouseEvent(type, transformNeeded ? item->mapFromScene(p.scenePos()) : p.pos(), p.scenePos(), p.screenPos(),
+ QMouseEvent *me = new QMouseEvent(type, transformNeeded ? item->mapFromScene(p.scenePosition()) : p.position(), p.scenePosition(), p.globalPosition(),
Qt::LeftButton, (type == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton), event->modifiers());
me->setAccepted(true);
me->setTimestamp(event->timestamp());
@@ -934,7 +934,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
const QTouchEvent::TouchPoint &p = event->touchPoints().at(i);
// A new touch point
if (touchMouseId == -1 && p.state() & Qt::TouchPointPressed) {
- QPointF pos = item->mapFromScene(p.scenePos());
+ QPointF pos = item->mapFromScene(p.scenePosition());
// probably redundant, we check bounds in the calling function (matchingNewPoints)
if (!item->contains(pos))
@@ -954,7 +954,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
if (auto pointerEventPoint = pointerEvent->pointById(p.id()))
pointerEventPoint->setGrabberItem(item);
- if (checkIfDoubleTapped(event->timestamp(), p.screenPos().toPoint())) {
+ if (checkIfDoubleTapped(event->timestamp(), p.globalPosition().toPoint())) {
// since we synth the mouse event from from touch, we respect the
// QPlatformTheme::TouchDoubleTapDistance instead of QPlatformTheme::MouseDoubleClickDistance
QScopedPointer<QMouseEvent> mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event.data(), item, false));
@@ -973,7 +973,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
if (p.state() & Qt::TouchPointMoved) {
if (touchMousePressTimestamp != 0) {
const int doubleTapDistance = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::TouchDoubleTapDistance).toInt();
- const QPoint moveDelta = p.screenPos().toPoint() - touchMousePressPos;
+ const QPoint moveDelta = p.globalPosition().toPoint() - touchMousePressPos;
if (moveDelta.x() >= doubleTapDistance || moveDelta.y() >= doubleTapDistance)
touchMousePressTimestamp = 0; // Got dragged too far, dismiss the double tap
}
@@ -991,12 +991,12 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
// hover for touch???
QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), item, false));
if (lastMousePosition.isNull())
- lastMousePosition = me->windowPos();
+ lastMousePosition = me->scenePosition();
QPointF last = lastMousePosition;
- lastMousePosition = me->windowPos();
+ lastMousePosition = me->scenePosition();
bool accepted = me->isAccepted();
- bool delivered = deliverHoverEvent(contentItem, me->windowPos(), last, me->modifiers(), me->timestamp(), accepted);
+ bool delivered = deliverHoverEvent(contentItem, me->scenePosition(), last, me->modifiers(), me->timestamp(), accepted);
if (!delivered) {
//take care of any exits
accepted = clearHover(me->timestamp());
@@ -1010,7 +1010,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event.data(), mouseGrabberItem, false));
QCoreApplication::sendEvent(item, me.data());
- if (item->acceptHoverEvents() && p.screenPos() != QGuiApplicationPrivate::lastCursorPosition) {
+ if (item->acceptHoverEvents() && p.globalPosition() != QGuiApplicationPrivate::lastCursorPosition) {
QPointF localMousePos(qInf(), qInf());
if (QWindow *w = item->window())
localMousePos = item->mapFromScene(w->mapFromGlobal(QGuiApplicationPrivate::lastCursorPosition.toPoint()));
@@ -1138,8 +1138,8 @@ void QQuickWindowPrivate::translateTouchEvent(QTouchEvent *touchEvent)
QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints();
for (int i = 0; i < touchPoints.count(); ++i) {
QTouchEvent::TouchPoint &touchPoint = touchPoints[i];
- touchPoint.setScenePos(touchPoint.pos());
- touchPoint.setStartScenePos(touchPoint.startPos());
+ touchPoint.setScenePos(touchPoint.position());
+ touchPoint.setStartScenePos(touchPoint.pressPosition());
touchPoint.setLastScenePos(touchPoint.lastPos());
}
touchEvent->setTouchPoints(touchPoints);
@@ -2011,8 +2011,8 @@ QMouseEvent *QQuickWindowPrivate::cloneMouseEvent(QMouseEvent *event, QPointF *t
int caps = QGuiApplicationPrivate::mouseEventCaps(event);
QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event);
QMouseEvent *me = new QMouseEvent(event->type(),
- transformedLocalPos ? *transformedLocalPos : event->localPos(),
- event->windowPos(), event->screenPos(),
+ transformedLocalPos ? *transformedLocalPos : event->position(),
+ event->scenePosition(), event->globalPosition(),
event->button(), event->buttons(), event->modifiers());
QGuiApplicationPrivate::setMouseEventCapsAndVelocity(me, caps, velocity);
QGuiApplicationPrivate::setMouseEventSource(me, QGuiApplicationPrivate::mouseEventSource(event));
@@ -2428,7 +2428,7 @@ void QQuickWindowPrivate::handleTouchEvent(QTouchEvent *event)
if (point.state() == Qt::TouchPointReleased) {
lastMousePosition = QPointF();
} else {
- lastMousePosition = point.pos();
+ lastMousePosition = point.position();
}
}
@@ -2479,7 +2479,7 @@ void QQuickWindowPrivate::handleMouseEvent(QMouseEvent *event)
event->accept();
return;
}
- qCDebug(DBG_MOUSE) << "QQuickWindow::handleMouseEvent()" << event->type() << event->localPos() << event->button() << event->buttons();
+ qCDebug(DBG_MOUSE) << "QQuickWindow::handleMouseEvent()" << event->type() << event->position() << event->button() << event->buttons();
switch (event->type()) {
case QEvent::MouseButtonPress:
@@ -2500,20 +2500,20 @@ void QQuickWindowPrivate::handleMouseEvent(QMouseEvent *event)
break;
case QEvent::MouseMove:
Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseMove,
- event->localPos().x(), event->localPos().y());
+ event->position().x(), event->localPos().y());
qCDebug(DBG_HOVER_TRACE) << this;
#if QT_CONFIG(cursor)
- updateCursor(event->windowPos());
+ updateCursor(event->scenePosition());
#endif
if (!pointerEventInstance(QQuickPointerDevice::genericMouseDevice())->point(0)->exclusiveGrabber()) {
- QPointF last = lastMousePosition.isNull() ? event->windowPos() : lastMousePosition;
- lastMousePosition = event->windowPos();
+ QPointF last = lastMousePosition.isNull() ? event->scenePosition() : lastMousePosition;
+ lastMousePosition = event->scenePosition();
bool accepted = event->isAccepted();
- bool delivered = deliverHoverEvent(contentItem, event->windowPos(), last, event->modifiers(), event->timestamp(), accepted);
+ bool delivered = deliverHoverEvent(contentItem, event->scenePosition(), last, event->modifiers(), event->timestamp(), accepted);
if (!delivered) {
//take care of any exits
accepted = clearHover(event->timestamp());
@@ -3034,13 +3034,13 @@ void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *e
if (event->type() == QEvent::Drop) {
QDropEvent *e = static_cast<QDropEvent *>(event);
for (e->setAccepted(false); !e->isAccepted() && grabItem != grabber->end(); grabItem = grabber->release(grabItem)) {
- QPointF p = (**grabItem)->mapFromScene(e->pos());
+ QPointF p = (**grabItem)->mapFromScene(e->position().toPoint());
QDropEvent translatedEvent(
p.toPoint(),
e->possibleActions(),
e->mimeData(),
- e->mouseButtons(),
- e->keyboardModifiers());
+ e->buttons(),
+ e->modifiers());
QQuickDropEventEx::copyActions(&translatedEvent, *e);
QCoreApplication::sendEvent(**grabItem, &translatedEvent);
e->setAccepted(translatedEvent.isAccepted());
@@ -3064,11 +3064,11 @@ void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *e
// Look for any other potential drop targets that are higher than the current ones
QDragEnterEvent enterEvent(
- moveEvent->pos(),
+ moveEvent->position().toPoint(),
moveEvent->possibleActions(),
moveEvent->mimeData(),
- moveEvent->mouseButtons(),
- moveEvent->keyboardModifiers());
+ moveEvent->buttons(),
+ moveEvent->modifiers());
QQuickDropEventEx::copyActions(&enterEvent, *moveEvent);
event->setAccepted(deliverDragEvent(grabber, contentItem, &enterEvent, &currentGrabItems));
@@ -3078,11 +3078,11 @@ void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *e
currentGrabItems.remove(i);
// Still grabbed: send move event
QDragMoveEvent translatedEvent(
- (**grabItem)->mapFromScene(moveEvent->pos()).toPoint(),
+ (**grabItem)->mapFromScene(moveEvent->position().toPoint()).toPoint(),
moveEvent->possibleActions(),
moveEvent->mimeData(),
- moveEvent->mouseButtons(),
- moveEvent->keyboardModifiers());
+ moveEvent->buttons(),
+ moveEvent->modifiers());
QQuickDropEventEx::copyActions(&translatedEvent, *moveEvent);
QCoreApplication::sendEvent(**grabItem, &translatedEvent);
event->setAccepted(translatedEvent.isAccepted());
@@ -3101,11 +3101,11 @@ void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *e
if (event->type() == QEvent::DragEnter || event->type() == QEvent::DragMove) {
QDragMoveEvent *e = static_cast<QDragMoveEvent *>(event);
QDragEnterEvent enterEvent(
- e->pos(),
+ e->position().toPoint(),
e->possibleActions(),
e->mimeData(),
- e->mouseButtons(),
- e->keyboardModifiers());
+ e->buttons(),
+ e->modifiers());
QQuickDropEventEx::copyActions(&enterEvent, *e);
event->setAccepted(deliverDragEvent(grabber, contentItem, &enterEvent));
}
@@ -3116,7 +3116,7 @@ bool QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
if (!item->isVisible() || !item->isEnabled() || QQuickItemPrivate::get(item)->culled)
return false;
- QPointF p = item->mapFromScene(event->pos());
+ QPointF p = item->mapFromScene(event->position().toPoint());
bool itemContained = item->contains(p);
if (!itemContained && itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
@@ -3124,11 +3124,11 @@ bool QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte
}
QDragEnterEvent enterEvent(
- event->pos(),
+ event->position().toPoint(),
event->possibleActions(),
event->mimeData(),
- event->mouseButtons(),
- event->keyboardModifiers());
+ event->buttons(),
+ event->modifiers());
QQuickDropEventEx::copyActions(&enterEvent, *event);
QList<QQuickItem *> children = itemPrivate->paintOrderChildItems();
@@ -3154,8 +3154,8 @@ bool QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte
p.toPoint(),
event->possibleActions(),
event->mimeData(),
- event->mouseButtons(),
- event->keyboardModifiers(),
+ event->buttons(),
+ event->modifiers(),
event->type());
QQuickDropEventEx::copyActions(&translatedEvent, *event);
translatedEvent.setAccepted(event->isAccepted());
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 440da6b461..d504deb521 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1355,14 +1355,14 @@ void QQuickWidget::keyReleaseEvent(QKeyEvent *e)
void QQuickWidget::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QQuickWidget);
- Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseMove, e->localPos().x(),
+ Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseMove, e->position().x(),
e->localPos().y());
// Put localPos into the event's localPos and windowPos, and screenPos into the
// event's screenPos. This way the windowPos in e is ignored and is replaced by
// localPos. This is necessary because QQuickWindow thinks of itself as a
// top-level window always.
- QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),
+ QMouseEvent mappedEvent(e->type(), e->position(), e->position(), e->globalPosition(),
e->button(), e->buttons(), e->modifiers(), e->source());
QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);
e->setAccepted(mappedEvent.isAccepted());
@@ -1377,11 +1377,11 @@ void QQuickWidget::mouseDoubleClickEvent(QMouseEvent *e)
// As the second mouse press is suppressed in widget windows we emulate it here for QML.
// See QTBUG-25831
- QMouseEvent pressEvent(QEvent::MouseButtonPress, e->localPos(), e->localPos(), e->screenPos(),
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, e->position(), e->position(), e->globalPosition(),
e->button(), e->buttons(), e->modifiers(), e->source());
QCoreApplication::sendEvent(d->offscreenWindow, &pressEvent);
e->setAccepted(pressEvent.isAccepted());
- QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),
+ QMouseEvent mappedEvent(e->type(), e->position(), e->position(), e->globalPosition(),
e->button(), e->buttons(), e->modifiers(), e->source());
QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);
}
@@ -1440,7 +1440,7 @@ void QQuickWidget::mousePressEvent(QMouseEvent *e)
Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMousePress, e->button(),
e->buttons());
- QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),
+ QMouseEvent mappedEvent(e->type(), e->position(), e->position(), e->globalPosition(),
e->button(), e->buttons(), e->modifiers(), e->source());
QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);
e->setAccepted(mappedEvent.isAccepted());
@@ -1453,7 +1453,7 @@ void QQuickWidget::mouseReleaseEvent(QMouseEvent *e)
Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseRelease, e->button(),
e->buttons());
- QMouseEvent mappedEvent(e->type(), e->localPos(), e->localPos(), e->screenPos(),
+ QMouseEvent mappedEvent(e->type(), e->position(), e->position(), e->globalPosition(),
e->button(), e->buttons(), e->modifiers(), e->source());
QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);
e->setAccepted(mappedEvent.isAccepted());
diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp
index 2b6482465c..7bfaac318f 100644
--- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp
@@ -106,31 +106,31 @@ public:
{
qCDebug(lcPointerTests) << event << "will accept?" << acceptTouch;
for (const QTouchEvent::TouchPoint &tp : event->touchPoints())
- eventList.append(Event(Event::TouchDestination, event->type(), tp.state(), grabTransition(acceptTouch, tp.state()), tp.pos(), tp.scenePos()));
+ eventList.append(Event(Event::TouchDestination, event->type(), tp.state(), grabTransition(acceptTouch, tp.state()), tp.position(), tp.scenePosition()));
event->setAccepted(acceptTouch);
}
void mousePressEvent(QMouseEvent *event)
{
qCDebug(lcPointerTests) << event;
- eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->pos(), event->windowPos()));
+ eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->position().toPoint(), event->scenePosition()));
event->setAccepted(acceptMouse);
}
void mouseMoveEvent(QMouseEvent *event)
{
qCDebug(lcPointerTests) << event;
- eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointMoved, grabTransition(acceptMouse, Qt::TouchPointMoved), event->pos(), event->windowPos()));
+ eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointMoved, grabTransition(acceptMouse, Qt::TouchPointMoved), event->position().toPoint(), event->scenePosition()));
event->setAccepted(acceptMouse);
}
void mouseReleaseEvent(QMouseEvent *event)
{
qCDebug(lcPointerTests) << event;
- eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointReleased, grabTransition(acceptMouse, Qt::TouchPointReleased), event->pos(), event->windowPos()));
+ eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointReleased, grabTransition(acceptMouse, Qt::TouchPointReleased), event->position().toPoint(), event->scenePosition()));
event->setAccepted(acceptMouse);
}
void mouseDoubleClickEvent(QMouseEvent *event)
{
qCDebug(lcPointerTests) << event;
- eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->pos(), event->windowPos()));
+ eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->position().toPoint(), event->scenePosition()));
event->setAccepted(acceptMouse);
}
@@ -162,7 +162,7 @@ public:
event->type() == QEvent::TouchEnd) {
QTouchEvent *touch = static_cast<QTouchEvent*>(event);
for (const QTouchEvent::TouchPoint &tp : touch->touchPoints())
- eventList.append(Event(Event::FilterDestination, event->type(), tp.state(), QQuickEventPoint::GrabExclusive, tp.pos(), tp.scenePos()));
+ eventList.append(Event(Event::FilterDestination, event->type(), tp.state(), QQuickEventPoint::GrabExclusive, tp.position(), tp.scenePosition()));
if (filterTouch)
event->accept();
return true;
@@ -265,7 +265,7 @@ protected:
}
QMouseEvent *me = static_cast<QMouseEvent*>(event);
filteredEventList.append(Event(Event::FilterDestination, event->type(), tpState,
- 0, me->pos(), me->globalPos()));
+ 0, me->position().toPoint(), me->globalPosition().toPoint()));
return false;
}
diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
index f1288c2dbe..8523d91e5c 100644
--- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
+++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
@@ -77,7 +77,7 @@ public:
void dragEnterEvent(QDragEnterEvent *event)
{
++enterEvents;
- position = event->pos();
+ position = event->position().toPoint();
defaultAction = event->dropAction();
proposedAction = event->proposedAction();
supportedActions = event->possibleActions();
@@ -87,7 +87,7 @@ public:
void dragMoveEvent(QDragMoveEvent *event)
{
++moveEvents;
- position = event->pos();
+ position = event->position().toPoint();
defaultAction = event->dropAction();
proposedAction = event->proposedAction();
supportedActions = event->possibleActions();
@@ -103,7 +103,7 @@ public:
void dropEvent(QDropEvent *event)
{
++dropEvents;
- position = event->pos();
+ position = event->position().toPoint();
defaultAction = event->dropAction();
proposedAction = event->proposedAction();
supportedActions = event->possibleActions();
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index f3659290eb..9f7cfa842e 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -119,7 +119,7 @@ protected:
}
touchPointStates << touchpoint.state();
++touchEvents;
- m_pos = touchpoint.pos();
+ m_pos = touchpoint.position();
emit posChanged();
}
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index abb5142304..77f183ad2a 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -1349,7 +1349,7 @@ void tst_qquickitem::touchEventAcceptIgnore()
QTouchEvent::TouchPoint point;
point.setId(1);
point.setPos(QPointF(50, 50));
- point.setScreenPos(point.pos());
+ point.setScreenPos(point.position());
point.setState(Qt::TouchPointPressed);
QTouchEvent event(QEvent::TouchBegin, device,
@@ -1373,7 +1373,7 @@ void tst_qquickitem::touchEventAcceptIgnore()
QTouchEvent::TouchPoint point;
point.setId(1);
point.setPos(QPointF(60, 60));
- point.setScreenPos(point.pos());
+ point.setScreenPos(point.position());
point.setState(Qt::TouchPointMoved);
QTouchEvent event(QEvent::TouchUpdate, device,
@@ -1397,7 +1397,7 @@ void tst_qquickitem::touchEventAcceptIgnore()
QTouchEvent::TouchPoint point;
point.setId(1);
point.setPos(QPointF(60, 60));
- point.setScreenPos(point.pos());
+ point.setScreenPos(point.position());
point.setState(Qt::TouchPointReleased);
QTouchEvent event(QEvent::TouchEnd, device,
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index f32f57614d..cd551c1837 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -68,7 +68,7 @@ static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p
tp.setLastPos(last);
tp.setScenePos(item->mapToScene(p));
tp.setLastScenePos(item->mapToScene(last));
- tp.setScreenPos(item->window()->mapToGlobal(tp.scenePos().toPoint()));
+ tp.setScreenPos(item->window()->mapToGlobal(tp.scenePosition().toPoint()));
tp.setLastScreenPos(item->window()->mapToGlobal(tp.lastScenePos().toPoint()));
return tp;
}
@@ -88,7 +88,7 @@ static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPoin
#define COMPARE_TOUCH_POINTS(tp1, tp2) \
{ \
- QCOMPARE(tp1.pos(), tp2.pos()); \
+ QCOMPARE(tp1.position(), tp2.pos()); \
QCOMPARE(tp1.lastPos(), tp2.lastPos()); \
QCOMPARE(tp1.scenePos(), tp2.scenePos()); \
QCOMPARE(tp1.lastScenePos(), tp2.lastScenePos()); \
@@ -214,7 +214,7 @@ public:
return;
}
mousePressCount = ++mousePressNum;
- lastMousePos = e->pos();
+ lastMousePos = e->position().toPoint();
lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
}
@@ -226,7 +226,7 @@ public:
mouseMoveCount = ++mouseMoveNum;
lastVelocityFromMouseMove = QGuiApplicationPrivate::mouseEventVelocity(e);
lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
- lastMousePos = e->pos();
+ lastMousePos = e->position().toPoint();
}
void mouseReleaseEvent(QMouseEvent *e) {
@@ -235,7 +235,7 @@ public:
return;
}
++mouseReleaseNum;
- lastMousePos = e->pos();
+ lastMousePos = e->position().toPoint();
lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
}
@@ -1024,15 +1024,15 @@ void tst_qquickwindow::touchEvent_velocity()
QMatrix4x4 transformMatrix;
transformMatrix.rotate(-90, 0, 0, 1); // counterclockwise
QVector2D transformedVelocity = transformMatrix.mapVector(velocity).toVector2D();
- points[0].setPos(points[0].pos() + QPointF(5, 5));
- points[0].setScreenPos(points[0].screenPos() + QPointF(5, 5));
+ points[0].setPos(points[0].position() + QPointF(5, 5));
+ points[0].setScreenPos(points[0].globalPosition() + QPointF(5, 5));
QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity,
QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
QCOMPARE(item->lastVelocity, transformedVelocity);
- QPoint itemLocalPos = item->mapFromScene(points[0].pos()).toPoint();
- QPoint itemLocalPosFromEvent = item->lastEvent.touchPoints[0].pos().toPoint();
+ QPoint itemLocalPos = item->mapFromScene(points[0].position()).toPoint();
+ QPoint itemLocalPosFromEvent = item->lastEvent.touchPoints[0].position().toPoint();
QCOMPARE(itemLocalPos, itemLocalPosFromEvent);
points[0].setState(Qt::TouchPointReleased);
@@ -1158,7 +1158,7 @@ void tst_qquickwindow::mouseFromTouch_basic()
QCOMPARE(item->mousePressNum, 1);
QCOMPARE(item->mouseMoveNum, 1);
QCOMPARE(item->mouseReleaseNum, 1);
- QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].pos()).toPoint());
+ QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].position()).toPoint());
QCOMPARE(item->lastVelocityFromMouseMove, velocity);
QVERIFY((item->lastMouseCapabilityFlags & QTouchDevice::Velocity) != 0);
@@ -1182,7 +1182,7 @@ void tst_qquickwindow::mouseFromTouch_basic()
QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window));
QGuiApplication::processEvents();
QQuickTouchUtils::flush(window);
- QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].pos()).toPoint());
+ QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].position()).toPoint());
QCOMPARE(item->lastVelocityFromMouseMove, transformedVelocity);
points[0].setState(Qt::TouchPointReleased);
@@ -2777,7 +2777,7 @@ public:
bool childMouseEventFilter(QQuickItem *item, QEvent *event) override
{
Q_UNUSED(item)
- if (event->type() == QEvent::MouseButtonPress && !contains(static_cast<QMouseEvent*>(event)->pos())) {
+ if (event->type() == QEvent::MouseButtonPress && !contains(static_cast<QMouseEvent*>(event)->position().toPoint())) {
// This is an evil hack: in case of items that are not rectangles, we never accept the event.
// Instead the events are now delivered to QDeclarativeGeoMapItemBase which doesn't to anything with them.
// The map below it still works since it filters events and steals the events at some point.
@@ -2861,8 +2861,8 @@ void tst_qquickwindow::pointerEventTypeAndPointCount()
// QVERIFY(!pe->asTabletEvent()); // TODO
QCOMPARE(pme.pointCount(), 1);
QCOMPARE(pme.point(0)->scenePosition(), scenePosition);
- QCOMPARE(pme.asMouseEvent(localPosition)->localPos(), localPosition);
- QCOMPARE(pme.asMouseEvent(localPosition)->screenPos(), screenPosition);
+ QCOMPARE(pme.asMouseEvent(localPosition)->position(), localPosition);
+ QCOMPARE(pme.asMouseEvent(localPosition)->globalPosition(), screenPosition);
QQuickPointerTouchEvent pte(nullptr, QQuickPointerDevice::touchDevice(touchDevice));
pte.reset(&te);
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 7fccb895db..b0d31e9121 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -109,22 +109,22 @@ public:
}
void mousePressEvent(QMouseEvent *event)
{
- eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ eventList.append(Event(event->type(), event->position().toPoint(), event->globalPosition().toPoint()));
event->setAccepted(acceptMouse);
}
void mouseMoveEvent(QMouseEvent *event)
{
- eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ eventList.append(Event(event->type(), event->position().toPoint(), event->globalPosition().toPoint()));
event->setAccepted(acceptMouse);
}
void mouseReleaseEvent(QMouseEvent *event)
{
- eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ eventList.append(Event(event->type(), event->position().toPoint(), event->globalPosition().toPoint()));
event->setAccepted(acceptMouse);
}
void mouseDoubleClickEvent(QMouseEvent *event)
{
- eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ eventList.append(Event(event->type(), event->position().toPoint(), event->globalPosition().toPoint()));
event->setAccepted(acceptMouse);
}
@@ -211,7 +211,7 @@ protected:
event->type() == QEvent::MouseMove ||
event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
- filteredEventList.append(Event(me->type(), me->pos(), me->globalPos()));
+ filteredEventList.append(Event(me->type(), me->position().toPoint(), me->globalPosition().toPoint()));
}
return false;
}
@@ -308,9 +308,9 @@ void tst_TouchMouse::simpleTouchEvent()
QPoint localPos = eventItem1->mapFromScene(p1).toPoint();
QPoint globalPos = window->mapToGlobal(p1);
QPoint scenePos = p1; // item is at 0,0
- QCOMPARE(eventItem1->eventList.at(0).points.at(0).pos().toPoint(), localPos);
- QCOMPARE(eventItem1->eventList.at(0).points.at(0).scenePos().toPoint(), scenePos);
- QCOMPARE(eventItem1->eventList.at(0).points.at(0).screenPos().toPoint(), globalPos);
+ QCOMPARE(eventItem1->eventList.at(0).points.at(0).position().toPoint(), localPos);
+ QCOMPARE(eventItem1->eventList.at(0).points.at(0).scenePosition().toPoint(), scenePos);
+ QCOMPARE(eventItem1->eventList.at(0).points.at(0).globalPosition().toPoint(), globalPos);
if (synthMouse) {
QCOMPARE(eventItem1->eventList.at(1).mousePos, localPos);
QCOMPARE(eventItem1->eventList.at(1).mousePosGlobal, globalPos);
diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp
index c1afbbb441..1426a1e107 100644
--- a/tools/qmleasing/splineeditor.cpp
+++ b/tools/qmleasing/splineeditor.cpp
@@ -206,12 +206,12 @@ void SplineEditor::paintEvent(QPaintEvent *)
void SplineEditor::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
- m_activeControlPoint = findControlPoint(e->pos());
+ m_activeControlPoint = findControlPoint(e->position().toPoint());
if (m_activeControlPoint != -1) {
mouseMoveEvent(e);
}
- m_mousePress = e->pos();
+ m_mousePress = e->position().toPoint();
e->accept();
}
}
@@ -612,10 +612,10 @@ QPointF limitToCanvas(const QPointF point)
void SplineEditor::mouseMoveEvent(QMouseEvent *e)
{
// If we've moved more then 25 pixels, assume user is dragging
- if (!m_mouseDrag && QPoint(m_mousePress - e->pos()).manhattanLength() > qApp->startDragDistance())
+ if (!m_mouseDrag && QPoint(m_mousePress - e->position().toPoint()).manhattanLength() > qApp->startDragDistance())
m_mouseDrag = true;
- QPointF p = mapFromCanvas(e->pos());
+ QPointF p = mapFromCanvas(e->position().toPoint());
if (m_mouseDrag && m_activeControlPoint >= 0 && m_activeControlPoint < m_controlPoints.size()) {
p = limitToCanvas(p);