aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-08 09:37:59 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-11 18:52:07 +0000
commite481f1c414d7c243efabe4215b1865c616d25ce0 (patch)
treec6e577950cdebf7d4cf476062ab34407fafa0dc2 /src
parent040c29bb91653a2adfa16a33781b3a2f7c29152d (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/qtquickcontrols2 $ find . -name "*.clazy.yaml" $ clang-apply-replacements . Task-number: QTBUG-20885 Task-number: QTBUG-84775 Change-Id: I7fb9b0603341ea1a0c3a00f79ebd642a6354702d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp4
-rw-r--r--src/quicktemplates2/qquickpopup.cpp14
-rw-r--r--src/quicktemplates2/qquickpresshandler.cpp6
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp16
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp2
-rw-r--r--src/quicktemplates2/qquickslider.cpp12
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp4
-rw-r--r--src/quicktemplates2/qquicksplitview.cpp2
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp16
-rw-r--r--src/quicktemplates2/qquickswitch.cpp6
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp6
11 files changed, 44 insertions, 44 deletions
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index ac496ec8..5cb1ab0b 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -194,7 +194,7 @@ bool QQuickOverlayPrivate::handleMouseEvent(QQuickItem *source, QMouseEvent *eve
{
switch (event->type()) {
case QEvent::MouseButtonPress:
- if (!target && startDrag(event, event->windowPos()))
+ if (!target && startDrag(event, event->scenePosition()))
return true;
return handlePress(source, event, target);
case QEvent::MouseMove:
@@ -218,7 +218,7 @@ bool QQuickOverlayPrivate::handleTouchEvent(QQuickItem *source, QTouchEvent *eve
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
switch (point.state()) {
case Qt::TouchPointPressed:
- if (!target && startDrag(event, point.scenePos()))
+ if (!target && startDrag(event, point.scenePosition()))
handled = true;
else
handled |= handlePress(source, event, target);
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index bafa3110..1d6f125e 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -372,11 +372,11 @@ bool QQuickPopupPrivate::handleMouseEvent(QQuickItem *item, QMouseEvent *event)
{
switch (event->type()) {
case QEvent::MouseButtonPress:
- return handlePress(item, event->windowPos(), event->timestamp());
+ return handlePress(item, event->scenePosition(), event->timestamp());
case QEvent::MouseMove:
- return handleMove(item, event->windowPos(), event->timestamp());
+ return handleMove(item, event->scenePosition(), event->timestamp());
case QEvent::MouseButtonRelease:
- return handleRelease(item, event->windowPos(), event->timestamp());
+ return handleRelease(item, event->scenePosition(), event->timestamp());
default:
Q_UNREACHABLE();
return false;
@@ -392,15 +392,15 @@ bool QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event)
case QEvent::TouchEnd:
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
if (!acceptTouch(point))
- return blockInput(item, point.pos());
+ return blockInput(item, point.position());
switch (point.state()) {
case Qt::TouchPointPressed:
- return handlePress(item, item->mapToScene(point.pos()), event->timestamp());
+ return handlePress(item, item->mapToScene(point.position()), event->timestamp());
case Qt::TouchPointMoved:
- return handleMove(item, item->mapToScene(point.pos()), event->timestamp());
+ return handleMove(item, item->mapToScene(point.position()), event->timestamp());
case Qt::TouchPointReleased:
- return handleRelease(item, item->mapToScene(point.pos()), event->timestamp());
+ return handleRelease(item, item->mapToScene(point.position()), event->timestamp());
default:
break;
}
diff --git a/src/quicktemplates2/qquickpresshandler.cpp b/src/quicktemplates2/qquickpresshandler.cpp
index b9018573..7bb8eb89 100644
--- a/src/quicktemplates2/qquickpresshandler.cpp
+++ b/src/quicktemplates2/qquickpresshandler.cpp
@@ -49,10 +49,10 @@ QT_BEGIN_NAMESPACE
void QQuickPressHandler::mousePressEvent(QMouseEvent *event)
{
longPress = false;
- pressPos = event->localPos();
+ pressPos = event->position();
if (Qt::LeftButton == (event->buttons() & Qt::LeftButton)) {
timer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), control);
- delayedMousePressEvent = new QMouseEvent(event->type(), event->pos(), event->button(), event->buttons(), event->modifiers());
+ delayedMousePressEvent = new QMouseEvent(event->type(), event->position().toPoint(), event->button(), event->buttons(), event->modifiers());
} else {
timer.stop();
}
@@ -71,7 +71,7 @@ void QQuickPressHandler::mousePressEvent(QMouseEvent *event)
void QQuickPressHandler::mouseMoveEvent(QMouseEvent *event)
{
- if (qAbs(int(event->localPos().x() - pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
+ if (qAbs(int(event->position().x() - pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
timer.stop();
}
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 9ad12102..2b0f2961 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -1151,14 +1151,14 @@ void QQuickRangeSlider::hoverEnterEvent(QHoverEvent *event)
{
Q_D(QQuickRangeSlider);
QQuickControl::hoverEnterEvent(event);
- d->updateHover(event->posF());
+ d->updateHover(event->position());
}
void QQuickRangeSlider::hoverMoveEvent(QHoverEvent *event)
{
Q_D(QQuickRangeSlider);
QQuickControl::hoverMoveEvent(event);
- d->updateHover(event->posF());
+ d->updateHover(event->position());
}
void QQuickRangeSlider::hoverLeaveEvent(QHoverEvent *event)
@@ -1181,7 +1181,7 @@ void QQuickRangeSlider::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickRangeSlider);
QQuickControl::mousePressEvent(event);
- d->handleMove(event->localPos());
+ d->handleMove(event->position());
setKeepMouseGrab(true);
}
@@ -1197,20 +1197,20 @@ void QQuickRangeSlider::touchEvent(QTouchEvent *event)
switch (point.state()) {
case Qt::TouchPointPressed:
- d->handlePress(point.pos());
+ d->handlePress(point.position());
break;
case Qt::TouchPointMoved:
if (!keepTouchGrab()) {
if (d->orientation == Qt::Horizontal)
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - point.startPos().x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - point.pressPosition().x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
else
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - point.startPos().y(), Qt::YAxis, &point, qRound(d->touchDragThreshold)));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().y() - point.pressPosition().y(), Qt::YAxis, &point, qRound(d->touchDragThreshold)));
}
if (keepTouchGrab())
- d->handleMove(point.pos());
+ d->handleMove(point.position());
break;
case Qt::TouchPointReleased:
- d->handleRelease(point.pos());
+ d->handleRelease(point.position());
break;
default:
break;
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 678b7942..b352224c 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -710,7 +710,7 @@ void QQuickScrollBar::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickScrollBar);
QQuickControl::mousePressEvent(event);
- d->handleMove(event->localPos());
+ d->handleMove(event->position());
}
#if QT_CONFIG(quicktemplates2_hover)
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index f4a459fa..9d223f25 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -790,7 +790,7 @@ void QQuickSlider::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickSlider);
QQuickControl::mousePressEvent(event);
- d->handleMove(event->localPos());
+ d->handleMove(event->position());
setKeepMouseGrab(true);
}
@@ -806,20 +806,20 @@ void QQuickSlider::touchEvent(QTouchEvent *event)
switch (point.state()) {
case Qt::TouchPointPressed:
- d->handlePress(point.pos());
+ d->handlePress(point.position());
break;
case Qt::TouchPointMoved:
if (!keepTouchGrab()) {
if (d->orientation == Qt::Horizontal)
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - d->pressPoint.x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
else
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point, qRound(d->touchDragThreshold)));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().y() - d->pressPoint.y(), Qt::YAxis, &point, qRound(d->touchDragThreshold)));
}
if (keepTouchGrab())
- d->handleMove(point.pos());
+ d->handleMove(point.position());
break;
case Qt::TouchPointReleased:
- d->handleRelease(point.pos());
+ d->handleRelease(point.position());
break;
default:
break;
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index 687ccafd..c1541a99 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -891,14 +891,14 @@ void QQuickSpinBox::hoverEnterEvent(QHoverEvent *event)
{
Q_D(QQuickSpinBox);
QQuickControl::hoverEnterEvent(event);
- d->updateHover(event->posF());
+ d->updateHover(event->position());
}
void QQuickSpinBox::hoverMoveEvent(QHoverEvent *event)
{
Q_D(QQuickSpinBox);
QQuickControl::hoverMoveEvent(event);
- d->updateHover(event->posF());
+ d->updateHover(event->position());
}
void QQuickSpinBox::hoverLeaveEvent(QHoverEvent *event)
diff --git a/src/quicktemplates2/qquicksplitview.cpp b/src/quicktemplates2/qquicksplitview.cpp
index a1016792..33e907d6 100644
--- a/src/quicktemplates2/qquicksplitview.cpp
+++ b/src/quicktemplates2/qquicksplitview.cpp
@@ -1389,7 +1389,7 @@ void QQuickSplitView::hoverMoveEvent(QHoverEvent *event)
Q_D(QQuickSplitView);
QQuickContainer::hoverMoveEvent(event);
- QQuickItem *hoveredItem = childAt(event->pos().x(), event->pos().y());
+ QQuickItem *hoveredItem = childAt(event->position().toPoint().x(), event->position().toPoint().y());
d->updateHoveredHandle(hoveredItem);
}
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 8c8d8c6e..a28d8ecf 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -720,7 +720,7 @@ bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseE
// The press point could be incorrect if the press happened over a child item,
// so we correct it after calling the base class' mousePressEvent(), rather
// than having to duplicate its code just so we can set the pressPoint.
- setPressPoint(item->mapToItem(q, event->pos()));
+ setPressPoint(item->mapToItem(q, event->position().toPoint()));
return true;
}
@@ -728,8 +728,8 @@ bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseE
// (the control can be clicked to e.g. close the swipe). Either way, we must begin measuring
// mouse movement in case it turns into a swipe, in which case we grab the mouse.
swipePrivate->positionBeforePress = swipePrivate->position;
- swipePrivate->velocityCalculator.startMeasuring(event->pos(), event->timestamp());
- setPressPoint(item->mapToItem(q, event->pos()));
+ swipePrivate->velocityCalculator.startMeasuring(event->position().toPoint(), event->timestamp());
+ setPressPoint(item->mapToItem(q, event->position().toPoint()));
// When a delegate uses the attached properties and signals, it declares that it wants mouse events.
Attached *attached = attachedObject(item);
@@ -748,7 +748,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
Q_Q(QQuickSwipeDelegate);
if (holdTimer > 0) {
- if (QLineF(pressPoint, event->localPos()).length() > QGuiApplication::styleHints()->startDragDistance())
+ if (QLineF(pressPoint, event->position()).length() > QGuiApplication::styleHints()->startDragDistance())
stopPressAndHold();
}
@@ -770,7 +770,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
if (item == q && !pressed)
return false;
- const QPointF mappedEventPos = item->mapToItem(q, event->pos());
+ const QPointF mappedEventPos = item->mapToItem(q, event->position().toPoint());
const qreal distance = (mappedEventPos - pressPoint).x();
if (!q->keepMouseGrab()) {
// Taken from QQuickDrawerPrivate::grabMouse; see comments there.
@@ -840,7 +840,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
}
} else {
// The swipe wasn't initiated.
- if (event->pos().y() < 0 || event->pos().y() > height) {
+ if (event->position().toPoint().y() < 0 || event->position().toPoint().y() > height) {
// The mouse went outside the vertical bounds of the control, so
// we should no longer consider it pressed.
q->setPressed(false);
@@ -858,7 +858,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *item, QMous
{
Q_Q(QQuickSwipeDelegate);
QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
- swipePrivate->velocityCalculator.stopMeasuring(event->pos(), event->timestamp());
+ swipePrivate->velocityCalculator.stopMeasuring(event->position().toPoint(), event->timestamp());
const bool hadGrabbedMouse = q->keepMouseGrab();
q->setKeepMouseGrab(false);
@@ -1180,7 +1180,7 @@ void QQuickSwipeDelegate::mousePressEvent(QMouseEvent *event)
return;
swipePrivate->positionBeforePress = swipePrivate->position;
- swipePrivate->velocityCalculator.startMeasuring(event->pos(), event->timestamp());
+ swipePrivate->velocityCalculator.startMeasuring(event->position().toPoint(), event->timestamp());
}
void QQuickSwipeDelegate::mouseMoveEvent(QMouseEvent *event)
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp
index 08ea44da..2bba350d 100644
--- a/src/quicktemplates2/qquickswitch.cpp
+++ b/src/quicktemplates2/qquickswitch.cpp
@@ -180,7 +180,7 @@ void QQuickSwitch::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QQuickSwitch);
if (!keepMouseGrab()) {
- const QPointF movePoint = event->localPos();
+ const QPointF movePoint = event->position();
if (d->canDrag(movePoint))
setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(movePoint.x() - d->pressPoint.x(), Qt::XAxis, event));
}
@@ -195,8 +195,8 @@ void QQuickSwitch::touchEvent(QTouchEvent *event)
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
if (point.id() != d->touchId || point.state() != Qt::TouchPointMoved)
continue;
- if (d->canDrag(point.pos()))
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point));
+ if (d->canDrag(point.position()))
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - d->pressPoint.x(), Qt::XAxis, &point));
}
}
QQuickAbstractButton::touchEvent(event);
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
index d0e3afc8..3300e252 100644
--- a/src/quicktemplates2/qquickswitchdelegate.cpp
+++ b/src/quicktemplates2/qquickswitchdelegate.cpp
@@ -177,7 +177,7 @@ void QQuickSwitchDelegate::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QQuickSwitchDelegate);
if (!keepMouseGrab()) {
- const QPointF movePoint = event->localPos();
+ const QPointF movePoint = event->position();
if (d->canDrag(movePoint))
setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(movePoint.x() - d->pressPoint.x(), Qt::XAxis, event));
}
@@ -192,8 +192,8 @@ void QQuickSwitchDelegate::touchEvent(QTouchEvent *event)
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
if (point.id() != d->touchId || point.state() != Qt::TouchPointMoved)
continue;
- if (d->canDrag(point.pos()))
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point));
+ if (d->canDrag(point.position()))
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - d->pressPoint.x(), Qt::XAxis, &point));
}
}
QQuickItemDelegate::touchEvent(event);