summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-04 18:07:06 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-08 19:11:51 +0200
commita061a646429c6e9d695458fc0ecb0021a30e12ee (patch)
tree7ba6fce7ee7c8975b0c50e31195bd02c5419fc15
parent24e52c10deedbaef833c0e2c3ee7bee03eacc4f5 (diff)
Replace calls to deprecated QEvent accessor functions
Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp8
-rw-r--r--examples/embedded/flickable/flickable.cpp14
-rw-r--r--examples/embedded/flickable/main.cpp2
-rw-r--r--examples/embedded/lightmaps/lightmaps.cpp10
-rw-r--r--examples/embedded/raycasting/raycasting.cpp8
-rw-r--r--examples/opengl/cube/mainwidget.cpp4
-rw-r--r--examples/opengl/hellogl2/glwidget.cpp8
-rw-r--r--examples/opengl/textures/glwidget.cpp8
-rw-r--r--examples/qpa/windows/window.cpp8
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.cpp2
-rw-r--r--examples/sql/books/bookdelegate.cpp2
-rw-r--r--examples/sql/drilldown/view.cpp2
-rw-r--r--examples/vulkan/hellovulkancubes/vulkanwindow.cpp8
-rw-r--r--examples/widgets/draganddrop/draggableicons/dragwidget.cpp8
-rw-r--r--examples/widgets/draganddrop/draggabletext/dragwidget.cpp6
-rw-r--r--examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp8
-rw-r--r--examples/widgets/draganddrop/puzzle/puzzlewidget.cpp16
-rw-r--r--examples/widgets/effects/blurpicker/blurpicker.cpp2
-rw-r--r--examples/widgets/itemviews/chart/pieview.cpp4
-rw-r--r--examples/widgets/itemviews/puzzle/puzzlewidget.cpp16
-rw-r--r--examples/widgets/itemviews/stardelegate/stareditor.cpp2
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.cpp2
-rw-r--r--examples/widgets/painting/deform/pathdeform.cpp12
-rw-r--r--examples/widgets/painting/pathstroke/pathstroke.cpp16
-rw-r--r--examples/widgets/painting/shared/hoverpoints.cpp12
-rw-r--r--examples/widgets/tools/plugandpaint/app/paintarea.cpp12
-rw-r--r--examples/widgets/tools/undo/document.cpp12
-rw-r--r--examples/widgets/touch/fingerpaint/scribblearea.cpp4
-rw-r--r--examples/widgets/touch/knobs/knob.cpp2
-rw-r--r--examples/widgets/touch/pinchzoom/graphicsview.cpp4
-rw-r--r--examples/widgets/widgets/charactermap/characterwidget.cpp6
-rw-r--r--examples/widgets/widgets/scribble/scribblearea.cpp6
-rw-r--r--examples/widgets/widgets/shapedclock/shapedclock.cpp4
-rw-r--r--examples/widgets/widgets/tablet/tabletcanvas.cpp16
-rw-r--r--examples/widgets/widgets/tooltips/sortingbox.cpp8
-rw-r--r--examples/widgets/windowcontainer/windowcontainer.cpp6
-rw-r--r--src/gui/kernel/qevent.cpp24
-rw-r--r--src/gui/kernel/qguiapplication.cpp36
-rw-r--r--src/gui/kernel/qsimpledrag.cpp10
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp2
-rw-r--r--src/platformsupport/fbconvenience/qfbcursor.cpp2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp2
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp28
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp16
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp38
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp26
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip.cpp4
-rw-r--r--src/widgets/itemviews/qheaderview.cpp16
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qlistview.cpp24
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp22
-rw-r--r--src/widgets/kernel/qapplication.cpp48
-rw-r--r--src/widgets/kernel/qmacgesturerecognizer.cpp12
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp60
-rw-r--r--src/widgets/kernel/qtooltip.cpp4
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp14
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp66
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp2
-rw-r--r--src/widgets/util/qflickgesture.cpp26
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp2
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp8
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp6
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp4
-rw-r--r--src/widgets/widgets/qcheckbox.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp14
-rw-r--r--src/widgets/widgets/qcombobox_p.h4
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp4
-rw-r--r--src/widgets/widgets/qdial.cpp6
-rw-r--r--src/widgets/widgets/qdockwidget.cpp16
-rw-r--r--src/widgets/widgets/qgroupbox.cpp8
-rw-r--r--src/widgets/widgets/qlineedit.cpp28
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp4
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h10
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp24
-rw-r--r--src/widgets/widgets/qmenu.cpp26
-rw-r--r--src/widgets/widgets/qmenubar.cpp8
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp6
-rw-r--r--src/widgets/widgets/qradiobutton.cpp2
-rw-r--r--src/widgets/widgets/qscrollbar.cpp18
-rw-r--r--src/widgets/widgets/qsizegrip.cpp4
-rw-r--r--src/widgets/widgets/qslider.cpp12
-rw-r--r--src/widgets/widgets/qsplitter.cpp6
-rw-r--r--src/widgets/widgets/qtabbar.cpp22
-rw-r--r--src/widgets/widgets/qtextedit.cpp6
-rw-r--r--src/widgets/widgets/qtoolbar.cpp18
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp4
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp8
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp20
-rw-r--r--tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp12
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp390
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp10
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp4
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp4
99 files changed, 742 insertions, 742 deletions
diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
index f47c9c8a8b..9eda882347 100644
--- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
+++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
@@ -190,7 +190,7 @@ void MandelbrotWidget::wheelEvent(QWheelEvent *event)
void MandelbrotWidget::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
- lastDragPos = event->pos();
+ lastDragPos = event->position().toPoint();
}
//! [13]
@@ -198,8 +198,8 @@ void MandelbrotWidget::mousePressEvent(QMouseEvent *event)
void MandelbrotWidget::mouseMoveEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::LeftButton) {
- pixmapOffset += event->pos() - lastDragPos;
- lastDragPos = event->pos();
+ pixmapOffset += event->position().toPoint() - lastDragPos;
+ lastDragPos = event->position().toPoint();
update();
}
}
@@ -209,7 +209,7 @@ void MandelbrotWidget::mouseMoveEvent(QMouseEvent *event)
void MandelbrotWidget::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- pixmapOffset += event->pos() - lastDragPos;
+ pixmapOffset += event->position().toPoint() - lastDragPos;
lastDragPos = QPoint();
const auto pixmapSize = pixmap.size() / pixmap.devicePixelRatioF();
diff --git a/examples/embedded/flickable/flickable.cpp b/examples/embedded/flickable/flickable.cpp
index c57ec3d111..15c1873e53 100644
--- a/examples/embedded/flickable/flickable.cpp
+++ b/examples/embedded/flickable/flickable.cpp
@@ -158,14 +158,14 @@ void Flickable::handleMousePress(QMouseEvent *event)
case FlickablePrivate::Steady:
event->accept();
d->state = FlickablePrivate::Pressed;
- d->pressPos = event->pos();
+ d->pressPos = event->position().toPoint();
break;
case FlickablePrivate::AutoScroll:
event->accept();
d->state = FlickablePrivate::Stop;
d->speed = QPoint(0, 0);
- d->pressPos = event->pos();
+ d->pressPos = event->position().toPoint();
d->offset = scrollOffset();
d->ticker->stop();
break;
@@ -206,14 +206,14 @@ void Flickable::handleMouseRelease(QMouseEvent *event)
case FlickablePrivate::ManualScroll:
event->accept();
- delta = event->pos() - d->pressPos;
+ delta = event->position().toPoint() - d->pressPos;
if (d->timeStamp.elapsed() > 100) {
d->timeStamp.start();
d->speed = delta - d->delta;
d->delta = delta;
}
d->offset = scrollOffset();
- d->pressPos = event->pos();
+ d->pressPos = event->position().toPoint();
if (d->speed == QPoint(0, 0)) {
d->state = FlickablePrivate::Steady;
} else {
@@ -250,20 +250,20 @@ void Flickable::handleMouseMove(QMouseEvent *event)
case FlickablePrivate::Pressed:
case FlickablePrivate::Stop:
- delta = event->pos() - d->pressPos;
+ delta = event->position().toPoint() - d->pressPos;
if (delta.x() > d->threshold || delta.x() < -d->threshold ||
delta.y() > d->threshold || delta.y() < -d->threshold) {
d->timeStamp.start();
d->state = FlickablePrivate::ManualScroll;
d->delta = QPoint(0, 0);
- d->pressPos = event->pos();
+ d->pressPos = event->position().toPoint();
event->accept();
}
break;
case FlickablePrivate::ManualScroll:
event->accept();
- delta = event->pos() - d->pressPos;
+ delta = event->position().toPoint() - d->pressPos;
setScrollOffset(d->offset - delta);
if (d->timeStamp.elapsed() > 100) {
d->timeStamp.start();
diff --git a/examples/embedded/flickable/main.cpp b/examples/embedded/flickable/main.cpp
index 9367c8b4fe..973154331d 100644
--- a/examples/embedded/flickable/main.cpp
+++ b/examples/embedded/flickable/main.cpp
@@ -185,7 +185,7 @@ protected:
return;
if (event->button() == Qt::LeftButton) {
- int y = event->pos().y() + m_offset;
+ int y = event->position().toPoint().y() + m_offset;
int i = y / m_height;
if (i != m_highlight) {
m_highlight = i;
diff --git a/examples/embedded/lightmaps/lightmaps.cpp b/examples/embedded/lightmaps/lightmaps.cpp
index 6334530c3a..8ad3035016 100644
--- a/examples/embedded/lightmaps/lightmaps.cpp
+++ b/examples/embedded/lightmaps/lightmaps.cpp
@@ -209,7 +209,7 @@ void LightMaps::mousePressEvent(QMouseEvent *event)
if (event->buttons() != Qt::LeftButton)
return;
pressed = snapped = true;
- pressPos = dragPos = event->pos();
+ pressPos = dragPos = event->position().toPoint();
tapTimer.stop();
tapTimer.start(HOLD_TIME, this);
}
@@ -220,13 +220,13 @@ void LightMaps::mouseMoveEvent(QMouseEvent *event)
return;
if (!zoomed) {
if (!pressed || !snapped) {
- QPoint delta = event->pos() - pressPos;
- pressPos = event->pos();
+ QPoint delta = event->position().toPoint() - pressPos;
+ pressPos = event->position().toPoint();
m_normalMap->pan(delta);
return;
} else {
const int threshold = 10;
- QPoint delta = event->pos() - pressPos;
+ QPoint delta = event->position().toPoint() - pressPos;
if (snapped) {
snapped &= delta.x() < threshold;
snapped &= delta.y() < threshold;
@@ -237,7 +237,7 @@ void LightMaps::mouseMoveEvent(QMouseEvent *event)
tapTimer.stop();
}
} else {
- dragPos = event->pos();
+ dragPos = event->position().toPoint();
update();
}
}
diff --git a/examples/embedded/raycasting/raycasting.cpp b/examples/embedded/raycasting/raycasting.cpp
index c0a1e48fa6..19e3c8b271 100644
--- a/examples/embedded/raycasting/raycasting.cpp
+++ b/examples/embedded/raycasting/raycasting.cpp
@@ -336,15 +336,15 @@ protected:
}
void mousePressEvent(QMouseEvent *event) {
- qreal dx = centerPad.x() - event->pos().x();
- qreal dy = centerPad.y() - event->pos().y();
+ qreal dx = centerPad.x() - event->position().toPoint().x();
+ qreal dy = centerPad.y() - event->position().toPoint().y();
angleDelta = dx * 2 * M_PI / width();
moveDelta = dy * 10 / height();
}
void mouseMoveEvent(QMouseEvent *event) {
- qreal dx = centerPad.x() - event->pos().x();
- qreal dy = centerPad.y() - event->pos().y();
+ qreal dx = centerPad.x() - event->position().toPoint().x();
+ qreal dy = centerPad.y() - event->position().toPoint().y();
angleDelta = dx * 2 * M_PI / width();
moveDelta = dy * 10 / height();
}
diff --git a/examples/opengl/cube/mainwidget.cpp b/examples/opengl/cube/mainwidget.cpp
index 558ecd1299..0b44ecfcea 100644
--- a/examples/opengl/cube/mainwidget.cpp
+++ b/examples/opengl/cube/mainwidget.cpp
@@ -68,13 +68,13 @@ MainWidget::~MainWidget()
void MainWidget::mousePressEvent(QMouseEvent *e)
{
// Save mouse press position
- mousePressPosition = QVector2D(e->localPos());
+ mousePressPosition = QVector2D(e->position());
}
void MainWidget::mouseReleaseEvent(QMouseEvent *e)
{
// Mouse release position - mouse press position
- QVector2D diff = QVector2D(e->localPos()) - mousePressPosition;
+ QVector2D diff = QVector2D(e->position()) - mousePressPosition;
// Rotation axis is perpendicular to the mouse position difference
// vector
diff --git a/examples/opengl/hellogl2/glwidget.cpp b/examples/opengl/hellogl2/glwidget.cpp
index 543e70f8ac..9988902071 100644
--- a/examples/opengl/hellogl2/glwidget.cpp
+++ b/examples/opengl/hellogl2/glwidget.cpp
@@ -284,13 +284,13 @@ void GLWidget::resizeGL(int w, int h)
void GLWidget::mousePressEvent(QMouseEvent *event)
{
- m_lastPos = event->pos();
+ m_lastPos = event->position().toPoint();
}
void GLWidget::mouseMoveEvent(QMouseEvent *event)
{
- int dx = event->x() - m_lastPos.x();
- int dy = event->y() - m_lastPos.y();
+ int dx = event->position().toPoint().x() - m_lastPos.x();
+ int dy = event->position().toPoint().y() - m_lastPos.y();
if (event->buttons() & Qt::LeftButton) {
setXRotation(m_xRot + 8 * dy);
@@ -299,5 +299,5 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event)
setXRotation(m_xRot + 8 * dy);
setZRotation(m_zRot + 8 * dx);
}
- m_lastPos = event->pos();
+ m_lastPos = event->position().toPoint();
}
diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp
index 307190f308..be5a46e532 100644
--- a/examples/opengl/textures/glwidget.cpp
+++ b/examples/opengl/textures/glwidget.cpp
@@ -164,20 +164,20 @@ void GLWidget::resizeGL(int width, int height)
void GLWidget::mousePressEvent(QMouseEvent *event)
{
- lastPos = event->pos();
+ lastPos = event->position().toPoint();
}
void GLWidget::mouseMoveEvent(QMouseEvent *event)
{
- int dx = event->x() - lastPos.x();
- int dy = event->y() - lastPos.y();
+ int dx = event->position().toPoint().x() - lastPos.x();
+ int dy = event->position().toPoint().y() - lastPos.y();
if (event->buttons() & Qt::LeftButton) {
rotateBy(8 * dy, 8 * dx, 0);
} else if (event->buttons() & Qt::RightButton) {
rotateBy(8 * dy, 0, 8 * dx);
}
- lastPos = event->pos();
+ lastPos = event->position().toPoint();
}
void GLWidget::mouseReleaseEvent(QMouseEvent * /* event */)
diff --git a/examples/qpa/windows/window.cpp b/examples/qpa/windows/window.cpp
index 2a5f81a3a1..b4e4cf05f7 100644
--- a/examples/qpa/windows/window.cpp
+++ b/examples/qpa/windows/window.cpp
@@ -106,7 +106,7 @@ void Window::initialize()
void Window::mousePressEvent(QMouseEvent *event)
{
- m_lastPos = event->pos();
+ m_lastPos = event->position().toPoint();
}
void Window::mouseMoveEvent(QMouseEvent *event)
@@ -114,8 +114,8 @@ void Window::mouseMoveEvent(QMouseEvent *event)
if (m_lastPos != QPoint(-1, -1)) {
QPainter p(&m_image);
p.setRenderHint(QPainter::Antialiasing);
- p.drawLine(m_lastPos, event->pos());
- m_lastPos = event->pos();
+ p.drawLine(m_lastPos, event->position().toPoint());
+ m_lastPos = event->position().toPoint();
scheduleRender();
}
@@ -126,7 +126,7 @@ void Window::mouseReleaseEvent(QMouseEvent *event)
if (m_lastPos != QPoint(-1, -1)) {
QPainter p(&m_image);
p.setRenderHint(QPainter::Antialiasing);
- p.drawLine(m_lastPos, event->pos());
+ p.drawLine(m_lastPos, event->position().toPoint());
m_lastPos = QPoint(-1, -1);
scheduleRender();
diff --git a/examples/qtconcurrent/imagescaling/imagescaling.cpp b/examples/qtconcurrent/imagescaling/imagescaling.cpp
index 6d22bb9598..ae03907c79 100644
--- a/examples/qtconcurrent/imagescaling/imagescaling.cpp
+++ b/examples/qtconcurrent/imagescaling/imagescaling.cpp
@@ -127,7 +127,7 @@ void Images::open()
}
}
- std::function<QImage(const QString&)> scale = [imageSize](const QString &imageFileName) {
+ std::function<QImage(const QString&)> scale = [](const QString &imageFileName) {
QImage image(imageFileName);
return image.scaled(QSize(imageSize, imageSize), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
};
diff --git a/examples/sql/books/bookdelegate.cpp b/examples/sql/books/bookdelegate.cpp
index 4115f80cf3..00bdd1708a 100644
--- a/examples/sql/books/bookdelegate.cpp
+++ b/examples/sql/books/bookdelegate.cpp
@@ -116,7 +116,7 @@ bool BookDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
- int stars = qBound(0, int(0.7 + qreal(mouseEvent->pos().x()
+ int stars = qBound(0, int(0.7 + qreal(mouseEvent->position().toPoint().x()
- option.rect.x()) / star.width()), 5);
model->setData(index, QVariant(stars));
// So that the selection can change:
diff --git a/examples/sql/drilldown/view.cpp b/examples/sql/drilldown/view.cpp
index 13e9310061..9f19668946 100644
--- a/examples/sql/drilldown/view.cpp
+++ b/examples/sql/drilldown/view.cpp
@@ -115,7 +115,7 @@ void View::addItems()
//! [5]
void View::mouseReleaseEvent(QMouseEvent *event)
{
- if (QGraphicsItem *item = itemAt(event->pos())) {
+ if (QGraphicsItem *item = itemAt(event->position().toPoint())) {
if (ImageItem *image = qgraphicsitem_cast<ImageItem *>(item))
showInformation(image);
}
diff --git a/examples/vulkan/hellovulkancubes/vulkanwindow.cpp b/examples/vulkan/hellovulkancubes/vulkanwindow.cpp
index 9a4eaf1901..3440713737 100644
--- a/examples/vulkan/hellovulkancubes/vulkanwindow.cpp
+++ b/examples/vulkan/hellovulkancubes/vulkanwindow.cpp
@@ -82,7 +82,7 @@ void VulkanWindow::meshSwitched(bool enable)
void VulkanWindow::mousePressEvent(QMouseEvent *e)
{
m_pressed = true;
- m_lastPos = e->pos();
+ m_lastPos = e->position().toPoint();
}
void VulkanWindow::mouseReleaseEvent(QMouseEvent *)
@@ -95,8 +95,8 @@ void VulkanWindow::mouseMoveEvent(QMouseEvent *e)
if (!m_pressed)
return;
- int dx = e->pos().x() - m_lastPos.x();
- int dy = e->pos().y() - m_lastPos.y();
+ int dx = e->position().toPoint().x() - m_lastPos.x();
+ int dy = e->position().toPoint().y() - m_lastPos.y();
if (dy)
m_renderer->pitch(dy / 10.0f);
@@ -104,7 +104,7 @@ void VulkanWindow::mouseMoveEvent(QMouseEvent *e)
if (dx)
m_renderer->yaw(dx / 10.0f);
- m_lastPos = e->pos();
+ m_lastPos = e->position().toPoint();
}
void VulkanWindow::keyPressEvent(QKeyEvent *e)
diff --git a/examples/widgets/draganddrop/draggableicons/dragwidget.cpp b/examples/widgets/draganddrop/draggableicons/dragwidget.cpp
index 00671dcf7e..1b3774db4f 100644
--- a/examples/widgets/draganddrop/draggableicons/dragwidget.cpp
+++ b/examples/widgets/draganddrop/draggableicons/dragwidget.cpp
@@ -120,7 +120,7 @@ void DragWidget::dropEvent(QDropEvent *event)
QLabel *newIcon = new QLabel(this);
newIcon->setPixmap(pixmap);
- newIcon->move(event->pos() - offset);
+ newIcon->move(event->position().toPoint() - offset);
newIcon->show();
newIcon->setAttribute(Qt::WA_DeleteOnClose);
@@ -138,7 +138,7 @@ void DragWidget::dropEvent(QDropEvent *event)
//! [1]
void DragWidget::mousePressEvent(QMouseEvent *event)
{
- QLabel *child = static_cast<QLabel*>(childAt(event->pos()));
+ QLabel *child = static_cast<QLabel*>(childAt(event->position().toPoint()));
if (!child)
return;
@@ -146,7 +146,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
- dataStream << pixmap << QPoint(event->pos() - child->pos());
+ dataStream << pixmap << QPoint(event->position().toPoint() - child->pos());
//! [1]
//! [2]
@@ -158,7 +158,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setPixmap(pixmap);
- drag->setHotSpot(event->pos() - child->pos());
+ drag->setHotSpot(event->position().toPoint() - child->pos());
//! [3]
QPixmap tempPixmap = pixmap;
diff --git a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
index 4a430ebf56..1f1889c7cf 100644
--- a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
+++ b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
@@ -114,7 +114,7 @@ void DragWidget::dropEvent(QDropEvent *event)
const QMimeData *mime = event->mimeData();
QStringList pieces = mime->text().split(QRegularExpression(QStringLiteral("\\s+")),
Qt::SkipEmptyParts);
- QPoint position = event->pos();
+ QPoint position = event->position().toPoint();
QPoint hotSpot;
QByteArrayList hotSpotPos = mime->data(hotSpotMimeDataKey()).split(' ');
@@ -149,11 +149,11 @@ void DragWidget::dropEvent(QDropEvent *event)
void DragWidget::mousePressEvent(QMouseEvent *event)
{
- QLabel *child = qobject_cast<QLabel*>(childAt(event->pos()));
+ QLabel *child = qobject_cast<QLabel*>(childAt(event->position().toPoint()));
if (!child)
return;
- QPoint hotSpot = event->pos() - child->pos();
+ QPoint hotSpot = event->position().toPoint() - child->pos();
QMimeData *mimeData = new QMimeData;
mimeData->setText(child->text());
diff --git a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
index a02b1cb42a..14e8a1a879 100644
--- a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
+++ b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
@@ -151,7 +151,7 @@ void DragWidget::dropEvent(QDropEvent *event)
//! [10]
//! [11]
DragLabel *newLabel = new DragLabel(text, this);
- newLabel->move(event->pos() - offset);
+ newLabel->move(event->position().toPoint() - offset);
newLabel->show();
newLabel->setAttribute(Qt::WA_DeleteOnClose);
@@ -165,7 +165,7 @@ void DragWidget::dropEvent(QDropEvent *event)
} else if (event->mimeData()->hasText()) {
QStringList pieces = event->mimeData()->text().split(
QRegularExpression(QStringLiteral("\\s+")), Qt::SkipEmptyParts);
- QPoint position = event->pos();
+ QPoint position = event->position().toPoint();
for (const QString &piece : pieces) {
DragLabel *newLabel = new DragLabel(piece, this);
@@ -188,11 +188,11 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
{
//! [13]
//! [14]
- DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
+ DragLabel *child = static_cast<DragLabel*>(childAt(event->position().toPoint()));
if (!child)
return;
- QPoint hotSpot = event->pos() - child->pos();
+ QPoint hotSpot = event->position().toPoint() - child->pos();
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
diff --git a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
index 72f2662bce..06dda9c29f 100644
--- a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
+++ b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
@@ -90,12 +90,12 @@ void PuzzleWidget::dragLeaveEvent(QDragLeaveEvent *event)
void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
{
- QRect updateRect = highlightedRect.united(targetSquare(event->pos()));
+ QRect updateRect = highlightedRect.united(targetSquare(event->position().toPoint()));
if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType())
- && findPiece(targetSquare(event->pos())) == -1) {
+ && findPiece(targetSquare(event->position().toPoint())) == -1) {
- highlightedRect = targetSquare(event->pos());
+ highlightedRect = targetSquare(event->position().toPoint());
event->setDropAction(Qt::MoveAction);
event->accept();
} else {
@@ -109,12 +109,12 @@ void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
void PuzzleWidget::dropEvent(QDropEvent *event)
{
if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType())
- && findPiece(targetSquare(event->pos())) == -1) {
+ && findPiece(targetSquare(event->position().toPoint())) == -1) {
QByteArray pieceData = event->mimeData()->data(PiecesList::puzzleMimeType());
QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
Piece piece;
- piece.rect = targetSquare(event->pos());
+ piece.rect = targetSquare(event->position().toPoint());
dataStream >> piece.pixmap >> piece.location;
pieces.append(piece);
@@ -147,7 +147,7 @@ int PuzzleWidget::findPiece(const QRect &pieceRect) const
void PuzzleWidget::mousePressEvent(QMouseEvent *event)
{
- QRect square = targetSquare(event->pos());
+ QRect square = targetSquare(event->position().toPoint());
const int found = findPiece(square);
if (found == -1)
@@ -170,12 +170,12 @@ void PuzzleWidget::mousePressEvent(QMouseEvent *event)
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
- drag->setHotSpot(event->pos() - square.topLeft());
+ drag->setHotSpot(event->position().toPoint() - square.topLeft());
drag->setPixmap(piece.pixmap);
if (drag->exec(Qt::MoveAction) != Qt::MoveAction) {
pieces.insert(found, piece);
- update(targetSquare(event->pos()));
+ update(targetSquare(event->position().toPoint()));
if (piece.location == square.topLeft() / pieceSize())
inPlace++;
diff --git a/examples/widgets/effects/blurpicker/blurpicker.cpp b/examples/widgets/effects/blurpicker/blurpicker.cpp
index a00af2144a..2b5995d870 100644
--- a/examples/widgets/effects/blurpicker/blurpicker.cpp
+++ b/examples/widgets/effects/blurpicker/blurpicker.cpp
@@ -152,7 +152,7 @@ void BlurPicker::resizeEvent(QResizeEvent * /* event */)
void BlurPicker::mousePressEvent(QMouseEvent *event)
{
int delta = 0;
- if(event->x() > (width() / 2))
+ if (event->position().x() > (width() / 2))
{
delta = 1;
}
diff --git a/examples/widgets/itemviews/chart/pieview.cpp b/examples/widgets/itemviews/chart/pieview.cpp
index 457ed8b4ec..c640c78f3e 100644
--- a/examples/widgets/itemviews/chart/pieview.cpp
+++ b/examples/widgets/itemviews/chart/pieview.cpp
@@ -251,7 +251,7 @@ int PieView::horizontalOffset() const
void PieView::mousePressEvent(QMouseEvent *event)
{
QAbstractItemView::mousePressEvent(event);
- origin = event->pos();
+ origin = event->position().toPoint();
if (!rubberBand)
rubberBand = new QRubberBand(QRubberBand::Rectangle, viewport());
rubberBand->setGeometry(QRect(origin, QSize()));
@@ -261,7 +261,7 @@ void PieView::mousePressEvent(QMouseEvent *event)
void PieView::mouseMoveEvent(QMouseEvent *event)
{
if (rubberBand)
- rubberBand->setGeometry(QRect(origin, event->pos()).normalized());
+ rubberBand->setGeometry(QRect(origin, event->position().toPoint()).normalized());
QAbstractItemView::mouseMoveEvent(event);
}
diff --git a/examples/widgets/itemviews/puzzle/puzzlewidget.cpp b/examples/widgets/itemviews/puzzle/puzzlewidget.cpp
index 974a972306..2c60d28946 100644
--- a/examples/widgets/itemviews/puzzle/puzzlewidget.cpp
+++ b/examples/widgets/itemviews/puzzle/puzzlewidget.cpp
@@ -86,12 +86,12 @@ void PuzzleWidget::dragLeaveEvent(QDragLeaveEvent *event)
void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
{
- QRect updateRect = highlightedRect.united(targetSquare(event->pos()));
+ QRect updateRect = highlightedRect.united(targetSquare(event->position().toPoint()));
if (event->mimeData()->hasFormat("image/x-puzzle-piece")
- && findPiece(targetSquare(event->pos())) == -1) {
+ && findPiece(targetSquare(event->position().toPoint())) == -1) {
- highlightedRect = targetSquare(event->pos());
+ highlightedRect = targetSquare(event->position().toPoint());
event->setDropAction(Qt::MoveAction);
event->accept();
} else {
@@ -105,12 +105,12 @@ void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
void PuzzleWidget::dropEvent(QDropEvent *event)
{
if (event->mimeData()->hasFormat("image/x-puzzle-piece")
- && findPiece(targetSquare(event->pos())) == -1) {
+ && findPiece(targetSquare(event->position().toPoint())) == -1) {
QByteArray pieceData = event->mimeData()->data("image/x-puzzle-piece");
QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
Piece piece;
- piece.rect = targetSquare(event->pos());
+ piece.rect = targetSquare(event->position().toPoint());
dataStream >> piece.pixmap >> piece.location;
pieces.append(piece);
@@ -143,7 +143,7 @@ int PuzzleWidget::findPiece(const QRect &pieceRect) const
void PuzzleWidget::mousePressEvent(QMouseEvent *event)
{
- QRect square = targetSquare(event->pos());
+ QRect square = targetSquare(event->position().toPoint());
int found = findPiece(square);
if (found == -1)
@@ -166,12 +166,12 @@ void PuzzleWidget::mousePressEvent(QMouseEvent *event)
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
- drag->setHotSpot(event->pos() - square.topLeft());
+ drag->setHotSpot(event->position().toPoint() - square.topLeft());
drag->setPixmap(piece.pixmap);
if (drag->exec(Qt::MoveAction) == Qt::IgnoreAction) {
pieces.insert(found, piece);
- update(targetSquare(event->pos()));
+ update(targetSquare(event->position().toPoint()));
if (piece.location == QPoint(square.x() / pieceSize(), square.y() / pieceSize()))
inPlace++;
diff --git a/examples/widgets/itemviews/stardelegate/stareditor.cpp b/examples/widgets/itemviews/stardelegate/stareditor.cpp
index 43706eeae0..72d687c05c 100644
--- a/examples/widgets/itemviews/stardelegate/stareditor.cpp
+++ b/examples/widgets/itemviews/stardelegate/stareditor.cpp
@@ -79,7 +79,7 @@ void StarEditor::paintEvent(QPaintEvent *)
//! [2]
void StarEditor::mouseMoveEvent(QMouseEvent *event)
{
- const int star = starAtPosition(event->x());
+ const int star = starAtPosition(event->position().toPoint().x());
if (star != myStarRating.starCount() && star != -1) {
myStarRating.setStarCount(star);
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
index a7e73debb6..233a9f14ba 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
@@ -628,7 +628,7 @@ void BlueTitleBar::paintEvent(QPaintEvent*)
void BlueTitleBar::mouseReleaseEvent(QMouseEvent *event)
{
- QPoint pos = event->pos();
+ QPoint pos = event->position().toPoint();
QRect rect = this->rect();
diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp
index 961d5e5e99..9ddc6ea12b 100644
--- a/examples/widgets/painting/deform/pathdeform.cpp
+++ b/examples/widgets/painting/deform/pathdeform.cpp
@@ -490,10 +490,10 @@ void PathDeformRenderer::mousePressEvent(QMouseEvent *e)
m_repaintTimer.stop();
m_offset = QPointF();
- if (QLineF(m_pos, e->pos()).length() <= m_radius)
- m_offset = m_pos - e->pos();
+ if (QLineF(m_pos, e->position().toPoint()).length() <= m_radius)
+ m_offset = m_pos - e->position().toPoint();
- m_mousePress = e->pos();
+ m_mousePress = e->position().toPoint();
// If we're not running in small screen mode, always assume we're dragging
m_mouseDrag = !m_smallScreen;
@@ -514,18 +514,18 @@ void PathDeformRenderer::mouseReleaseEvent(QMouseEvent *e)
void PathDeformRenderer::mouseMoveEvent(QMouseEvent *e)
{
- if (!m_mouseDrag && (QLineF(m_mousePress, e->pos()).length() > 25.0) )
+ if (!m_mouseDrag && (QLineF(m_mousePress, e->position().toPoint()).length() > 25.0) )
m_mouseDrag = true;
if (m_mouseDrag) {
QRect rectBefore = circle_bounds(m_pos, m_radius, m_fontSize);
if (e->type() == QEvent::MouseMove) {
- QLineF line(m_pos, e->pos() + m_offset);
+ QLineF line(m_pos, e->position().toPoint() + m_offset);
line.setLength(line.length() * .1);
QPointF dir(line.dx(), line.dy());
m_direction = (m_direction + dir) / 2;
}
- m_pos = e->pos() + m_offset;
+ m_pos = e->position().toPoint() + m_offset;
#if QT_CONFIG(opengl)
if (usesOpenGL()) {
update();
diff --git a/examples/widgets/painting/pathstroke/pathstroke.cpp b/examples/widgets/painting/pathstroke/pathstroke.cpp
index 7dab6f95a2..439bcb2cd0 100644
--- a/examples/widgets/painting/pathstroke/pathstroke.cpp
+++ b/examples/widgets/painting/pathstroke/pathstroke.cpp
@@ -559,7 +559,7 @@ void PathStrokeRenderer::mousePressEvent(QMouseEvent *e)
m_activePoint = -1;
qreal distance = -1;
for (int i = 0; i < m_points.size(); ++i) {
- qreal d = QLineF(e->pos(), m_points.at(i)).length();
+ qreal d = QLineF(e->position().toPoint(), m_points.at(i)).length();
if ((distance < 0 && d < 8 * m_pointSize) || d < distance) {
distance = d;
m_activePoint = i;
@@ -574,7 +574,7 @@ void PathStrokeRenderer::mousePressEvent(QMouseEvent *e)
// If we're not running in small screen mode, always assume we're dragging
m_mouseDrag = !m_smallScreen;
- m_mousePress = e->pos();
+ m_mousePress = e->position().toPoint();
}
void PathStrokeRenderer::mouseMoveEvent(QMouseEvent *e)
@@ -582,11 +582,11 @@ void PathStrokeRenderer::mouseMoveEvent(QMouseEvent *e)
if (!m_fingerPointMapping.isEmpty())
return;
// If we've moved more then 25 pixels, assume user is dragging
- if (!m_mouseDrag && QPoint(m_mousePress - e->pos()).manhattanLength() > 25)
+ if (!m_mouseDrag && QPoint(m_mousePress - e->position().toPoint()).manhattanLength() > 25)
m_mouseDrag = true;
if (m_mouseDrag && m_activePoint >= 0 && m_activePoint < m_points.size()) {
- m_points[m_activePoint] = e->pos();
+ m_points[m_activePoint] = e->position().toPoint();
update();
}
}
@@ -638,7 +638,7 @@ bool PathStrokeRenderer::event(QEvent *e)
if (activePoints.contains(i))
continue;
- qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
+ qreal d = QLineF(touchPoint.position(), m_points.at(i)).length();
if ((distance < 0 && d < 12 * m_pointSize) || d < distance) {
distance = d;
activePoint = i;
@@ -646,7 +646,7 @@ bool PathStrokeRenderer::event(QEvent *e)
}
if (activePoint != -1) {
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
- m_points[activePoint] = touchPoint.pos();
+ m_points[activePoint] = touchPoint.position();
}
break;
}
@@ -654,7 +654,7 @@ bool PathStrokeRenderer::event(QEvent *e)
{
// move the point and release
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
- m_points[it.value()] = touchPoint.pos();
+ m_points[it.value()] = touchPoint.position();
m_fingerPointMapping.erase(it);
break;
}
@@ -663,7 +663,7 @@ bool PathStrokeRenderer::event(QEvent *e)
// move the point
const int pointIdx = m_fingerPointMapping.value(id, -1);
if (pointIdx >= 0)
- m_points[pointIdx] = touchPoint.pos();
+ m_points[pointIdx] = touchPoint.position();
break;
}
default:
diff --git a/examples/widgets/painting/shared/hoverpoints.cpp b/examples/widgets/painting/shared/hoverpoints.cpp
index f834f315f9..9fe947cedc 100644
--- a/examples/widgets/painting/shared/hoverpoints.cpp
+++ b/examples/widgets/painting/shared/hoverpoints.cpp
@@ -102,7 +102,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
return true;
QMouseEvent *me = (QMouseEvent *) event;
- QPointF clickPos = me->pos();
+ QPointF clickPos = me->position().toPoint();
int index = -1;
for (int i=0; i<m_points.size(); ++i) {
QPainterPath path;
@@ -170,7 +170,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
if (!m_fingerPointMapping.isEmpty())
return true;
if (m_currentIndex >= 0)
- movePoint(m_currentIndex, ((QMouseEvent *)event)->pos());
+ movePoint(m_currentIndex, ((QMouseEvent *)event)->position().toPoint());
break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
@@ -197,7 +197,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
if (activePoints.contains(i))
continue;
- qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
+ qreal d = QLineF(touchPoint.position(), m_points.at(i)).length();
if ((distance < 0 && d < 12 * pointSize) || d < distance) {
distance = d;
activePoint = i;
@@ -207,7 +207,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
}
if (activePoint != -1) {
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
- movePoint(activePoint, touchPoint.pos());
+ movePoint(activePoint, touchPoint.position());
}
}
break;
@@ -215,7 +215,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
{
// move the point and release
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
- movePoint(it.value(), touchPoint.pos());
+ movePoint(it.value(), touchPoint.position());
m_fingerPointMapping.erase(it);
}
break;
@@ -224,7 +224,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
// move the point
const int pointIdx = m_fingerPointMapping.value(id, -1);
if (pointIdx >= 0) // do we track this point?
- movePoint(pointIdx, touchPoint.pos());
+ movePoint(pointIdx, touchPoint.position());
}
break;
default:
diff --git a/examples/widgets/tools/plugandpaint/app/paintarea.cpp b/examples/widgets/tools/plugandpaint/app/paintarea.cpp
index 92b8ea4777..e3292e3b91 100644
--- a/examples/widgets/tools/plugandpaint/app/paintarea.cpp
+++ b/examples/widgets/tools/plugandpaint/app/paintarea.cpp
@@ -137,7 +137,7 @@ void PaintArea::mousePressEvent(QMouseEvent *event)
gradient.setColorAt(1.0, QColor(color.red(), color.green(),
color.blue(), 191));
painter.setBrush(gradient);
- painter.translate(event->pos() - boundingRect.center());
+ painter.translate(event->position().toPoint() - boundingRect.center());
painter.drawPath(pendingPath);
pendingPath = QPainterPath();
@@ -150,11 +150,11 @@ void PaintArea::mousePressEvent(QMouseEvent *event)
QPainter painter(&theImage);
setupPainter(painter);
const QRect rect = brushInterface->mousePress(brush, painter,
- event->pos());
+ event->position().toPoint());
update(rect);
}
- lastPos = event->pos();
+ lastPos = event->position().toPoint();
}
}
}
@@ -167,11 +167,11 @@ void PaintArea::mouseMoveEvent(QMouseEvent *event)
QPainter painter(&theImage);
setupPainter(painter);
const QRect rect = brushInterface->mouseMove(brush, painter, lastPos,
- event->pos());
+ event->position().toPoint());
update(rect);
}
- lastPos = event->pos();
+ lastPos = event->position().toPoint();
}
}
//! [1]
@@ -183,7 +183,7 @@ void PaintArea::mouseReleaseEvent(QMouseEvent *event)
QPainter painter(&theImage);
setupPainter(painter);
QRect rect = brushInterface->mouseRelease(brush, painter,
- event->pos());
+ event->position().toPoint());
update(rect);
}
diff --git a/examples/widgets/tools/undo/document.cpp b/examples/widgets/tools/undo/document.cpp
index 2deed83a99..339a63abae 100644
--- a/examples/widgets/tools/undo/document.cpp
+++ b/examples/widgets/tools/undo/document.cpp
@@ -283,17 +283,17 @@ int Document::indexAt(const QPoint &pos) const
void Document::mousePressEvent(QMouseEvent *event)
{
event->accept();
- int index = indexAt(event->pos());;
+ int index = indexAt(event->position().toPoint());;
if (index != -1) {
setCurrentShape(index);
const Shape &shape = m_shapeList.at(index);
- m_resizeHandlePressed = shape.resizeHandle().contains(event->pos());
+ m_resizeHandlePressed = shape.resizeHandle().contains(event->position().toPoint());
if (m_resizeHandlePressed)
- m_mousePressOffset = shape.rect().bottomRight() - event->pos();
+ m_mousePressOffset = shape.rect().bottomRight() - event->position().toPoint();
else
- m_mousePressOffset = event->pos() - shape.rect().topLeft();
+ m_mousePressOffset = event->position().toPoint() - shape.rect().topLeft();
}
m_mousePressIndex = index;
}
@@ -315,10 +315,10 @@ void Document::mouseMoveEvent(QMouseEvent *event)
QRect rect;
if (m_resizeHandlePressed) {
- rect = QRect(shape.rect().topLeft(), event->pos() + m_mousePressOffset);
+ rect = QRect(shape.rect().topLeft(), event->position().toPoint() + m_mousePressOffset);
} else {
rect = shape.rect();
- rect.moveTopLeft(event->pos() - m_mousePressOffset);
+ rect.moveTopLeft(event->position().toPoint() - m_mousePressOffset);
}
QSize size = rect.size().expandedTo(Shape::minSize);
diff --git a/examples/widgets/touch/fingerpaint/scribblearea.cpp b/examples/widgets/touch/fingerpaint/scribblearea.cpp
index 4af0ec8e7e..ed06545b43 100644
--- a/examples/widgets/touch/fingerpaint/scribblearea.cpp
+++ b/examples/widgets/touch/fingerpaint/scribblearea.cpp
@@ -216,13 +216,13 @@ bool ScribbleArea::event(QEvent *event)
QPainter painter(&image);
painter.setPen(Qt::NoPen);
painter.setBrush(myPenColors.at(touchPoint.id() % myPenColors.count()));
- painter.drawEllipse(touchPoint.pos(), diams.width() / 2, diams.height() / 2);
+ painter.drawEllipse(touchPoint.position(), diams.width() / 2, diams.height() / 2);
painter.end();
modified = true;
const int rad = 2;
QRectF rect(QPointF(), diams);
- rect.moveCenter(touchPoint.pos());
+ rect.moveCenter(touchPoint.position());
update(rect.toRect().adjusted(-rad,-rad, +rad, +rad));
}
break;
diff --git a/examples/widgets/touch/knobs/knob.cpp b/examples/widgets/touch/knobs/knob.cpp
index 12aaa1e948..659ba82f45 100644
--- a/examples/widgets/touch/knobs/knob.cpp
+++ b/examples/widgets/touch/knobs/knob.cpp
@@ -82,7 +82,7 @@ bool Knob::sceneEvent(QEvent *event)
const QTouchEvent::TouchPoint &touchPoint2 = touchEvent->touchPoints().last();
QLineF line1(touchPoint1.lastScenePos(), touchPoint2.lastScenePos());
- QLineF line2(touchPoint1.scenePos(), touchPoint2.scenePos());
+ QLineF line2(touchPoint1.scenePosition(), touchPoint2.scenePosition());
setTransform(QTransform().rotate(line2.angleTo(line1)), true);
}
diff --git a/examples/widgets/touch/pinchzoom/graphicsview.cpp b/examples/widgets/touch/pinchzoom/graphicsview.cpp
index 6412f350a7..e1ce42f93f 100644
--- a/examples/widgets/touch/pinchzoom/graphicsview.cpp
+++ b/examples/widgets/touch/pinchzoom/graphicsview.cpp
@@ -74,8 +74,8 @@ bool GraphicsView::viewportEvent(QEvent *event)
const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
qreal currentScaleFactor =
- QLineF(touchPoint0.pos(), touchPoint1.pos()).length()
- / QLineF(touchPoint0.startPos(), touchPoint1.startPos()).length();
+ QLineF(touchPoint0.position(), touchPoint1.position()).length()
+ / QLineF(touchPoint0.pressPosition(), touchPoint1.pressPosition()).length();
if (touchEvent->touchPointStates() & Qt::TouchPointReleased) {
// if one of the fingers is released, remember the current scale
// factor so that adding another finger later will continue zooming
diff --git a/examples/widgets/widgets/charactermap/characterwidget.cpp b/examples/widgets/widgets/charactermap/characterwidget.cpp
index 41406b7fb4..422177ffa8 100644
--- a/examples/widgets/widgets/charactermap/characterwidget.cpp
+++ b/examples/widgets/widgets/charactermap/characterwidget.cpp
@@ -120,14 +120,14 @@ QSize CharacterWidget::sizeHint() const
//! [4]
void CharacterWidget::mouseMoveEvent(QMouseEvent *event)
{
- QPoint widgetPosition = mapFromGlobal(event->globalPos());
+ QPoint widgetPosition = mapFromGlobal(event->globalPosition().toPoint());
uint key = (widgetPosition.y() / squareSize) * columns + widgetPosition.x() / squareSize;
QString text = QString::fromLatin1("<p>Character: <span style=\"font-size: 24pt; font-family: %1\">").arg(displayFont.family())
+ QChar(key)
+ QString::fromLatin1("</span><p>Value: 0x")
+ QString::number(key, 16);
- QToolTip::showText(event->globalPos(), text, this);
+ QToolTip::showText(event->globalPosition().toPoint(), text, this);
}
//! [4]
@@ -135,7 +135,7 @@ void CharacterWidget::mouseMoveEvent(QMouseEvent *event)
void CharacterWidget::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- lastKey = (event->y() / squareSize) * columns + event->x() / squareSize;
+ lastKey = (event->position().toPoint().y() / squareSize) * columns + event->position().toPoint().x() / squareSize;
if (QChar(lastKey).category() != QChar::Other_NotAssigned)
emit characterSelected(QString(QChar(lastKey)));
update();
diff --git a/examples/widgets/widgets/scribble/scribblearea.cpp b/examples/widgets/widgets/scribble/scribblearea.cpp
index d3937f90d8..2ac293d55a 100644
--- a/examples/widgets/widgets/scribble/scribblearea.cpp
+++ b/examples/widgets/widgets/scribble/scribblearea.cpp
@@ -132,7 +132,7 @@ void ScribbleArea::mousePressEvent(QMouseEvent *event)
//! [11] //! [12]
{
if (event->button() == Qt::LeftButton) {
- lastPoint = event->pos();
+ lastPoint = event->position().toPoint();
scribbling = true;
}
}
@@ -140,13 +140,13 @@ void ScribbleArea::mousePressEvent(QMouseEvent *event)
void ScribbleArea::mouseMoveEvent(QMouseEvent *event)
{
if ((event->buttons() & Qt::LeftButton) && scribbling)
- drawLineTo(event->pos());
+ drawLineTo(event->position().toPoint());
}
void ScribbleArea::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton && scribbling) {
- drawLineTo(event->pos());
+ drawLineTo(event->position().toPoint());
scribbling = false;
}
}
diff --git a/examples/widgets/widgets/shapedclock/shapedclock.cpp b/examples/widgets/widgets/shapedclock/shapedclock.cpp
index 673d1a218f..343ad7c43c 100644
--- a/examples/widgets/widgets/shapedclock/shapedclock.cpp
+++ b/examples/widgets/widgets/shapedclock/shapedclock.cpp
@@ -82,7 +82,7 @@ ShapedClock::ShapedClock(QWidget *parent)
void ShapedClock::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- dragPosition = event->globalPos() - frameGeometry().topLeft();
+ dragPosition = event->globalPosition().toPoint() - frameGeometry().topLeft();
event->accept();
}
}
@@ -92,7 +92,7 @@ void ShapedClock::mousePressEvent(QMouseEvent *event)
void ShapedClock::mouseMoveEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::LeftButton) {
- move(event->globalPos() - dragPosition);
+ move(event->globalPosition().toPoint() - dragPosition);
event->accept();
}
}
diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp
index 90a5017500..f3f2b0cac6 100644
--- a/examples/widgets/widgets/tablet/tabletcanvas.cpp
+++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp
@@ -99,7 +99,7 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
case QEvent::TabletPress:
if (!m_deviceDown) {
m_deviceDown = true;
- lastPoint.pos = event->posF();
+ lastPoint.pos = event->position();
lastPoint.pressure = event->pressure();
lastPoint.rotation = event->rotation();
}
@@ -113,7 +113,7 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
updateBrush(event);
QPainter painter(&m_pixmap);
paintPixmap(painter, event);
- lastPoint.pos = event->posF();
+ lastPoint.pos = event->position();
lastPoint.pressure = event->pressure();
lastPoint.rotation = event->rotation();
}
@@ -173,8 +173,8 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
grad.setColorAt(0.5, Qt::transparent);
painter.setBrush(grad);
qreal radius = grad.radius();
- painter.drawEllipse(event->posF(), radius, radius);
- update(QRect(event->pos() - QPoint(radius, radius), QSize(radius * 2, radius * 2)));
+ painter.drawEllipse(event->position(), radius, radius);
+ update(QRect(event->position().toPoint() - QPoint(radius, radius), QSize(radius * 2, radius * 2)));
}
break;
case QTabletEvent::RotationStylus:
@@ -191,8 +191,8 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
halfWidth = m_pen.widthF();
brushAdjust = QPointF(qSin(qDegreesToRadians(-event->rotation())) * halfWidth,
qCos(qDegreesToRadians(-event->rotation())) * halfWidth);
- poly << event->posF() - brushAdjust;
- poly << event->posF() + brushAdjust;
+ poly << event->position() - brushAdjust;
+ poly << event->position() + brushAdjust;
painter.drawConvexPolygon(poly);
update(poly.boundingRect().toRect());
}
@@ -223,8 +223,8 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
Q_FALLTHROUGH();
case QTabletEvent::Stylus:
painter.setPen(m_pen);
- painter.drawLine(lastPoint.pos, event->posF());
- update(QRect(lastPoint.pos.toPoint(), event->pos()).normalized()
+ painter.drawLine(lastPoint.pos, event->position());
+ update(QRect(lastPoint.pos.toPoint(), event->position().toPoint()).normalized()
.adjusted(-maxPenRadius, -maxPenRadius, maxPenRadius, maxPenRadius));
break;
}
diff --git a/examples/widgets/widgets/tooltips/sortingbox.cpp b/examples/widgets/widgets/tooltips/sortingbox.cpp
index d06fbe1756..d993b098b2 100644
--- a/examples/widgets/widgets/tooltips/sortingbox.cpp
+++ b/examples/widgets/widgets/tooltips/sortingbox.cpp
@@ -159,10 +159,10 @@ void SortingBox::paintEvent(QPaintEvent * /* event */)
void SortingBox::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- int index = itemAt(event->pos());
+ int index = itemAt(event->position().toPoint());
if (index != -1) {
itemInMotion = &shapeItems[index];
- previousPosition = event->pos();
+ previousPosition = event->position().toPoint();
shapeItems.move(index, shapeItems.size() - 1);
update();
}
@@ -174,7 +174,7 @@ void SortingBox::mousePressEvent(QMouseEvent *event)
void SortingBox::mouseMoveEvent(QMouseEvent *event)
{
if ((event->buttons() & Qt::LeftButton) && itemInMotion)
- moveItemTo(event->pos());
+ moveItemTo(event->position().toPoint());
}
//! [12]
@@ -182,7 +182,7 @@ void SortingBox::mouseMoveEvent(QMouseEvent *event)
void SortingBox::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton && itemInMotion) {
- moveItemTo(event->pos());
+ moveItemTo(event->position().toPoint());
itemInMotion = nullptr;
}
}
diff --git a/examples/widgets/windowcontainer/windowcontainer.cpp b/examples/widgets/windowcontainer/windowcontainer.cpp
index f7c146e2a9..a104949d1e 100644
--- a/examples/widgets/windowcontainer/windowcontainer.cpp
+++ b/examples/widgets/windowcontainer/windowcontainer.cpp
@@ -100,7 +100,7 @@ public:
if (!m_mouseDown) {
m_mouseDown = true;
m_polygon.clear();
- m_polygon.append(e->pos());
+ m_polygon.append(e->position().toPoint());
renderLater();
}
}
@@ -108,7 +108,7 @@ public:
void mouseMoveEvent(QMouseEvent *e) override
{
if (m_mouseDown) {
- m_polygon.append(e->pos());
+ m_polygon.append(e->position().toPoint());
renderLater();
}
}
@@ -117,7 +117,7 @@ public:
{
if (m_mouseDown) {
m_mouseDown = false;
- m_polygon.append(e->pos());
+ m_polygon.append(e->position().toPoint());
renderLater();
}
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 95b6a49018..f7939f4986 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -40,7 +40,7 @@
#include "qevent.h"
#include "qcursor.h"
#include "private/qguiapplication_p.h"
-#include "private/qtouchdevice_p.h"
+#include "qtouchdevice.h"
#include "qpa/qplatformintegration.h"
#include "private/qevent_p.h"
#include "qfile.h"
@@ -3585,13 +3585,13 @@ static void formatDropEvent(QDebug d, const QDropEvent *e)
d << ", possibleActions=";
QtDebugUtils::formatQFlags(d, e->possibleActions());
d << ", posF=";
- QtDebugUtils::formatQPoint(d, e->posF());
+ QtDebugUtils::formatQPoint(d, e->position());
if (type == QEvent::DragMove || type == QEvent::DragEnter)
d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect();
d << ", formats=" << e->mimeData()->formats();
- QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->keyboardModifiers());
+ QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->modifiers());
d << ", ";
- QtDebugUtils::formatQFlags(d, e->mouseButtons());
+ QtDebugUtils::formatQFlags(d, e->buttons());
}
# endif // QT_CONFIG(draganddrop)
@@ -3609,7 +3609,7 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e)
d << ", pointerType=";
QtDebugUtils::formatQEnum(d, e->pointerType());
d << ", uniqueId=" << e->uniqueId()
- << ", pos=" << e->posF()
+ << ", pos=" << e->position()
<< ", z=" << e->z()
<< ", xTilt=" << e->xTilt()
<< ", yTilt=" << e->yTilt()
@@ -3630,7 +3630,7 @@ QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp)
QDebugStateSaver saver(dbg);
dbg.nospace();
dbg << "TouchPoint(" << Qt::hex << tp.id() << Qt::dec << " (";
- QtDebugUtils::formatQPoint(dbg, tp.pos());
+ QtDebugUtils::formatQPoint(dbg, tp.position());
dbg << ") ";
QtDebugUtils::formatQEnum(dbg, tp.state());
dbg << " pressure " << tp.pressure() << " ellipse ("
@@ -3638,11 +3638,11 @@ QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp)
<< " angle " << tp.rotation() << ") vel (";
QtDebugUtils::formatQPoint(dbg, tp.velocity().toPointF());
dbg << ") start (";
- QtDebugUtils::formatQPoint(dbg, tp.startPos());
+ QtDebugUtils::formatQPoint(dbg, tp.pressPosition());
dbg << ") last (";
QtDebugUtils::formatQPoint(dbg, tp.lastPos());
dbg << ") delta (";
- QtDebugUtils::formatQPoint(dbg, tp.pos() - tp.lastPos());
+ QtDebugUtils::formatQPoint(dbg, tp.position() - tp.lastPos());
dbg << ')';
return dbg;
}
@@ -3688,9 +3688,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
}
QtDebugUtils::formatNonNullQFlags(dbg, ", ", me->modifiers());
dbg << ", localPos=";
- QtDebugUtils::formatQPoint(dbg, me->localPos());
+ QtDebugUtils::formatQPoint(dbg, me->position());
dbg << ", screenPos=";
- QtDebugUtils::formatQPoint(dbg, me->screenPos());
+ QtDebugUtils::formatQPoint(dbg, me->globalPosition());
QtDebugUtils::formatNonNullQEnum(dbg, ", ", me->source());
QtDebugUtils::formatNonNullQFlags(dbg, ", flags=", me->flags());
dbg << ')';
@@ -3791,7 +3791,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << "QNativeGestureEvent(";
QtDebugUtils::formatQEnum(dbg, ne->gestureType());
dbg << ", localPos=";
- QtDebugUtils::formatQPoint(dbg, ne->localPos());
+ QtDebugUtils::formatQPoint(dbg, ne->position());
dbg << ", value=" << ne->value() << ')';
}
break;
@@ -3816,7 +3816,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
break;
# endif // QT_CONFIG(tabletevent)
case QEvent::Enter:
- dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->pos() << ')';
+ dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->position() << ')';
break;
case QEvent::Timer:
dbg << "QTimerEvent(id=" << static_cast<const QTimerEvent *>(e)->timerId() << ')';
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index cde21dc8dd..a1e5da4a32 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2842,15 +2842,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (!w) {
// determine which window this event will go to
if (!window)
- window = QGuiApplication::topLevelAt(touchPoint.screenPos().toPoint());
+ window = QGuiApplication::topLevelAt(touchPoint.globalPosition().toPoint());
if (!window)
continue;
w = window;
}
touchInfo.window = w;
- touchPoint.d->startScreenPos = touchPoint.screenPos();
- touchPoint.d->lastScreenPos = touchPoint.screenPos();
+ touchPoint.d->startScreenPos = touchPoint.globalPosition();
+ touchPoint.d->lastScreenPos = touchPoint.globalPosition();
touchPoint.d->startNormalizedPos = touchPoint.normalizedPos();
touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
@@ -2865,10 +2865,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
continue;
previousTouchPoint = touchInfo.touchPoint;
- touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
- touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
- touchPoint.d->startPos = previousTouchPoint.startPos();
- touchPoint.d->lastPos = previousTouchPoint.pos();
+ touchPoint.d->startScreenPos = previousTouchPoint.globalPressPosition();
+ touchPoint.d->lastScreenPos = previousTouchPoint.globalPosition();
+ touchPoint.d->startPos = previousTouchPoint.pressPosition();
+ touchPoint.d->lastPos = previousTouchPoint.position();
touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
@@ -2882,10 +2882,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
continue;
previousTouchPoint = touchInfo.touchPoint;
- touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
- touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
- touchPoint.d->startPos = previousTouchPoint.startPos();
- touchPoint.d->lastPos = previousTouchPoint.pos();
+ touchPoint.d->startScreenPos = previousTouchPoint.globalPressPosition();
+ touchPoint.d->lastScreenPos = previousTouchPoint.globalPosition();
+ touchPoint.d->startPos = previousTouchPoint.pressPosition();
+ touchPoint.d->lastPos = previousTouchPoint.position();
touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
@@ -2916,8 +2916,8 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// Note: touchPoint is a reference to the one from activeTouchPoints,
// so we can modify it as long as we're careful NOT to call setters and
// otherwise NOT to cause the d-pointer to be detached.
- touchPoint.d->scenePos = touchPoint.screenPos();
- touchPoint.d->startScenePos = touchPoint.startScreenPos();
+ touchPoint.d->scenePos = touchPoint.globalPosition();
+ touchPoint.d->startScenePos = touchPoint.globalPressPosition();
touchPoint.d->lastScenePos = touchPoint.lastScreenPos();
StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()];
@@ -2981,7 +2981,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QTouchEvent::TouchPoint &touchPoint = touchEvent._touchPoints[i];
// preserve the sub-pixel resolution
- const QPointF screenPos = touchPoint.screenPos();
+ const QPointF screenPos = touchPoint.globalPosition();
const QPointF delta = screenPos - screenPos.toPoint();
touchPoint.d->pos = w->mapFromGlobal(screenPos.toPoint()) + delta;
@@ -2989,7 +2989,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// touchPoint is actually a reference to one that is stored in activeTouchPoints,
// and we are now going to store the startPos and lastPos there, for the benefit
// of future moves and releases. It's important that the d-pointer is NOT detached.
- touchPoint.d->startPos = w->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
+ touchPoint.d->startPos = w->mapFromGlobal(touchPoint.globalPressPosition().toPoint()) + delta;
touchPoint.d->lastPos = w->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
}
}
@@ -3023,12 +3023,12 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (touchPoint.id() == m_fakeMouseSourcePointId) {
if (eventType != QEvent::TouchEnd)
self->synthesizedMousePoints.insert(w, SynthesizedMouseData(
- touchPoint.pos(), touchPoint.screenPos(), w));
+ touchPoint.position(), touchPoint.globalPosition(), w));
// All touch events that are not accepted by the application will be translated to
// left mouse button events instead (see AA_SynthesizeMouseForUnhandledTouchEvents docs).
QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp,
- touchPoint.pos(),
- touchPoint.screenPos(),
+ touchPoint.position(),
+ touchPoint.globalPosition(),
buttons,
e->modifiers,
button,
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index 55e92d2a5d..58fdf7a2c3 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -114,7 +114,7 @@ void QBasicDrag::disableEventFilter()
static inline QPoint getNativeMousePos(QEvent *e, QWindow *window)
{
- return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), window);
+ return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPosition().toPoint(), window);
}
bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
@@ -176,13 +176,13 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
// If there is no such window (belonging to this Qt application),
// make the event relative to the window where the drag started. (QTBUG-66103)
const QMouseEvent *release = static_cast<QMouseEvent *>(e);
- const QWindow *releaseWindow = topLevelAt(release->globalPos());
- qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_sourceWindow << "globalPos" << release->globalPos();
+ const QWindow *releaseWindow = topLevelAt(release->globalPosition().toPoint());
+ qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_sourceWindow << "globalPos" << release->globalPosition().toPoint();
if (!releaseWindow)
releaseWindow = m_sourceWindow;
- QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPos()) : release->globalPos());
+ QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPosition().toPoint()) : release->globalPosition().toPoint());
QMouseEvent *newRelease = new QMouseEvent(release->type(),
- releaseWindowPos, releaseWindowPos, release->screenPos(),
+ releaseWindowPos, releaseWindowPos, release->globalPosition(),
release->button(), release->buttons(),
release->modifiers(), release->source());
QCoreApplication::postEvent(o, newRelease);
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 42676fbf3e..5ad47d3866 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -709,7 +709,7 @@ QList<QWindowSystemInterface::TouchPoint>
p.flags = pt.flags();
p.normalPosition = QHighDpi::toNativeLocalPosition(pt.normalizedPos(), window);
QRectF area(QPointF(), pt.ellipseDiameters());
- area.moveCenter(pt.screenPos());
+ area.moveCenter(pt.globalPosition());
// TODO store ellipseDiameters in QWindowSystemInterface::TouchPoint or just use QTouchEvent::TouchPoint
p.area = QHighDpi::toNativePixels(area, window);
p.pressure = pt.pressure();
diff --git a/src/platformsupport/fbconvenience/qfbcursor.cpp b/src/platformsupport/fbconvenience/qfbcursor.cpp
index e0f6b69e77..a300e3efcb 100644
--- a/src/platformsupport/fbconvenience/qfbcursor.cpp
+++ b/src/platformsupport/fbconvenience/qfbcursor.cpp
@@ -113,7 +113,7 @@ void QFbCursor::pointerEvent(const QMouseEvent &e)
{
if (e.type() != QEvent::MouseMove)
return;
- m_pos = e.screenPos().toPoint();
+ m_pos = e.globalPosition().toPoint();
if (!mVisible)
return;
mCurrentRect = getCurrentRect();
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
index b8bd7e038b..1be61504de 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
@@ -323,7 +323,7 @@ void QEglFSCursor::pointerEvent(const QMouseEvent &event)
if (event.type() != QEvent::MouseMove)
return;
const QRect oldCursorRect = cursorRect();
- m_cursor.pos = event.screenPos().toPoint();
+ m_cursor.pos = event.globalPosition().toPoint();
update(oldCursorRect | cursorRect(), false);
for (QPlatformScreen *screen : m_screen->virtualSiblings())
static_cast<QEglFSScreen *>(screen)->handleCursorMove(m_cursor.pos);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
index 9dd430a4df..c802b8e112 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
@@ -151,7 +151,7 @@ void QEglFSKmsGbmCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::
void QEglFSKmsGbmCursor::pointerEvent(const QMouseEvent &event)
{
- setPos(event.screenPos().toPoint());
+ setPos(event.globalPosition().toPoint());
}
#ifndef QT_NO_CURSOR
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 3337cf328a..a605c35b05 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -382,7 +382,7 @@ void QWellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r
void QWellArray::mousePressEvent(QMouseEvent *e)
{
// The current cell marker is set to the cell the mouse is pressed in
- QPoint pos = e->pos();
+ QPoint pos = e->position().toPoint();
setCurrent(rowAt(pos.y()), columnAt(pos.x()));
}
@@ -626,7 +626,7 @@ void QColorWell::mousePressEvent(QMouseEvent *e)
oldCurrent = QPoint(selectedRow(), selectedColumn());
QWellArray::mousePressEvent(e);
mousePressed = true;
- pressPos = e->pos();
+ pressPos = e->position().toPoint();
}
void QColorWell::mouseMoveEvent(QMouseEvent *e)
@@ -635,7 +635,7 @@ void QColorWell::mouseMoveEvent(QMouseEvent *e)
#if QT_CONFIG(draganddrop)
if (!mousePressed)
return;
- if ((pressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) {
+ if ((pressPos - e->position().toPoint()).manhattanLength() > QApplication::startDragDistance()) {
setCurrent(oldCurrent.x(), oldCurrent.y());
int i = rowAt(pressPos.y()) + columnAt(pressPos.x()) * numRows();
QColor col(values[i]);
@@ -673,7 +673,7 @@ void QColorWell::dragLeaveEvent(QDragLeaveEvent *)
void QColorWell::dragMoveEvent(QDragMoveEvent *e)
{
if (qvariant_cast<QColor>(e->mimeData()->colorData()).isValid()) {
- setCurrent(rowAt(e->pos().y()), columnAt(e->pos().x()));
+ setCurrent(rowAt(e->position().toPoint().y()), columnAt(e->position().toPoint().x()));
e->accept();
} else {
e->ignore();
@@ -684,7 +684,7 @@ void QColorWell::dropEvent(QDropEvent *e)
{
QColor col = qvariant_cast<QColor>(e->mimeData()->colorData());
if (col.isValid()) {
- int i = rowAt(e->pos().y()) + columnAt(e->pos().x()) * numRows();
+ int i = rowAt(e->position().toPoint().y()) + columnAt(e->position().toPoint().x()) * numRows();
emit colorChanged(i, col.rgb());
e->accept();
} else {
@@ -799,11 +799,11 @@ QColorLuminancePicker::~QColorLuminancePicker()
void QColorLuminancePicker::mouseMoveEvent(QMouseEvent *m)
{
- setVal(y2val(m->y()));
+ setVal(y2val(m->position().toPoint().y()));
}
void QColorLuminancePicker::mousePressEvent(QMouseEvent *m)
{
- setVal(y2val(m->y()));
+ setVal(y2val(m->position().toPoint().y()));
}
void QColorLuminancePicker::setVal(int v)
@@ -932,14 +932,14 @@ void QColorPicker::setCol(int h, int s)
void QColorPicker::mouseMoveEvent(QMouseEvent *m)
{
- QPoint p = m->pos() - contentsRect().topLeft();
+ QPoint p = m->position().toPoint() - contentsRect().topLeft();
setCol(p);
emit newCol(hue, sat);
}
void QColorPicker::mousePressEvent(QMouseEvent *m)
{
- QPoint p = m->pos() - contentsRect().topLeft();
+ QPoint p = m->position().toPoint() - contentsRect().topLeft();
setCol(p);
emit newCol(hue, sat);
}
@@ -1113,7 +1113,7 @@ inline bool QColorShower::isAlphaVisible() const
void QColorShowLabel::mousePressEvent(QMouseEvent *e)
{
mousePressed = true;
- pressPos = e->pos();
+ pressPos = e->position().toPoint();
}
void QColorShowLabel::mouseMoveEvent(QMouseEvent *e)
@@ -1123,7 +1123,7 @@ void QColorShowLabel::mouseMoveEvent(QMouseEvent *e)
#else
if (!mousePressed)
return;
- if ((pressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) {
+ if ((pressPos - e->position().toPoint()).manhattanLength() > QApplication::startDragDistance()) {
QMimeData *mime = new QMimeData;
mime->setColorData(col);
QPixmap pix(30, 20);
@@ -2219,15 +2219,15 @@ void QColorDialogPrivate::updateColorPicking(const QPoint &globalPos)
bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e)
{
// If the cross is visible the grabbed color will be black most of the times
- cp->setCrossVisible(!cp->geometry().contains(e->pos()));
+ cp->setCrossVisible(!cp->geometry().contains(e->position().toPoint()));
- updateColorPicking(e->globalPos());
+ updateColorPicking(e->globalPosition().toPoint());
return true;
}
bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e)
{
- setCurrentColor(grabScreenColor(e->globalPos()), SetColorAll);
+ setCurrentColor(grabScreenColor(e->globalPosition().toPoint()), SetColorAll);
releaseColorPicking();
return true;
}
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index ba115b7485..f093dc1644 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -5830,8 +5830,8 @@ void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouch
item->d_ptr->genericMapFromSceneTransform(static_cast<const QWidget *>(touchEvent->target()));
for (auto &touchPoint : touchEvent->_touchPoints) {
- touchPoint.setPos(mapFromScene.map(touchPoint.scenePos()));
- touchPoint.setStartPos(mapFromScene.map(touchPoint.startScenePos()));
+ touchPoint.setPos(mapFromScene.map(touchPoint.scenePosition()));
+ touchPoint.setStartPos(mapFromScene.map(touchPoint.scenePressPosition()));
touchPoint.setLastPos(mapFromScene.map(touchPoint.lastScenePos()));
}
}
@@ -5841,7 +5841,7 @@ int QGraphicsScenePrivate::findClosestTouchPointId(const QPointF &scenePos)
int closestTouchPointId = -1;
qreal closestDistance = qreal(0.);
for (const QTouchEvent::TouchPoint &touchPoint : qAsConst(sceneCurrentTouchPoints)) {
- qreal distance = QLineF(scenePos, touchPoint.scenePos()).length();
+ qreal distance = QLineF(scenePos, touchPoint.scenePosition()).length();
if (closestTouchPointId == -1|| distance < closestDistance) {
closestTouchPointId = touchPoint.id();
closestDistance = distance;
@@ -5869,15 +5869,15 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
if (!item) {
// determine which item this touch point will go to
- cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(),
- touchPoint.scenePos(),
+ cachedItemsUnderMouse = itemsAtPosition(touchPoint.globalPosition().toPoint(),
+ touchPoint.scenePosition(),
static_cast<QWidget *>(sceneTouchEvent->target()));
item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.constFirst();
}
if (sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen) {
// on touch-screens, combine this touch point with the closest one we find
- int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos());
+ int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePosition());
QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId);
if (!item || (closestItem && cachedItemsUnderMouse.contains(closestItem)))
item = closestItem;
@@ -5985,8 +5985,8 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
if (focusOnTouch) {
if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.constFirst() != origin) {
const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first();
- cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(),
- firstTouchPoint.scenePos(),
+ cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.globalPosition().toPoint(),
+ firstTouchPoint.scenePosition(),
static_cast<QWidget *>(touchEvent->target()));
}
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 30e386569a..43ee163591 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -318,8 +318,8 @@ void QGraphicsViewPrivate::translateTouchEvent(QGraphicsViewPrivate *d, QTouchEv
const QSizeF ellipseDiameters = touchPoint.ellipseDiameters();
// the scene will set the item local pos, startPos, lastPos, and rect before delivering to
// an item, but for now those functions are returning the view's local coordinates
- touchPoint.setScenePos(d->mapToScene(touchPoint.pos()));
- touchPoint.setStartScenePos(d->mapToScene(touchPoint.startPos()));
+ touchPoint.setScenePos(d->mapToScene(touchPoint.position()));
+ touchPoint.setStartScenePos(d->mapToScene(touchPoint.pressPosition()));
touchPoint.setLastScenePos(d->mapToScene(touchPoint.lastPos()));
touchPoint.setEllipseDiameters(ellipseDiameters);
@@ -647,7 +647,7 @@ void QGraphicsViewPrivate::replayLastMouseEvent()
void QGraphicsViewPrivate::storeMouseEvent(QMouseEvent *event)
{
useLastMouseEvent = true;
- lastMouseEvent = QMouseEvent(QEvent::MouseMove, event->localPos(), event->windowPos(), event->screenPos(),
+ lastMouseEvent = QMouseEvent(QEvent::MouseMove, event->position(), event->scenePosition(), event->globalPosition(),
event->button(), event->buttons(), event->modifiers());
}
@@ -673,8 +673,8 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
mouseEvent.setWidget(viewport);
mouseEvent.setButtonDownScenePos(mousePressButton, mousePressScenePoint);
mouseEvent.setButtonDownScreenPos(mousePressButton, mousePressScreenPoint);
- mouseEvent.setScenePos(q->mapToScene(event->pos()));
- mouseEvent.setScreenPos(event->globalPos());
+ mouseEvent.setScenePos(q->mapToScene(event->position().toPoint()));
+ mouseEvent.setScreenPos(event->globalPosition().toPoint());
mouseEvent.setLastScenePos(lastMouseMoveScenePoint);
mouseEvent.setLastScreenPos(lastMouseMoveScreenPoint);
mouseEvent.setButtons(event->buttons());
@@ -753,7 +753,7 @@ void QGraphicsViewPrivate::updateRubberBand(const QMouseEvent *event)
if (dragMode != QGraphicsView::RubberBandDrag || !sceneInteractionAllowed || !rubberBanding)
return;
// Check for enough drag distance
- if ((mousePressViewPoint - event->pos()).manhattanLength() < QApplication::startDragDistance())
+ if ((mousePressViewPoint - event->position().toPoint()).manhattanLength() < QApplication::startDragDistance())
return;
// Update old rubberband
@@ -780,7 +780,7 @@ void QGraphicsViewPrivate::updateRubberBand(const QMouseEvent *event)
// Update rubberband position
const QPoint mp = q->mapFromScene(mousePressScenePoint);
- const QPoint ep = event->pos();
+ const QPoint ep = event->position().toPoint();
rubberBandRect = QRect(qMin(mp.x(), ep.x()), qMin(mp.y(), ep.y()),
qAbs(mp.x() - ep.x()) + 1, qAbs(mp.y() - ep.y()) + 1);
@@ -848,7 +848,7 @@ void QGraphicsViewPrivate::_q_setViewportCursor(const QCursor &cursor)
void QGraphicsViewPrivate::_q_unsetViewportCursor()
{
Q_Q(QGraphicsView);
- const auto items = q->items(lastMouseEvent.pos());
+ const auto items = q->items(lastMouseEvent.position().toPoint());
for (QGraphicsItem *item : items) {
if (item->isEnabled() && item->hasCursor()) {
_q_setViewportCursor(item->cursor());
@@ -894,10 +894,10 @@ void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEven
{
#if QT_CONFIG(draganddrop)
Q_Q(QGraphicsView);
- dest->setScenePos(q->mapToScene(source->pos()));
- dest->setScreenPos(q->mapToGlobal(source->pos()));
- dest->setButtons(source->mouseButtons());
- dest->setModifiers(source->keyboardModifiers());
+ dest->setScenePos(q->mapToScene(source->position().toPoint()));
+ dest->setScreenPos(q->mapToGlobal(source->position().toPoint()));
+ dest->setButtons(source->buttons());
+ dest->setModifiers(source->modifiers());
dest->setPossibleActions(source->possibleActions());
dest->setProposedAction(source->proposedAction());
dest->setDropAction(source->dropAction());
@@ -3179,9 +3179,9 @@ void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event)
return;
d->storeMouseEvent(event);
- d->mousePressViewPoint = event->pos();
+ d->mousePressViewPoint = event->position().toPoint();
d->mousePressScenePoint = mapToScene(d->mousePressViewPoint);
- d->mousePressScreenPoint = event->globalPos();
+ d->mousePressScreenPoint = event->globalPosition().toPoint();
d->lastMouseMoveScenePoint = d->mousePressScenePoint;
d->lastMouseMoveScreenPoint = d->mousePressScreenPoint;
d->mousePressButton = event->button();
@@ -3228,9 +3228,9 @@ void QGraphicsView::mousePressEvent(QMouseEvent *event)
if (d->sceneInteractionAllowed) {
// Store some of the event's button-down data.
- d->mousePressViewPoint = event->pos();
+ d->mousePressViewPoint = event->position().toPoint();
d->mousePressScenePoint = mapToScene(d->mousePressViewPoint);
- d->mousePressScreenPoint = event->globalPos();
+ d->mousePressScreenPoint = event->globalPosition().toPoint();
d->lastMouseMoveScenePoint = d->mousePressScenePoint;
d->lastMouseMoveScreenPoint = d->mousePressScreenPoint;
d->mousePressButton = event->button();
@@ -3310,7 +3310,7 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event)
if (d->handScrolling) {
QScrollBar *hBar = horizontalScrollBar();
QScrollBar *vBar = verticalScrollBar();
- QPoint delta = event->pos() - d->lastMouseEvent.pos();
+ QPoint delta = event->position().toPoint() - d->lastMouseEvent.position().toPoint();
hBar->setValue(hBar->value() + (isRightToLeft() ? delta.x() : -delta.x()));
vBar->setValue(vBar->value() - delta.y());
@@ -3364,8 +3364,8 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
mouseEvent.setWidget(viewport());
mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint);
mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint);
- mouseEvent.setScenePos(mapToScene(event->pos()));
- mouseEvent.setScreenPos(event->globalPos());
+ mouseEvent.setScenePos(mapToScene(event->position().toPoint()));
+ mouseEvent.setScreenPos(event->globalPosition().toPoint());
mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint);
mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint);
mouseEvent.setButtons(event->buttons());
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 2b44bac2f3..b99dbb109b 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1693,7 +1693,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
switch (event->type()) {
case QEvent::HoverMove:
case QEvent::HoverEnter:
- d->setHoverIndex(indexAt(static_cast<QHoverEvent*>(event)->pos()));
+ d->setHoverIndex(indexAt(static_cast<QHoverEvent*>(event)->position().toPoint()));
break;
case QEvent::HoverLeave:
d->setHoverIndex(QModelIndex());
@@ -1756,7 +1756,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
{
Q_D(QAbstractItemView);
d->delayedAutoScroll.stop(); //any interaction with the view cancel the auto scrolling
- QPoint pos = event->pos();
+ QPoint pos = event->position().toPoint();
QPersistentModelIndex index = indexAt(pos);
if (!d->selectionModel
@@ -1822,7 +1822,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QAbstractItemView);
QPoint topLeft;
- QPoint bottomRight = event->pos();
+ QPoint bottomRight = event->position().toPoint();
if (state() == ExpandingState || state() == CollapsingState)
return;
@@ -1901,7 +1901,7 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QAbstractItemView);
- QPoint pos = event->pos();
+ QPoint pos = event->position().toPoint();
QPersistentModelIndex index = indexAt(pos);
if (state() == EditingState) {
@@ -1949,12 +1949,12 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_D(QAbstractItemView);
- QModelIndex index = indexAt(event->pos());
+ QModelIndex index = indexAt(event->position().toPoint());
if (!index.isValid()
|| !d->isIndexEnabled(index)
|| (d->pressedIndex != index)) {
QMouseEvent me(QEvent::MouseButtonPress,
- event->localPos(), event->windowPos(), event->screenPos(),
+ event->position(), event->scenePosition(), event->globalPosition(),
event->button(), event->buttons(), event->modifiers(), event->source());
mousePressEvent(&me);
return;
@@ -2009,14 +2009,14 @@ void QAbstractItemView::dragMoveEvent(QDragMoveEvent *event)
// ignore by default
event->ignore();
- QModelIndex index = indexAt(event->pos());
+ QModelIndex index = indexAt(event->position().toPoint());
d->hover = index;
if (!d->droppingOnItself(event, index)
&& d->canDrop(event)) {
if (index.isValid() && d->showDropIndicator) {
QRect rect = visualRect(index);
- d->dropIndicatorPosition = d->position(event->pos(), rect, index);
+ d->dropIndicatorPosition = d->position(event->position().toPoint(), rect, index);
switch (d->dropIndicatorPosition) {
case AboveItem:
if (d->isIndexDropEnabled(index.parent())) {
@@ -2059,7 +2059,7 @@ void QAbstractItemView::dragMoveEvent(QDragMoveEvent *event)
d->viewport->update();
} // can drop
- if (d->shouldAutoScroll(event->pos()))
+ if (d->shouldAutoScroll(event->position().toPoint()))
startAutoScroll();
}
@@ -2156,9 +2156,9 @@ bool QAbstractItemViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *drop
QModelIndex index;
// rootIndex() (i.e. the viewport) might be a valid index
- if (viewport->rect().contains(event->pos())) {
- index = q->indexAt(event->pos());
- if (!index.isValid() || !q->visualRect(index).contains(event->pos()))
+ if (viewport->rect().contains(event->position().toPoint())) {
+ index = q->indexAt(event->position().toPoint());
+ if (!index.isValid() || !q->visualRect(index).contains(event->position().toPoint()))
index = root;
}
@@ -2167,7 +2167,7 @@ bool QAbstractItemViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *drop
int row = -1;
int col = -1;
if (index != root) {
- dropIndicatorPosition = position(event->pos(), q->visualRect(index), index);
+ dropIndicatorPosition = position(event->position().toPoint(), q->visualRect(index), index);
switch (dropIndicatorPosition) {
case QAbstractItemView::AboveItem:
row = index.row();
diff --git a/src/widgets/itemviews/qcolumnviewgrip.cpp b/src/widgets/itemviews/qcolumnviewgrip.cpp
index 00cd7df20a..424839d396 100644
--- a/src/widgets/itemviews/qcolumnviewgrip.cpp
+++ b/src/widgets/itemviews/qcolumnviewgrip.cpp
@@ -149,7 +149,7 @@ void QColumnViewGrip::mouseDoubleClickEvent(QMouseEvent *event)
void QColumnViewGrip::mousePressEvent(QMouseEvent *event)
{
Q_D(QColumnViewGrip);
- d->originalXLocation = event->globalX();
+ d->originalXLocation = event->globalPosition().toPoint().x();
event->accept();
}
@@ -160,7 +160,7 @@ void QColumnViewGrip::mousePressEvent(QMouseEvent *event)
void QColumnViewGrip::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QColumnViewGrip);
- int offset = event->globalX() - d->originalXLocation;
+ int offset = event->globalPosition().toPoint().x() - d->originalXLocation;
d->originalXLocation = moveGrip(offset) + d->originalXLocation;
event->accept();
}
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index fce0834628..e127f7bba4 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2371,7 +2371,7 @@ bool QHeaderView::event(QEvent *e)
switch (e->type()) {
case QEvent::HoverEnter: {
QHoverEvent *he = static_cast<QHoverEvent*>(e);
- d->hover = logicalIndexAt(he->pos());
+ d->hover = logicalIndexAt(he->position().toPoint());
if (d->hover != -1)
updateSection(d->hover);
break; }
@@ -2384,7 +2384,7 @@ bool QHeaderView::event(QEvent *e)
case QEvent::HoverMove: {
QHoverEvent *he = static_cast<QHoverEvent*>(e);
int oldHover = d->hover;
- d->hover = logicalIndexAt(he->pos());
+ d->hover = logicalIndexAt(he->position().toPoint());
if (d->hover != oldHover) {
if (oldHover != -1)
updateSection(oldHover);
@@ -2524,7 +2524,7 @@ void QHeaderView::mousePressEvent(QMouseEvent *e)
Q_D(QHeaderView);
if (d->state != QHeaderViewPrivate::NoState || e->button() != Qt::LeftButton)
return;
- int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
+ int pos = d->orientation == Qt::Horizontal ? e->position().toPoint().x() : e->position().toPoint().y();
int handle = d->sectionHandleAt(pos);
d->originalSize = -1; // clear the stored original size
if (handle == -1) {
@@ -2566,7 +2566,7 @@ void QHeaderView::mousePressEvent(QMouseEvent *e)
void QHeaderView::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QHeaderView);
- int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
+ int pos = d->orientation == Qt::Horizontal ? e->position().toPoint().x() : e->position().toPoint().y();
if (pos < 0 && d->state != QHeaderViewPrivate::SelectSections)
return;
if (e->buttons() == Qt::NoButton) {
@@ -2594,7 +2594,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
return;
}
case QHeaderViewPrivate::MoveSection: {
- if (d->shouldAutoScroll(e->pos()))
+ if (d->shouldAutoScroll(e->position().toPoint()))
d->startAutoScroll();
if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
#if QT_CONFIG(label)
@@ -2678,7 +2678,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
{
Q_D(QHeaderView);
- int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
+ int pos = d->orientation == Qt::Horizontal ? e->position().toPoint().x() : e->position().toPoint().y();
switch (d->state) {
case QHeaderViewPrivate::MoveSection:
if (true
@@ -2731,7 +2731,7 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e)
{
Q_D(QHeaderView);
- int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
+ int pos = d->orientation == Qt::Horizontal ? e->position().toPoint().x() : e->position().toPoint().y();
int handle = d->sectionHandleAt(pos);
if (handle > -1 && sectionResizeMode(handle) == Interactive) {
emit sectionHandleDoubleClicked(handle);
@@ -2746,7 +2746,7 @@ void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e)
}
#endif
} else {
- emit sectionDoubleClicked(logicalIndexAt(e->pos()));
+ emit sectionDoubleClicked(logicalIndexAt(e->position().toPoint()));
}
}
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index 407610336c..ddcc9a637e 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -1177,7 +1177,7 @@ bool QItemDelegate::editorEvent(QEvent *event,
QRect emptyRect;
doLayout(option, &checkRect, &emptyRect, &emptyRect, false);
QMouseEvent *me = static_cast<QMouseEvent*>(event);
- if (me->button() != Qt::LeftButton || !checkRect.contains(me->pos()))
+ if (me->button() != Qt::LeftButton || !checkRect.contains(me->position().toPoint()))
return false;
// eat the double click events inside the check rect
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index ed8fd88996..053b2dd959 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -785,7 +785,7 @@ void QListView::mouseMoveEvent(QMouseEvent *e)
&& d->showElasticBand
&& d->selectionMode != SingleSelection
&& d->selectionMode != NoSelection) {
- QRect rect(d->pressedPosition, e->pos() + QPoint(horizontalOffset(), verticalOffset()));
+ QRect rect(d->pressedPosition, e->position().toPoint() + QPoint(horizontalOffset(), verticalOffset()));
rect = rect.normalized();
d->viewport->update(d->mapToViewport(rect.united(d->elasticBand)));
d->elasticBand = rect;
@@ -2135,7 +2135,7 @@ void QListModeViewBase::dragMoveEvent(QDragMoveEvent *event)
event->ignore();
// can't use indexAt, doesn't account for spacing.
- QPoint p = event->pos();
+ QPoint p = event->position().toPoint();
QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect);
@@ -2147,7 +2147,7 @@ void QListModeViewBase::dragMoveEvent(QDragMoveEvent *event)
if (index.isValid() && dd->showDropIndicator) {
QRect rect = qq->visualRect(index);
- dd->dropIndicatorPosition = position(event->pos(), rect, index);
+ dd->dropIndicatorPosition = position(event->position().toPoint(), rect, index);
// if spacing, should try to draw between items, not just next to item.
switch (dd->dropIndicatorPosition) {
case QAbstractItemView::AboveItem:
@@ -2191,7 +2191,7 @@ void QListModeViewBase::dragMoveEvent(QDragMoveEvent *event)
dd->viewport->update();
} // can drop
- if (dd->shouldAutoScroll(event->pos()))
+ if (dd->shouldAutoScroll(event->position().toPoint()))
qq->startAutoScroll();
}
@@ -2212,9 +2212,9 @@ bool QListModeViewBase::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QM
return false;
QModelIndex index;
- if (dd->viewport->rect().contains(event->pos())) {
+ if (dd->viewport->rect().contains(event->position().toPoint())) {
// can't use indexAt, doesn't account for spacing.
- QPoint p = event->pos();
+ QPoint p = event->position().toPoint();
QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect);
@@ -2229,7 +2229,7 @@ bool QListModeViewBase::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QM
int row = -1;
int col = -1;
if (index != dd->root) {
- dd->dropIndicatorPosition = position(event->pos(), qq->visualRect(index), index);
+ dd->dropIndicatorPosition = position(event->position().toPoint(), qq->visualRect(index), index);
switch (dd->dropIndicatorPosition) {
case QAbstractItemView::AboveItem:
row = index.row();
@@ -2896,7 +2896,7 @@ bool QIconModeViewBase::filterDropEvent(QDropEvent *e)
const QSize contents = contentsSize;
QPoint offset(horizontalOffset(), verticalOffset());
- QPoint end = e->pos() + offset;
+ QPoint end = e->position().toPoint() + offset;
if (qq->acceptDrops()) {
const Qt::ItemFlags dropableFlags = Qt::ItemIsDropEnabled|Qt::ItemIsEnabled;
const QVector<QModelIndex> &dropIndices = intersectingSet(QRect(end, QSize(1, 1)));
@@ -2957,17 +2957,17 @@ bool QIconModeViewBase::filterDragMoveEvent(QDragMoveEvent *e)
QRect itemsRect = this->itemsRect(draggedItems);
viewport()->update(itemsRect.translated(draggedItemsDelta()));
// update position
- draggedItemsPos = e->pos();
+ draggedItemsPos = e->position().toPoint();
// get new items rect
viewport()->update(itemsRect.translated(draggedItemsDelta()));
// set the item under the cursor to current
QModelIndex index;
if (movement() == QListView::Snap) {
- QRect rect(snapToGrid(e->pos() + offset()), gridSize());
+ QRect rect(snapToGrid(e->position().toPoint() + offset()), gridSize());
const QVector<QModelIndex> intersectVector = intersectingSet(rect);
index = intersectVector.count() > 0 ? intersectVector.last() : QModelIndex();
} else {
- index = qq->indexAt(e->pos());
+ index = qq->indexAt(e->position().toPoint());
}
// check if we allow drops here
if (draggedItems.contains(index))
@@ -2978,7 +2978,7 @@ bool QIconModeViewBase::filterDragMoveEvent(QDragMoveEvent *e)
e->accept(); // allow dropping in empty areas
// the event was treated. do autoscrolling
- if (dd->shouldAutoScroll(e->pos()))
+ if (dd->shouldAutoScroll(e->position().toPoint()))
dd->startAutoScroll();
return true;
}
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index c685cc7f05..58f949656b 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -612,7 +612,7 @@ bool QStyledItemDelegate::editorEvent(QEvent *event,
initStyleOption(&viewOpt, index);
QRect checkRect = style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &viewOpt, widget);
QMouseEvent *me = static_cast<QMouseEvent*>(event);
- if (me->button() != Qt::LeftButton || !checkRect.contains(me->pos()))
+ if (me->button() != Qt::LeftButton || !checkRect.contains(me->position().toPoint()))
return false;
if ((event->type() == QEvent::MouseButtonPress)
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index e3d957d83c..6606b3f2f9 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1297,8 +1297,8 @@ bool QTreeView::viewportEvent(QEvent *event)
case QEvent::HoverMove: {
QHoverEvent *he = static_cast<QHoverEvent*>(event);
int oldBranch = d->hoverBranch;
- d->hoverBranch = d->itemDecorationAt(he->pos());
- QModelIndex newIndex = indexAt(he->pos());
+ d->hoverBranch = d->itemDecorationAt(he->position().toPoint());
+ QModelIndex newIndex = indexAt(he->position().toPoint());
if (d->hover != newIndex || d->hoverBranch != oldBranch) {
// Update the whole hovered over row. No need to update the old hovered
// row, that is taken care in superclass hover handling.
@@ -1907,8 +1907,8 @@ void QTreeView::mousePressEvent(QMouseEvent *event)
Q_D(QTreeView);
bool handled = false;
if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, this) == QEvent::MouseButtonPress)
- handled = d->expandOrCollapseItemAtPos(event->pos());
- if (!handled && d->itemDecorationAt(event->pos()) == -1)
+ handled = d->expandOrCollapseItemAtPos(event->position().toPoint());
+ if (!handled && d->itemDecorationAt(event->position().toPoint()) == -1)
QAbstractItemView::mousePressEvent(event);
else
d->pressedIndex = QModelIndex();
@@ -1920,13 +1920,13 @@ void QTreeView::mousePressEvent(QMouseEvent *event)
void QTreeView::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QTreeView);
- if (d->itemDecorationAt(event->pos()) == -1) {
+ if (d->itemDecorationAt(event->position().toPoint()) == -1) {
QAbstractItemView::mouseReleaseEvent(event);
} else {
if (state() == QAbstractItemView::DragSelectingState || state() == QAbstractItemView::DraggingState)
setState(QAbstractItemView::NoState);
if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, this) == QEvent::MouseButtonRelease)
- d->expandOrCollapseItemAtPos(event->pos());
+ d->expandOrCollapseItemAtPos(event->position().toPoint());
}
}
@@ -1936,17 +1936,17 @@ void QTreeView::mouseReleaseEvent(QMouseEvent *event)
void QTreeView::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_D(QTreeView);
- if (state() != NoState || !d->viewport->rect().contains(event->pos()))
+ if (state() != NoState || !d->viewport->rect().contains(event->position().toPoint()))
return;
- int i = d->itemDecorationAt(event->pos());
+ int i = d->itemDecorationAt(event->position().toPoint());
if (i == -1) {
- i = d->itemAtCoordinate(event->y());
+ i = d->itemAtCoordinate(event->position().toPoint().y());
if (i == -1)
return; // user clicked outside the items
const QPersistentModelIndex firstColumnIndex = d->viewItems.at(i).index;
- const QPersistentModelIndex persistent = indexAt(event->pos());
+ const QPersistentModelIndex persistent = indexAt(event->position().toPoint());
if (d->pressedIndex != persistent) {
mousePressEvent(event);
@@ -1995,7 +1995,7 @@ void QTreeView::mouseDoubleClickEvent(QMouseEvent *event)
void QTreeView::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QTreeView);
- if (d->itemDecorationAt(event->pos()) == -1) // ### what about expanding/collapsing state ?
+ if (d->itemDecorationAt(event->position().toPoint()) == -1) // ### what about expanding/collapsing state ?
QAbstractItemView::mouseMoveEvent(event);
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 5ede5b0e0f..0e96e8bc69 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2380,7 +2380,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
const bool graphicsWidget = nativeWidget->testAttribute(Qt::WA_DontShowOnScreen);
- bool widgetUnderMouse = QRectF(receiver->rect()).contains(event->localPos());
+ bool widgetUnderMouse = QRectF(receiver->rect()).contains(event->position());
// Clear the obsolete leaveAfterRelease value, if mouse button has been released but
// leaveAfterRelease has not been updated.
@@ -2406,9 +2406,9 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
|| (isAlien(lastMouseReceiver) && !alienWidget)) {
if (activePopupWidget) {
if (!QWidget::mouseGrabber())
- dispatchEnterLeave(alienWidget ? alienWidget : nativeWidget, lastMouseReceiver, event->screenPos());
+ dispatchEnterLeave(alienWidget ? alienWidget : nativeWidget, lastMouseReceiver, event->globalPosition());
} else {
- dispatchEnterLeave(receiver, lastMouseReceiver, event->screenPos());
+ dispatchEnterLeave(receiver, lastMouseReceiver, event->globalPosition());
}
}
@@ -2416,7 +2416,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
#ifdef ALIEN_DEBUG
qDebug() << "QApplicationPrivate::sendMouseEvent: receiver:" << receiver
- << "pos:" << event->pos() << "alien" << alienWidget << "button down"
+ << "pos:" << event->position() << "alien" << alienWidget << "button down"
<< *buttonDown << "last" << lastMouseReceiver << "leave after release"
<< leaveAfterRelease;
#endif
@@ -2445,8 +2445,8 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
if (nativeGuard)
enter = alienGuard ? alienWidget : nativeWidget;
else // The receiver is typically deleted on mouse release with drag'n'drop.
- enter = QApplication::widgetAt(event->globalPos());
- dispatchEnterLeave(enter, leaveAfterRelease, event->screenPos());
+ enter = QApplication::widgetAt(event->globalPosition().toPoint());
+ dispatchEnterLeave(enter, leaveAfterRelease, event->globalPosition());
leaveAfterRelease = nullptr;
lastMouseReceiver = enter;
} else if (!wasLeaveAfterRelease) {
@@ -2454,7 +2454,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
if (!QWidget::mouseGrabber())
lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : nullptr);
} else {
- lastMouseReceiver = receiverGuard ? receiver : QApplication::widgetAt(event->globalPos());
+ lastMouseReceiver = receiverGuard ? receiver : QApplication::widgetAt(event->globalPosition().toPoint());
}
}
@@ -2904,7 +2904,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QWidget* w = static_cast<QWidget *>(receiver);
QMouseEvent* mouse = static_cast<QMouseEvent*>(e);
- QPoint relpos = mouse->pos();
+ QPoint relpos = mouse->position().toPoint();
if (e->spontaneous()) {
if (e->type() != QEvent::MouseMove)
@@ -2921,7 +2921,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
&& w->rect().contains(relpos)) { // Outside due to mouse grab?
d->toolTipWidget = w;
d->toolTipPos = relpos;
- d->toolTipGlobalPos = mouse->globalPos();
+ d->toolTipGlobalPos = mouse->globalPosition().toPoint();
QStyle *s = d->toolTipWidget->style();
int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, nullptr, d->toolTipWidget, nullptr);
d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive() ? 20 : wakeDelay, this);
@@ -2932,7 +2932,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QPointer<QWidget> pw = w;
while (w) {
- QMouseEvent me(mouse->type(), relpos, mouse->windowPos(), mouse->globalPos(),
+ QMouseEvent me(mouse->type(), relpos, mouse->scenePosition(), mouse->globalPosition().toPoint(),
mouse->button(), mouse->buttons(), mouse->modifiers(), mouse->source());
me.spont = mouse->spontaneous();
me.setTimestamp(mouse->timestamp());
@@ -2964,7 +2964,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break;
w = static_cast<QWidget *>(receiver);
- relpos = mouse->pos();
+ relpos = mouse->position().toPoint();
QPoint diff = relpos - w->mapFromGlobal(d->hoverGlobalPos);
while (w) {
if (w->testAttribute(Qt::WA_Hover) &&
@@ -2979,7 +2979,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
}
- d->hoverGlobalPos = mouse->globalPos();
+ d->hoverGlobalPos = mouse->globalPosition().toPoint();
}
break;
#if QT_CONFIG(wheelevent)
@@ -3109,10 +3109,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
{
QWidget *w = static_cast<QWidget *>(receiver);
QTabletEvent *tablet = static_cast<QTabletEvent*>(e);
- QPointF relpos = tablet->posF();
+ QPointF relpos = tablet->position();
bool eventAccepted = tablet->isAccepted();
while (w) {
- QTabletEvent te(tablet->type(), relpos, tablet->globalPosF(),
+ QTabletEvent te(tablet->type(), relpos, tablet->globalPosition(),
tablet->deviceType(), tablet->pointerType(),
tablet->pressure(), tablet->xTilt(), tablet->yTilt(),
tablet->tangentialPressure(), tablet->rotation(), tablet->z(),
@@ -3246,7 +3246,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents);
if (acceptTouchEvents && e->spontaneous()) {
- const QPoint localPos = touchEvent->touchPoints()[0].pos().toPoint();
+ const QPoint localPos = touchEvent->touchPoints()[0].position().toPoint();
QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, e, localPos);
}
@@ -3286,8 +3286,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
touchEvent->setTarget(widget);
for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) {
QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i];
- pt.d->pos = pt.pos() + offset;
- pt.d->startPos = pt.startPos() + offset;
+ pt.d->pos = pt.position() + offset;
+ pt.d->startPos = pt.pressPosition() + offset;
pt.d->lastPos = pt.lastPos() + offset;
}
}
@@ -3936,11 +3936,11 @@ bool QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven
QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i];
// preserve the sub-pixel resolution
- const QPointF screenPos = touchPoint.screenPos();
+ const QPointF screenPos = touchPoint.globalPosition();
const QPointF delta = screenPos - screenPos.toPoint();
touchPoint.d->pos = widget->mapFromGlobal(screenPos.toPoint()) + delta;
- touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
+ touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.globalPressPosition().toPoint()) + delta;
touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
if (touchPoint.state() == Qt::TouchPointPressed)
@@ -3969,7 +3969,7 @@ void QApplicationPrivate::cleanupMultitouch_sys()
QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint)
{
- const QPointF screenPos = touchPoint.screenPos();
+ const QPointF screenPos = touchPoint.globalPosition();
int closestTouchPointId = -1;
QObject *closestTarget = nullptr;
qreal closestDistance = qreal(0.);
@@ -3978,8 +3978,8 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device,
while (it != ite) {
if (it.key().device == device && it.key().touchPointId != touchPoint.id()) {
const QTouchEvent::TouchPoint &touchPoint = it->touchPoint;
- qreal dx = screenPos.x() - touchPoint.screenPos().x();
- qreal dy = screenPos.y() - touchPoint.screenPos().y();
+ qreal dx = screenPos.x() - touchPoint.globalPosition().x();
+ qreal dy = screenPos.y() - touchPoint.globalPosition().y();
qreal distance = dx * dx + dy * dy;
if (closestTouchPointId == -1 || distance < closestDistance) {
closestTouchPointId = touchPoint.id();
@@ -4034,10 +4034,10 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
if (!target) {
// determine which widget this event will go to
if (!window)
- window = QApplication::topLevelAt(touchPoint.screenPos().toPoint());
+ window = QApplication::topLevelAt(touchPoint.globalPosition().toPoint());
if (!window)
continue;
- target = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint()));
+ target = window->childAt(window->mapFromGlobal(touchPoint.globalPosition().toPoint()));
if (!target)
target = window;
}
diff --git a/src/widgets/kernel/qmacgesturerecognizer.cpp b/src/widgets/kernel/qmacgesturerecognizer.cpp
index aac115a2cf..f14b2f6e6c 100644
--- a/src/widgets/kernel/qmacgesturerecognizer.cpp
+++ b/src/widgets/kernel/qmacgesturerecognizer.cpp
@@ -67,7 +67,7 @@ QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
case Qt::SwipeNativeGesture: {
QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
g->setSwipeAngle(ev->value());
- g->setHotSpot(ev->screenPos());
+ g->setHotSpot(ev->globalPosition());
return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
break; }
default:
@@ -105,11 +105,11 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
switch (ev->gestureType()) {
case Qt::BeginNativeGesture:
reset(gesture);
- g->setStartCenterPoint(static_cast<QWidget*>(obj)->mapFromGlobal(ev->screenPos().toPoint()));
+ g->setStartCenterPoint(static_cast<QWidget*>(obj)->mapFromGlobal(ev->globalPosition().toPoint()));
g->setCenterPoint(g->startCenterPoint());
g->setChangeFlags(QPinchGesture::CenterPointChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
- g->setHotSpot(ev->screenPos());
+ g->setHotSpot(ev->globalPosition());
return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
case Qt::RotateNativeGesture:
g->setLastScaleFactor(g->scaleFactor());
@@ -117,7 +117,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
g->setRotationAngle(g->rotationAngle() + ev->value());
g->setChangeFlags(QPinchGesture::RotationAngleChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
- g->setHotSpot(ev->screenPos());
+ g->setHotSpot(ev->globalPosition());
return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
case Qt::ZoomNativeGesture:
g->setLastScaleFactor(g->scaleFactor());
@@ -126,7 +126,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
g->setTotalScaleFactor(g->totalScaleFactor() * g->scaleFactor());
g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
- g->setHotSpot(ev->screenPos());
+ g->setHotSpot(ev->globalPosition());
return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
case Qt::SmartZoomNativeGesture:
g->setLastScaleFactor(g->scaleFactor());
@@ -134,7 +134,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
g->setScaleFactor(ev->value() ? 1.7f : 1.0f);
g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
- g->setHotSpot(ev->screenPos());
+ g->setHotSpot(ev->globalPosition());
return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
case Qt::EndNativeGesture:
return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index a5c204d59d..1563e89c45 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -76,7 +76,7 @@ static QPointF panOffset(const QList<QTouchEvent::TouchPoint> &touchPoints, int
QPointF result;
const int count = qMin(touchPoints.size(), maxCount);
for (int p = 0; p < count; ++p)
- result += touchPoints.at(p).pos() - touchPoints.at(p).startPos();
+ result += touchPoints.at(p).position() - touchPoints.at(p).pressPosition();
return result / qreal(count);
}
@@ -117,7 +117,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state,
d->offset = panOffset(ev->touchPoints(), d->pointCount);
if (d->offset.x() > 10 || d->offset.y() > 10 ||
d->offset.x() < -10 || d->offset.y() < -10) {
- q->setHotSpot(ev->touchPoints().first().startScreenPos());
+ q->setHotSpot(ev->touchPoints().first().globalPressPosition());
result = QGestureRecognizer::TriggerGesture;
} else {
result = QGestureRecognizer::MayBeGesture;
@@ -188,13 +188,13 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
- d->hotSpot = p1.screenPos();
+ d->hotSpot = p1.globalPosition();
d->isHotSpotSet = true;
- QPointF centerPoint = (p1.screenPos() + p2.screenPos()) / 2.0;
+ QPointF centerPoint = (p1.globalPosition() + p2.globalPosition()) / 2.0;
if (d->isNewSequence) {
- d->startPosition[0] = p1.screenPos();
- d->startPosition[1] = p2.screenPos();
+ d->startPosition[0] = p1.globalPosition();
+ d->startPosition[1] = p2.globalPosition();
d->lastCenterPoint = centerPoint;
} else {
d->lastCenterPoint = d->centerPoint;
@@ -208,7 +208,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
d->lastScaleFactor = 1.0;
} else {
d->lastScaleFactor = d->scaleFactor;
- QLineF line(p1.screenPos(), p2.screenPos());
+ QLineF line(p1.globalPosition(), p2.globalPosition());
QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos());
qreal newScaleFactor = line.length() / lastLine.length();
if (newScaleFactor > kSingleStepScaleMax || newScaleFactor < kSingleStepScaleMin)
@@ -218,10 +218,10 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
d->totalScaleFactor = d->totalScaleFactor * d->scaleFactor;
d->changeFlags |= QPinchGesture::ScaleFactorChanged;
- qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle();
+ qreal angle = QLineF(p1.globalPosition(), p2.globalPosition()).angle();
if (angle > 180)
angle -= 360;
- qreal startAngle = QLineF(p1.startScreenPos(), p2.startScreenPos()).angle();
+ qreal startAngle = QLineF(p1.globalPressPosition(), p2.globalPressPosition()).angle();
if (startAngle > 180)
startAngle -= 360;
const qreal rotationAngle = startAngle - angle;
@@ -320,34 +320,34 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
QTouchEvent::TouchPoint p3 = ev->touchPoints().at(2);
if (d->lastPositions[0].isNull()) {
- d->lastPositions[0] = p1.startScreenPos().toPoint();
- d->lastPositions[1] = p2.startScreenPos().toPoint();
- d->lastPositions[2] = p3.startScreenPos().toPoint();
+ d->lastPositions[0] = p1.globalPressPosition().toPoint();
+ d->lastPositions[1] = p2.globalPressPosition().toPoint();
+ d->lastPositions[2] = p3.globalPressPosition().toPoint();
}
- d->hotSpot = p1.screenPos();
+ d->hotSpot = p1.globalPosition();
d->isHotSpotSet = true;
- int xDistance = (p1.screenPos().x() - d->lastPositions[0].x() +
- p2.screenPos().x() - d->lastPositions[1].x() +
- p3.screenPos().x() - d->lastPositions[2].x()) / 3;
- int yDistance = (p1.screenPos().y() - d->lastPositions[0].y() +
- p2.screenPos().y() - d->lastPositions[1].y() +
- p3.screenPos().y() - d->lastPositions[2].y()) / 3;
+ int xDistance = (p1.globalPosition().x() - d->lastPositions[0].x() +
+ p2.globalPosition().x() - d->lastPositions[1].x() +
+ p3.globalPosition().x() - d->lastPositions[2].x()) / 3;
+ int yDistance = (p1.globalPosition().y() - d->lastPositions[0].y() +
+ p2.globalPosition().y() - d->lastPositions[1].y() +
+ p3.globalPosition().y() - d->lastPositions[2].y()) / 3;
const int distance = xDistance >= yDistance ? xDistance : yDistance;
int elapsedTime = d->time.restart();
if (!elapsedTime)
elapsedTime = 1;
d->velocityValue = 0.9 * d->velocityValue + (qreal) distance / elapsedTime;
- d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle();
+ d->swipeAngle = QLineF(p1.globalPressPosition(), p1.globalPosition()).angle();
static const int MoveThreshold = 50;
static const int directionChangeThreshold = MoveThreshold / 8;
if (qAbs(xDistance) > MoveThreshold || qAbs(yDistance) > MoveThreshold) {
// measure the distance to check if the direction changed
- d->lastPositions[0] = p1.screenPos().toPoint();
- d->lastPositions[1] = p2.screenPos().toPoint();
- d->lastPositions[2] = p3.screenPos().toPoint();
+ d->lastPositions[0] = p1.globalPosition().toPoint();
+ d->lastPositions[1] = p2.globalPosition().toPoint();
+ d->lastPositions[2] = p3.globalPosition().toPoint();
result = QGestureRecognizer::TriggerGesture;
// QTBUG-46195, small changes in direction should not cause the gesture to be canceled.
if (d->verticalDirection == QSwipeGesture::NoDirection || qAbs(yDistance) > directionChangeThreshold) {
@@ -439,8 +439,8 @@ QGestureRecognizer::Result QTapGestureRecognizer::recognize(QGesture *state,
switch (event->type()) {
case QEvent::TouchBegin: {
- d->position = ev->touchPoints().at(0).pos();
- q->setHotSpot(ev->touchPoints().at(0).screenPos());
+ d->position = ev->touchPoints().at(0).position();
+ q->setHotSpot(ev->touchPoints().at(0).globalPosition());
result = QGestureRecognizer::TriggerGesture;
break;
}
@@ -448,7 +448,7 @@ QGestureRecognizer::Result QTapGestureRecognizer::recognize(QGesture *state,
case QEvent::TouchEnd: {
if (q->state() != Qt::NoGesture && ev->touchPoints().size() == 1) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
- QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
+ QPoint delta = p.position().toPoint() - p.pressPosition().toPoint();
enum { TapRadius = 40 };
if (delta.manhattanLength() <= TapRadius) {
if (event->type() == QEvent::TouchEnd)
@@ -526,7 +526,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
#endif
case QEvent::MouseButtonPress: {
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
- d->position = me->globalPos();
+ d->position = me->globalPosition().toPoint();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
@@ -535,7 +535,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
}
case QEvent::TouchBegin: {
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
- d->position = ev->touchPoints().at(0).startScreenPos();
+ d->position = ev->touchPoints().at(0).globalPressPosition();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
@@ -552,7 +552,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
if (d->timerId && ev->touchPoints().size() == 1) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
- QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
+ QPoint delta = p.position().toPoint() - p.pressPosition().toPoint();
if (delta.manhattanLength() <= TapRadius)
return QGestureRecognizer::MayBeGesture;
}
@@ -560,7 +560,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
}
case QEvent::MouseMove: {
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
- QPoint delta = me->globalPos() - d->position.toPoint();
+ QPoint delta = me->globalPosition().toPoint() - d->position.toPoint();
if (d->timerId && delta.manhattanLength() <= TapRadius)
return QGestureRecognizer::MayBeGesture;
return QGestureRecognizer::CancelGesture;
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index e90158cf83..80a87bb3cd 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -264,7 +264,7 @@ void QTipLabel::resizeEvent(QResizeEvent *e)
void QTipLabel::mouseMoveEvent(QMouseEvent *e)
{
if (!rect.isNull()) {
- QPoint pos = e->globalPos();
+ QPoint pos = e->globalPosition().toPoint();
if (widget)
pos = widget->mapFromGlobal(pos);
if (!rect.contains(pos))
@@ -358,7 +358,7 @@ bool QTipLabel::eventFilter(QObject *o, QEvent *e)
break;
case QEvent::MouseMove:
- if (o == widget && !rect.isNull() && !rect.contains(static_cast<QMouseEvent*>(e)->pos()))
+ if (o == widget && !rect.isNull() && !rect.contains(static_cast<QMouseEvent*>(e)->position().toPoint()))
hideTip();
default:
break;
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 17824fba32..fdf90acccc 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -243,9 +243,9 @@ void QWhatsThat::showEvent(QShowEvent *)
void QWhatsThat::mousePressEvent(QMouseEvent* e)
{
pressed = true;
- if (e->button() == Qt::LeftButton && rect().contains(e->pos())) {
+ if (e->button() == Qt::LeftButton && rect().contains(e->position().toPoint())) {
if (doc)
- anchor = doc->documentLayout()->anchorAt(e->pos() - QPoint(hMargin, vMargin));
+ anchor = doc->documentLayout()->anchorAt(e->position().toPoint() - QPoint(hMargin, vMargin));
return;
}
close();
@@ -255,8 +255,8 @@ void QWhatsThat::mouseReleaseEvent(QMouseEvent* e)
{
if (!pressed)
return;
- if (widget && e->button() == Qt::LeftButton && doc && rect().contains(e->pos())) {
- QString a = doc->documentLayout()->anchorAt(e->pos() - QPoint(hMargin, vMargin));
+ if (widget && e->button() == Qt::LeftButton && doc && rect().contains(e->position().toPoint())) {
+ QString a = doc->documentLayout()->anchorAt(e->position().toPoint() - QPoint(hMargin, vMargin));
QString href;
if (anchor == a)
href = a;
@@ -277,7 +277,7 @@ void QWhatsThat::mouseMoveEvent(QMouseEvent* e)
#else
if (!doc)
return;
- QString a = doc->documentLayout()->anchorAt(e->pos() - QPoint(hMargin, vMargin));
+ QString a = doc->documentLayout()->anchorAt(e->position().toPoint() - QPoint(hMargin, vMargin));
if (!a.isEmpty())
setCursor(Qt::PointingHandCursor);
else
@@ -438,7 +438,7 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
QMouseEvent *me = static_cast<QMouseEvent*>(e);
if (me->button() == Qt::RightButton || customWhatsThis)
return false;
- QHelpEvent e(QEvent::WhatsThis, me->pos(), me->globalPos());
+ QHelpEvent e(QEvent::WhatsThis, me->position().toPoint(), me->globalPosition().toPoint());
if (!QCoreApplication::sendEvent(w, &e) || !e.isAccepted())
leaveOnMouseRelease = true;
@@ -447,7 +447,7 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
case QEvent::MouseMove:
{
QMouseEvent *me = static_cast<QMouseEvent*>(e);
- QHelpEvent e(QEvent::QueryWhatsThis, me->pos(), me->globalPos());
+ QHelpEvent e(QEvent::QueryWhatsThis, me->position().toPoint(), me->globalPosition().toPoint());
const bool sentEvent = QCoreApplication::sendEvent(w, &e);
#ifdef QT_NO_CURSOR
Q_UNUSED(sentEvent);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 630ca7fef8..56e558eca0 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -9175,7 +9175,7 @@ void QWidget::mousePressEvent(QMouseEvent *event)
if (QApplication::activePopupWidget() == w) // widget does not want to disappear
w->hide(); // hide at least
}
- if (!rect().contains(event->pos())){
+ if (!rect().contains(event->position().toPoint())){
close();
}
}
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index c1128e2fec..be840e24eb 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -448,7 +448,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
}
} else {
const QEnterEvent *ee = static_cast<QEnterEvent *>(event);
- QWidget *child = m_widget->childAt(ee->pos());
+ QWidget *child = m_widget->childAt(ee->position().toPoint());
QWidget *receiver = child ? child : m_widget.data();
QWidget *leave = nullptr;
if (QApplicationPrivate::inPopupMode() && receiver == m_widget
@@ -457,7 +457,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
// action on first-level menu.
leave = qt_last_mouse_receiver;
}
- QApplicationPrivate::dispatchEnterLeave(receiver, leave, ee->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(receiver, leave, ee->globalPosition());
qt_last_mouse_receiver = receiver;
}
}
@@ -510,9 +510,9 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
if (QApplicationPrivate::inPopupMode()) {
QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget();
- QPoint mapped = event->pos();
+ QPoint mapped = event->position().toPoint();
if (activePopupWidget != m_widget)
- mapped = activePopupWidget->mapFromGlobal(event->globalPos());
+ mapped = activePopupWidget->mapFromGlobal(event->globalPosition().toPoint());
bool releaseAfter = false;
QWidget *popupChild = activePopupWidget->childAt(mapped);
@@ -546,22 +546,22 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
else if (popupChild)
receiver = popupChild;
if (receiver != activePopupWidget)
- widgetPos = receiver->mapFromGlobal(event->globalPos());
+ widgetPos = receiver->mapFromGlobal(event->globalPosition().toPoint());
#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups
const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped);
const bool underMouse = activePopupWidget->underMouse();
if (underMouse != reallyUnderMouse) {
if (reallyUnderMouse) {
- const QPoint receiverMapped = receiver->mapFromGlobal(event->screenPos().toPoint());
+ const QPoint receiverMapped = receiver->mapFromGlobal(event->globalPosition().toPoint());
// Prevent negative mouse position on enter event - this event
// should be properly handled in "handleEnterLeaveEvent()".
if (receiverMapped.x() >= 0 && receiverMapped.y() >= 0) {
- QApplicationPrivate::dispatchEnterLeave(receiver, nullptr, event->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(receiver, nullptr, event->globalPosition());
qt_last_mouse_receiver = receiver;
}
} else {
- QApplicationPrivate::dispatchEnterLeave(nullptr, qt_last_mouse_receiver, event->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(nullptr, qt_last_mouse_receiver, event->globalPosition());
qt_last_mouse_receiver = receiver;
receiver = activePopupWidget;
}
@@ -572,7 +572,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// if the widget that was pressed is gone, then deliver move events without buttons
const auto buttons = event->type() == QEvent::MouseMove && qt_button_down == nullptr
? Qt::NoButton : event->buttons();
- QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(),
+ QMouseEvent e(event->type(), widgetPos, event->scenePosition(), event->globalPosition(),
event->button(), buttons, event->modifiers(), event->source());
e.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver);
@@ -598,7 +598,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
qt_button_down = nullptr;
if (event->type() == QEvent::MouseButtonPress) {
// the popup disappeared, replay the mouse press event
- QWidget *w = QApplication::widgetAt(event->globalPos());
+ QWidget *w = QApplication::widgetAt(event->globalPosition().toPoint());
if (w && !QApplicationPrivate::isBlockedByModal(w)) {
// activate window of the widget under mouse pointer
if (!w->isActiveWindow()) {
@@ -610,10 +610,10 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
const QRect globalGeometry = win->isTopLevel()
? win->geometry()
: QRect(win->mapToGlobal(QPoint(0, 0)), win->size());
- if (globalGeometry.contains(event->globalPos())) {
+ if (globalGeometry.contains(event->globalPosition().toPoint())) {
// Use postEvent() to ensure the local QEventLoop terminates when called from QMenu::exec()
- const QPoint localPos = win->mapFromGlobal(event->globalPos());
- QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, localPos, localPos, event->globalPos(),
+ const QPoint localPos = win->mapFromGlobal(event->globalPosition().toPoint());
+ QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, localPos, localPos, event->globalPosition().toPoint(),
event->button(), event->buttons(), event->modifiers(), event->source());
QCoreApplicationPrivate::setEventSpontaneous(e, true);
e->setTimestamp(event->timestamp());
@@ -632,7 +632,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
receiver = qt_button_down;
else if(popupChild)
receiver = popupChild;
- QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());
+ QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers());
QApplication::forwardEvent(receiver, &e, event);
}
#else
@@ -653,8 +653,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
return;
// which child should have it?
- QWidget *widget = m_widget->childAt(event->pos());
- QPoint mapped = event->pos();
+ QWidget *widget = m_widget->childAt(event->position().toPoint());
+ QPoint mapped = event->position().toPoint();
if (!widget)
widget = m_widget;
@@ -663,7 +663,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (event->type() == QEvent::MouseButtonPress && initialPress)
qt_button_down = widget;
- QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(),
+ QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->scenePosition().toPoint(), &mapped, event->type(), event->buttons(),
qt_button_down, widget);
if (!receiver)
return;
@@ -673,7 +673,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// The preceding statement excludes MouseButtonPress events which caused
// creation of a MouseButtonDblClick event. QTBUG-25831
- QMouseEvent translated(event->type(), mapped, event->windowPos(), event->screenPos(),
+ QMouseEvent translated(event->type(), mapped, event->scenePosition(), event->globalPosition(),
event->button(), event->buttons(), event->modifiers(), event->source());
translated.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget,
@@ -682,8 +682,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
}
#ifndef QT_NO_CONTEXTMENU
if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton
- && m_widget->rect().contains(event->pos())) {
- QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());
+ && m_widget->rect().contains(event->position().toPoint())) {
+ QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers());
QGuiApplication::forwardEvent(receiver, &e, event);
}
#endif
@@ -893,16 +893,16 @@ void QWidgetWindow::handleDragEnterEvent(QDragEnterEvent *event, QWidget *widget
{
Q_ASSERT(m_dragTarget == nullptr);
if (!widget)
- widget = findDnDTarget(m_widget, event->pos());
+ widget = findDnDTarget(m_widget, event->position().toPoint());
if (!widget) {
event->ignore();
return;
}
m_dragTarget = widget;
- const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos()));
+ const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->position().toPoint()));
QDragEnterEvent translated(mapped, event->possibleActions(), event->mimeData(),
- event->mouseButtons(), event->keyboardModifiers());
+ event->buttons(), event->modifiers());
QGuiApplication::forwardEvent(m_dragTarget, &translated, event);
event->setAccepted(translated.isAccepted());
event->setDropAction(translated.dropAction());
@@ -910,7 +910,7 @@ void QWidgetWindow::handleDragEnterEvent(QDragEnterEvent *event, QWidget *widget
void QWidgetWindow::handleDragMoveEvent(QDragMoveEvent *event)
{
- QPointer<QWidget> widget = findDnDTarget(m_widget, event->pos());
+ QPointer<QWidget> widget = findDnDTarget(m_widget, event->position().toPoint());
if (!widget) {
event->ignore();
if (m_dragTarget) { // Send DragLeave to previous
@@ -919,9 +919,9 @@ void QWidgetWindow::handleDragMoveEvent(QDragMoveEvent *event)
m_dragTarget = nullptr;
}
} else {
- const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos()));
+ const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->position().toPoint()));
QDragMoveEvent translated(mapped, event->possibleActions(), event->mimeData(),
- event->mouseButtons(), event->keyboardModifiers());
+ event->buttons(), event->modifiers());
if (widget == m_dragTarget) { // Target widget unchanged: Send DragMove
translated.setDropAction(event->dropAction());
@@ -965,8 +965,8 @@ void QWidgetWindow::handleDropEvent(QDropEvent *event)
event->ignore();
return;
}
- const QPoint mapped = m_dragTarget->mapFromGlobal(m_widget->mapToGlobal(event->pos()));
- QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers());
+ const QPoint mapped = m_dragTarget->mapFromGlobal(m_widget->mapToGlobal(event->position().toPoint()));
+ QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers());
QGuiApplication::forwardEvent(m_dragTarget, &translated, event);
event->setAccepted(translated.isAccepted());
event->setDropAction(translated.dropAction());
@@ -1060,7 +1060,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
QWidget *widget = qt_tablet_target;
if (!widget) {
- widget = m_widget->childAt(event->pos());
+ widget = m_widget->childAt(event->position().toPoint());
if (event->type() == QEvent::TabletPress) {
if (!widget)
widget = m_widget;
@@ -1069,9 +1069,9 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
}
if (widget) {
- QPointF delta = event->globalPosF() - event->globalPos();
- QPointF mapped = widget->mapFromGlobal(event->globalPos()) + delta;
- QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->deviceType(), event->pointerType(),
+ QPointF delta = event->globalPosition() - event->globalPosition().toPoint();
+ QPointF mapped = widget->mapFromGlobal(event->globalPosition().toPoint()) + delta;
+ QTabletEvent ev(event->type(), mapped, event->globalPosition(), event->deviceType(), event->pointerType(),
event->pressure(), event->xTilt(), event->yTilt(), event->tangentialPressure(),
event->rotation(), event->z(), event->modifiers(), event->uniqueId(), event->button(), event->buttons());
ev.setTimestamp(event->timestamp());
@@ -1096,7 +1096,7 @@ void QWidgetWindow::handleGestureEvent(QNativeGestureEvent *e)
receiver = popupFocusWidget ? popupFocusWidget : popup;
}
if (!receiver)
- receiver = QApplication::widgetAt(e->globalPos());
+ receiver = QApplication::widgetAt(e->globalPosition().toPoint());
if (!receiver)
receiver = m_widget; // last resort
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
index f404c33a2f..460abe9f50 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
@@ -191,7 +191,7 @@ bool QBasicMouseEventTransition::eventTest(QEvent *event)
QMouseEvent *me = static_cast<QMouseEvent*>(event);
return (me->button() == d->button)
&& ((me->modifiers() & d->modifierMask) == d->modifierMask)
- && (d->path.isEmpty() || d->path.contains(me->pos()));
+ && (d->path.isEmpty() || d->path.contains(me->position().toPoint()));
}
return false;
}
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 064be873b9..ecaf43e207 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -75,7 +75,7 @@ static QMouseEvent *copyMouseEvent(QEvent *e)
case QEvent::MouseButtonRelease:
case QEvent::MouseMove: {
QMouseEvent *me = static_cast<QMouseEvent *>(e);
- QMouseEvent *cme = new QMouseEvent(me->type(), QPoint(0, 0), me->windowPos(), me->screenPos(),
+ QMouseEvent *cme = new QMouseEvent(me->type(), QPoint(0, 0), me->scenePosition(), me->globalPosition(),
me->button(), me->buttons(), me->modifiers(), me->source());
return cme;
}
@@ -159,7 +159,7 @@ public:
if (!pressDelayEvent) {
pressDelayEvent.reset(copyMouseEvent(e));
pressDelayTimer = startTimer(delay);
- mouseTarget = QApplication::widgetAt(pressDelayEvent->globalPos());
+ mouseTarget = QApplication::widgetAt(pressDelayEvent->globalPosition().toPoint());
mouseButton = pressDelayEvent->button();
mouseEventSource = pressDelayEvent->source();
qFGDebug("QFG: consuming/delaying mouse press");
@@ -297,8 +297,8 @@ protected:
#endif // QT_CONFIG(graphicsview)
if (me) {
- QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPos()),
- mouseTarget->topLevelWidget()->mapFromGlobal(me->globalPos()), me->screenPos(),
+ QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPosition().toPoint()),
+ mouseTarget->topLevelWidget()->mapFromGlobal(me->globalPosition().toPoint()), me->globalPosition(),
me->button(), me->buttons(), me->modifiers(), me->source());
qt_sendSpontaneousEvent(mouseTarget, &copy);
}
@@ -437,7 +437,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
return Ignore;
if (button != Qt::NoButton) {
me = static_cast<const QMouseEvent *>(event);
- globalPos = me->globalPos();
+ globalPos = me->globalPosition().toPoint();
}
break;
#if QT_CONFIG(graphicsview)
@@ -458,7 +458,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
if (button == Qt::NoButton) {
te = static_cast<const QTouchEvent *>(event);
if (!te->touchPoints().isEmpty())
- globalPos = te->touchPoints().at(0).screenPos().toPoint();
+ globalPos = te->touchPoints().at(0).globalPosition().toPoint();
}
break;
@@ -492,7 +492,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
switch (event->type()) {
case QEvent::MouseButtonPress:
if (me && me->button() == button && me->buttons() == button) {
- point = me->globalPos();
+ point = me->globalPosition().toPoint();
inputType = QScroller::InputPress;
} else if (me) {
scroller->stop();
@@ -501,13 +501,13 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
break;
case QEvent::MouseButtonRelease:
if (me && me->button() == button) {
- point = me->globalPos();
+ point = me->globalPosition().toPoint();
inputType = QScroller::InputRelease;
}
break;
case QEvent::MouseMove:
if (me && me->buttons() == button) {
- point = me->globalPos();
+ point = me->globalPosition().toPoint();
inputType = QScroller::InputMove;
}
break;
@@ -551,14 +551,14 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
if (te->touchPoints().count() != 2) // 2 fingers on pad
return Ignore;
- point = te->touchPoints().at(0).startScenePos() +
- ((te->touchPoints().at(0).scenePos() - te->touchPoints().at(0).startScenePos()) +
- (te->touchPoints().at(1).scenePos() - te->touchPoints().at(1).startScenePos())) / 2;
+ point = te->touchPoints().at(0).scenePressPosition() +
+ ((te->touchPoints().at(0).scenePosition() - te->touchPoints().at(0).scenePressPosition()) +
+ (te->touchPoints().at(1).scenePosition() - te->touchPoints().at(1).scenePressPosition())) / 2;
} else { // TouchScreen
if (te->touchPoints().count() != 1) // 1 finger on screen
return Ignore;
- point = te->touchPoints().at(0).scenePos();
+ point = te->touchPoints().at(0).scenePosition();
}
break;
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index da8752be08..5d446cf22a 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -120,7 +120,7 @@ QRect QSystemTrayIconSys::globalGeometry() const
void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev)
{
- QPoint globalPos = ev->globalPos();
+ QPoint globalPos = ev->globalPosition().toPoint();
#ifndef QT_NO_CONTEXTMENU
if (ev->button() == Qt::RightButton && q->contextMenu())
q->contextMenu()->popup(globalPos);
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 9c08ed65ab..5ced1397b8 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -976,7 +976,7 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e)
e->ignore();
return;
}
- if (hitButton(e->pos())) {
+ if (hitButton(e->position().toPoint())) {
setDown(true);
d->pressed = true;
repaint();
@@ -1006,7 +1006,7 @@ void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
return;
}
- if (hitButton(e->pos())) {
+ if (hitButton(e->position().toPoint())) {
d->repeatTimer.stop();
d->click();
e->accept();
@@ -1025,7 +1025,7 @@ void QAbstractButton::mouseMoveEvent(QMouseEvent *e)
return;
}
- if (hitButton(e->pos()) != d->down) {
+ if (hitButton(e->position().toPoint()) != d->down) {
setDown(!d->down);
repaint();
if (d->down)
@@ -1033,7 +1033,7 @@ void QAbstractButton::mouseMoveEvent(QMouseEvent *e)
else
d->emitReleased();
e->accept();
- } else if (!hitButton(e->pos())) {
+ } else if (!hitButton(e->position().toPoint())) {
e->ignore();
}
}
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 8f9e06eeb8..2a51bafa01 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -795,7 +795,7 @@ bool QAbstractSpinBox::event(QEvent *event)
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
- d->updateHoverControl(static_cast<const QHoverEvent *>(event)->pos());
+ d->updateHoverControl(static_cast<const QHoverEvent *>(event)->position().toPoint());
break;
case QEvent::ShortcutOverride:
if (d->edit->event(event))
@@ -1359,7 +1359,7 @@ void QAbstractSpinBox::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QAbstractSpinBox);
- d->updateHoverControl(event->pos());
+ d->updateHoverControl(event->position().toPoint());
// If we have a timer ID, update the state
if (d->spinClickTimerId != -1 && d->buttonSymbols != NoButtons) {
@@ -1386,7 +1386,7 @@ void QAbstractSpinBox::mousePressEvent(QMouseEvent *event)
return;
}
- d->updateHoverControl(event->pos());
+ d->updateHoverControl(event->position().toPoint());
event->accept();
const StepEnabled se = (d->buttonSymbols == NoButtons) ? StepEnabled(StepNone) : stepEnabled();
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index aa822fb1b6..9cb107fb8f 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -1485,7 +1485,7 @@ QDate QCalendarView::handleMouseEvent(QMouseEvent *event)
if (!calendarModel)
return QDate();
- QPoint pos = event->pos();
+ QPoint pos = event->position().toPoint();
QModelIndex index = indexAt(pos);
QDate date = calendarModel->dateForCell(index.row(), index.column());
if (date.isValid() && date >= calendarModel->m_minimumDate
@@ -3145,7 +3145,7 @@ bool QCalendarWidget::eventFilter(QObject *watched, QEvent *event)
if (!widget || widget->window() != tlw)
return QWidget::eventFilter(watched, event);
- QPoint mousePos = widget->mapTo(tlw, static_cast<QMouseEvent *>(event)->pos());
+ QPoint mousePos = widget->mapTo(tlw, static_cast<QMouseEvent *>(event)->position().toPoint());
QRect geom = QRect(d->yearEdit->mapTo(tlw, QPoint(0, 0)), d->yearEdit->size());
if (!geom.contains(mousePos)) {
event->accept();
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index b06ae82249..2e9a404157 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -325,7 +325,7 @@ void QCheckBox::mouseMoveEvent(QMouseEvent *e)
if (testAttribute(Qt::WA_Hover)) {
bool hit = false;
if (underMouse())
- hit = hitButton(e->pos());
+ hit = hitButton(e->position().toPoint());
if (hit != d->hovering) {
update(rect());
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 05724e3d92..3125e001d9 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -780,10 +780,10 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
if (isVisible()) {
QMouseEvent *m = static_cast<QMouseEvent *>(e);
QWidget *widget = static_cast<QWidget *>(o);
- QPoint vector = widget->mapToGlobal(m->pos()) - initialClickPosition;
+ QPoint vector = widget->mapToGlobal(m->position().toPoint()) - initialClickPosition;
if (vector.manhattanLength() > 9 && blockMouseReleaseTimer.isActive())
blockMouseReleaseTimer.stop();
- QModelIndex indexUnderMouse = view->indexAt(m->pos());
+ QModelIndex indexUnderMouse = view->indexAt(m->position().toPoint());
if (indexUnderMouse.isValid()
&& !QComboBoxDelegate::isSeparator(indexUnderMouse)) {
view->setCurrentIndex(indexUnderMouse);
@@ -797,7 +797,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
bool ignoreEvent = maybeIgnoreMouseButtonRelease && popupTimer.elapsed() < QApplication::doubleClickInterval();
QMouseEvent *m = static_cast<QMouseEvent *>(e);
- if (isVisible() && view->rect().contains(m->pos()) && view->currentIndex().isValid()
+ if (isVisible() && view->rect().contains(m->position().toPoint()) && view->currentIndex().isValid()
&& !blockMouseReleaseTimer.isActive() && !ignoreEvent
&& (view->currentIndex().flags() & Qt::ItemIsEnabled)
&& (view->currentIndex().flags() & Qt::ItemIsSelectable)) {
@@ -838,7 +838,7 @@ void QComboBoxPrivateContainer::mousePressEvent(QMouseEvent *e)
opt.subControls = QStyle::SC_All;
opt.activeSubControls = QStyle::SC_ComboBoxArrow;
QStyle::SubControl sc = combo->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt,
- combo->mapFromGlobal(e->globalPos()),
+ combo->mapFromGlobal(e->globalPosition().toPoint()),
combo);
if ((combo->isEditable() && sc == QStyle::SC_ComboBoxArrow)
|| (!combo->isEditable() && sc != QStyle::SC_None))
@@ -3072,7 +3072,7 @@ bool QComboBox::event(QEvent *event)
case QEvent::HoverLeave:
case QEvent::HoverMove:
if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d->updateHoverControl(he->pos());
+ d->updateHoverControl(he->position().toPoint());
break;
case QEvent::ShortcutOverride:
if (d->lineEdit)
@@ -3111,7 +3111,7 @@ void QComboBoxPrivate::showPopupFromMouseEvent(QMouseEvent *e)
Q_Q(QComboBox);
QStyleOptionComboBox opt;
q->initStyleOption(&opt);
- QStyle::SubControl sc = q->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, e->pos(), q);
+ QStyle::SubControl sc = q->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, e->position().toPoint(), q);
if (e->button() == Qt::LeftButton
&& !(sc == QStyle::SC_None && e->type() == QEvent::MouseButtonRelease)
@@ -3127,7 +3127,7 @@ void QComboBoxPrivate::showPopupFromMouseEvent(QMouseEvent *e)
#endif
// We've restricted the next couple of lines, because by not calling
// viewContainer(), we avoid creating the QComboBoxPrivateContainer.
- viewContainer()->initialClickPosition = q->mapToGlobal(e->pos());
+ viewContainer()->initialClickPosition = q->mapToGlobal(e->position().toPoint());
}
q->showPopup();
// The code below ensures that regular mousepress and pick item still works
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index 44936af9fc..c1771a8958 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -178,8 +178,8 @@ protected:
void mouseMoveEvent(QMouseEvent *e) override
{
// Enable fast scrolling if the cursor is directly above or below the popup.
- const int mouseX = e->pos().x();
- const int mouseY = e->pos().y();
+ const int mouseX = e->position().toPoint().x();
+ const int mouseY = e->position().toPoint().y();
const bool horizontallyInside = pos().x() < mouseX && mouseX < rect().right() + 1;
const bool verticallyOutside = (sliderAction == QAbstractSlider::SliderSingleStepAdd) ?
rect().bottom() + 1 < mouseY : mouseY < pos().y();
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 5d64aad040..a438555183 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1528,7 +1528,7 @@ void QDateTimeEdit::mousePressEvent(QMouseEvent *event)
QAbstractSpinBox::mousePressEvent(event);
return;
}
- d->updateHoverControl(event->pos());
+ d->updateHoverControl(event->position().toPoint());
if (d->hoverControl == QStyle::SC_ComboBoxArrow) {
event->accept();
if (d->readOnly) {
@@ -2712,7 +2712,7 @@ void QCalendarPopup::mousePressEvent(QMouseEvent *event)
QRect arrowRect = dateTime->style()->subControlRect(QStyle::CC_ComboBox, &opt,
QStyle::SC_ComboBoxArrow, dateTime);
arrowRect.moveTo(dateTime->mapToGlobal(arrowRect .topLeft()));
- if (arrowRect.contains(event->globalPos()) || rect().contains(event->pos()))
+ if (arrowRect.contains(event->globalPosition().toPoint()) || rect().contains(event->position().toPoint()))
setAttribute(Qt::WA_NoMouseReplay);
}
QWidget::mousePressEvent(event);
diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp
index 7dd469faae..934be4fb6e 100644
--- a/src/widgets/widgets/qdial.cpp
+++ b/src/widgets/widgets/qdial.cpp
@@ -280,7 +280,7 @@ void QDial::mousePressEvent(QMouseEvent *e)
return;
}
e->accept();
- setSliderPosition(d->valueFromPoint(e->pos()));
+ setSliderPosition(d->valueFromPoint(e->position().toPoint()));
// ### This isn't quite right,
// we should be doing a hit test and only setting this if it's
// the actual dial thingie (similar to what QSlider does), but we have no
@@ -302,7 +302,7 @@ void QDial::mouseReleaseEvent(QMouseEvent * e)
return;
}
e->accept();
- setValue(d->valueFromPoint(e->pos()));
+ setValue(d->valueFromPoint(e->position().toPoint()));
setSliderDown(false);
}
@@ -320,7 +320,7 @@ void QDial::mouseMoveEvent(QMouseEvent * e)
}
e->accept();
d->doNotEmit = true;
- setSliderPosition(d->valueFromPoint(e->pos()));
+ setSliderPosition(d->valueFromPoint(e->position().toPoint()));
d->doNotEmit = false;
}
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 102f370488..8ffb0a3b9e 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -918,7 +918,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
QDockWidgetGroupWindow *floatingTab = qobject_cast<QDockWidgetGroupWindow*>(parent);
if (event->button() != Qt::LeftButton ||
- !titleArea.contains(event->pos()) ||
+ !titleArea.contains(event->position().toPoint()) ||
// check if the tool window is movable... do nothing if it
// is not (but allow moving if the window is floating)
(!hasFeature(this, QDockWidget::DockWidgetMovable) && !q->isFloating()) ||
@@ -927,7 +927,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
return false;
}
- initDrag(event->pos(), false);
+ initDrag(event->position().toPoint(), false);
if (state)
state->ctrlDrag = (hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier) ||
@@ -947,7 +947,7 @@ bool QDockWidgetPrivate::mouseDoubleClickEvent(QMouseEvent *event)
if (!dwLayout->nativeWindowDeco()) {
QRect titleArea = dwLayout->titleArea();
- if (event->button() == Qt::LeftButton && titleArea.contains(event->pos()) &&
+ if (event->button() == Qt::LeftButton && titleArea.contains(event->position().toPoint()) &&
hasFeature(this, QDockWidget::DockWidgetFloatable)) {
_q_toggleTopLevel();
return true;
@@ -971,7 +971,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
if (!dwlayout->nativeWindowDeco()) {
if (!state->dragging
&& mwlayout->pluggingWidget == nullptr
- && (event->pos() - state->pressPos).manhattanLength()
+ && (event->position().toPoint() - state->pressPos).manhattanLength()
> QApplication::startDragDistance()) {
startDrag();
q->grabMouse();
@@ -982,7 +982,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
if (state->dragging && !state->nca) {
QMargins windowMargins = q->window()->windowHandle()->frameMargins();
QPoint windowMarginOffset = QPoint(windowMargins.left(), windowMargins.top());
- QPoint pos = event->globalPos() - state->pressPos - windowMarginOffset;
+ QPoint pos = event->globalPosition().toPoint() - state->pressPos - windowMarginOffset;
QDockWidgetGroupWindow *floatingTab = qobject_cast<QDockWidgetGroupWindow*>(parent);
if (floatingTab && !q->isFloating())
@@ -991,7 +991,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
q->move(pos);
if (state && !state->ctrlDrag)
- mwlayout->hover(state->widgetItem, event->globalPos());
+ mwlayout->hover(state->widgetItem, event->globalPosition().toPoint());
ret = true;
}
@@ -1031,7 +1031,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
switch (event->type()) {
case QEvent::NonClientAreaMouseButtonPress:
- if (!titleRect.contains(event->globalPos()))
+ if (!titleRect.contains(event->globalPosition().toPoint()))
break;
if (state != nullptr)
break;
@@ -1039,7 +1039,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
break;
if (isAnimating())
break;
- initDrag(event->pos(), true);
+ initDrag(event->position().toPoint(), true);
if (state == nullptr)
break;
state->ctrlDrag = (event->modifiers() & Qt::ControlModifier) ||
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index 02a0bed325..8945139115 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -339,7 +339,7 @@ bool QGroupBox::event(QEvent *e)
case QEvent::HoverEnter:
case QEvent::HoverMove: {
QStyle::SubControl control = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,
- static_cast<QHoverEvent *>(e)->pos(),
+ static_cast<QHoverEvent *>(e)->position().toPoint(),
this);
bool oldHover = d->hover;
d->hover = d->checkable && (control == QStyle::SC_GroupBoxLabel || control == QStyle::SC_GroupBoxCheckBox);
@@ -702,7 +702,7 @@ void QGroupBox::mousePressEvent(QMouseEvent *event)
QStyleOptionGroupBox box;
initStyleOption(&box);
d->pressedControl = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,
- event->pos(), this);
+ event->position().toPoint(), this);
if (d->checkable && (d->pressedControl & (QStyle::SC_GroupBoxCheckBox | QStyle::SC_GroupBoxLabel))) {
d->overCheckBox = true;
update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this));
@@ -718,7 +718,7 @@ void QGroupBox::mouseMoveEvent(QMouseEvent *event)
QStyleOptionGroupBox box;
initStyleOption(&box);
QStyle::SubControl pressed = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,
- event->pos(), this);
+ event->position().toPoint(), this);
bool oldOverCheckBox = d->overCheckBox;
d->overCheckBox = (pressed == QStyle::SC_GroupBoxCheckBox || pressed == QStyle::SC_GroupBoxLabel);
if (d->checkable && (d->pressedControl == QStyle::SC_GroupBoxCheckBox || d->pressedControl == QStyle::SC_GroupBoxLabel)
@@ -744,7 +744,7 @@ void QGroupBox::mouseReleaseEvent(QMouseEvent *event)
QStyleOptionGroupBox box;
initStyleOption(&box);
QStyle::SubControl released = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,
- event->pos(), this);
+ event->position().toPoint(), this);
bool toggle = d->checkable && (released == QStyle::SC_GroupBoxLabel
|| released == QStyle::SC_GroupBoxCheckBox);
d->pressedControl = QStyle::SC_None;
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index f252139a67..cd9a8c4eec 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1513,7 +1513,7 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
{
Q_D(QLineEdit);
- d->mousePressPos = e->pos();
+ d->mousePressPos = e->position().toPoint();
if (d->sendMouseEventToInputContext(e))
return;
@@ -1527,7 +1527,7 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
d->control->completer()->complete();
}
#endif
- if (d->tripleClickTimer.isActive() && (e->pos() - d->tripleClick).manhattanLength() <
+ if (d->tripleClickTimer.isActive() && (e->position().toPoint() - d->tripleClick).manhattanLength() <
QApplication::startDragDistance()) {
selectAll();
return;
@@ -1536,10 +1536,10 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
#ifdef Q_OS_ANDROID
mark = mark && (d->imHints & Qt::ImhNoPredictiveText);
#endif // Q_OS_ANDROID
- int cursor = d->xToPos(e->pos().x());
+ int cursor = d->xToPos(e->position().toPoint().x());
#if QT_CONFIG(draganddrop)
if (!mark && d->dragEnabled && d->control->echoMode() == Normal &&
- e->button() == Qt::LeftButton && d->inSelection(e->pos().x())) {
+ e->button() == Qt::LeftButton && d->inSelection(e->position().toPoint().x())) {
if (!d->dndTimer.isActive())
d->dndTimer.start(QApplication::startDragTime(), this);
} else
@@ -1558,7 +1558,7 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e)
if (e->buttons() & Qt::LeftButton) {
#if QT_CONFIG(draganddrop)
if (d->dndTimer.isActive()) {
- if ((d->mousePressPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
+ if ((d->mousePressPos - e->position().toPoint()).manhattanLength() > QApplication::startDragDistance())
d->drag();
} else
#endif
@@ -1569,26 +1569,26 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e)
const bool select = (d->imHints & Qt::ImhNoPredictiveText);
#endif
#ifndef QT_NO_IM
- if (d->mouseYThreshold > 0 && e->pos().y() > d->mousePressPos.y() + d->mouseYThreshold) {
+ if (d->mouseYThreshold > 0 && e->position().toPoint().y() > d->mousePressPos.y() + d->mouseYThreshold) {
if (layoutDirection() == Qt::RightToLeft)
d->control->home(select);
else
d->control->end(select);
- } else if (d->mouseYThreshold > 0 && e->pos().y() + d->mouseYThreshold < d->mousePressPos.y()) {
+ } else if (d->mouseYThreshold > 0 && e->position().toPoint().y() + d->mouseYThreshold < d->mousePressPos.y()) {
if (layoutDirection() == Qt::RightToLeft)
d->control->end(select);
else
d->control->home(select);
} else if (d->control->composeMode() && select) {
int startPos = d->xToPos(d->mousePressPos.x());
- int currentPos = d->xToPos(e->pos().x());
+ int currentPos = d->xToPos(e->position().toPoint().x());
if (startPos != currentPos)
d->control->setSelection(startPos, currentPos - startPos);
} else
#endif
{
- d->control->moveCursor(d->xToPos(e->pos().x()), select);
+ d->control->moveCursor(d->xToPos(e->position().toPoint().x()), select);
}
}
}
@@ -1623,7 +1623,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
}
#endif
- if (!isReadOnly() && rect().contains(e->pos()))
+ if (!isReadOnly() && rect().contains(e->position().toPoint()))
d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
d->clickCausedFocus = 0;
}
@@ -1635,7 +1635,7 @@ void QLineEdit::mouseDoubleClickEvent(QMouseEvent* e)
Q_D(QLineEdit);
if (e->button() == Qt::LeftButton) {
- int position = d->xToPos(e->pos().x());
+ int position = d->xToPos(e->position().toPoint().x());
// exit composition mode
#ifndef QT_NO_IM
@@ -1669,7 +1669,7 @@ void QLineEdit::mouseDoubleClickEvent(QMouseEvent* e)
d->control->selectWordAtPos(position);
d->tripleClickTimer.start(QApplication::doubleClickInterval(), this);
- d->tripleClick = e->pos();
+ d->tripleClick = e->position().toPoint();
} else {
d->sendMouseEventToInputContext(e);
}
@@ -2075,7 +2075,7 @@ void QLineEdit::dragMoveEvent(QDragMoveEvent *e)
Q_D(QLineEdit);
if (!d->control->isReadOnly() && e->mimeData()->hasFormat(QLatin1String("text/plain"))) {
e->acceptProposedAction();
- d->control->moveCursor(d->xToPos(e->pos().x()), false);
+ d->control->moveCursor(d->xToPos(e->position().toPoint().x()), false);
d->cursorVisible = true;
update();
}
@@ -2106,7 +2106,7 @@ void QLineEdit::dropEvent(QDropEvent* e)
if (!str.isNull() && !d->control->isReadOnly()) {
if (e->source() == this && e->dropAction() == Qt::CopyAction)
deselect();
- int cursorPos = d->xToPos(e->pos().x());
+ int cursorPos = d->xToPos(e->position().toPoint().x());
int selStart = cursorPos;
int oldSelStart = d->control->selectionStart();
int oldSelEnd = d->control->selectionEnd();
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 4d444a3516..bd700e09f3 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -302,7 +302,7 @@ bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
{
#if !defined QT_NO_IM
if ( control->composeMode() ) {
- int tmp_cursor = xToPos(e->pos().x());
+ int tmp_cursor = xToPos(e->position().toPoint().x());
int mousePos = tmp_cursor - control->cursor();
if ( mousePos < 0 || mousePos > control->preeditAreaText().length() )
mousePos = -1;
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 158521e13f..e23c491eea 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -1713,7 +1713,7 @@ void QMainWindowTabBar::mouseMoveEvent(QMouseEvent *e)
int offset = QApplication::startDragDistance() + 1;
offset *= 3;
QRect r = rect().adjusted(-offset, -offset, offset, offset);
- if (d->dragInProgress && !r.contains(e->pos()) && d->validIndex(d->pressedIndex)) {
+ if (d->dragInProgress && !r.contains(e->position().toPoint()) && d->validIndex(d->pressedIndex)) {
QMainWindowLayout* mlayout = qt_mainwindow_layout(mainWindow);
QDockAreaLayoutInfo *info = mlayout->dockInfo(this);
Q_ASSERT(info);
@@ -1743,7 +1743,7 @@ void QMainWindowTabBar::mouseMoveEvent(QMouseEvent *e)
if (draggingDock) {
QDockWidgetPrivate *dockPriv = static_cast<QDockWidgetPrivate *>(QObjectPrivate::get(draggingDock));
if (dockPriv->state && dockPriv->state->dragging) {
- QPoint pos = e->globalPos() - dockPriv->state->pressPos;
+ QPoint pos = e->globalPosition().toPoint() - dockPriv->state->pressPos;
draggingDock->move(pos);
// move will call QMainWindowLayout::hover
}
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index ab95258e78..16d1145b7e 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -210,7 +210,7 @@ bool QMainWindowLayoutSeparatorHelper<Layout>::windowEvent(QEvent *event)
#if QT_CONFIG(cursor)
case QEvent::HoverMove: {
- adjustCursor(static_cast<QHoverEvent *>(event)->pos());
+ adjustCursor(static_cast<QHoverEvent *>(event)->position().toPoint());
break;
}
@@ -228,7 +228,7 @@ bool QMainWindowLayoutSeparatorHelper<Layout>::windowEvent(QEvent *event)
case QEvent::MouseButtonPress: {
QMouseEvent *e = static_cast<QMouseEvent *>(event);
- if (e->button() == Qt::LeftButton && startSeparatorMove(e->pos())) {
+ if (e->button() == Qt::LeftButton && startSeparatorMove(e->position().toPoint())) {
// The click was on a separator, eat this event
e->accept();
return true;
@@ -240,10 +240,10 @@ bool QMainWindowLayoutSeparatorHelper<Layout>::windowEvent(QEvent *event)
QMouseEvent *e = static_cast<QMouseEvent *>(event);
#if QT_CONFIG(cursor)
- adjustCursor(e->pos());
+ adjustCursor(e->position().toPoint());
#endif
if (e->buttons() & Qt::LeftButton) {
- if (separatorMove(e->pos())) {
+ if (separatorMove(e->position().toPoint())) {
// We're moving a separator, eat this event
e->accept();
return true;
@@ -255,7 +255,7 @@ bool QMainWindowLayoutSeparatorHelper<Layout>::windowEvent(QEvent *event)
case QEvent::MouseButtonRelease: {
QMouseEvent *e = static_cast<QMouseEvent *>(event);
- if (endSeparatorMove(e->pos())) {
+ if (endSeparatorMove(e->position().toPoint())) {
// We've released a separator, eat this event
e->accept();
return true;
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index e6fd021e4a..dc65317de8 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -589,7 +589,7 @@ void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event)
return;
}
- QMdiSubWindow *subWindow = subWindowFromIndex(tabAt(event->pos()));
+ QMdiSubWindow *subWindow = subWindowFromIndex(tabAt(event->position().toPoint()));
if (!subWindow) {
event->ignore();
return;
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index ddc11cd470..82f72065e0 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -613,7 +613,7 @@ void ControllerWidget::mousePressEvent(QMouseEvent *event)
event->ignore();
return;
}
- activeControl = getSubControl(event->pos());
+ activeControl = getSubControl(event->position().toPoint());
update();
}
@@ -627,7 +627,7 @@ void ControllerWidget::mouseReleaseEvent(QMouseEvent *event)
return;
}
- QStyle::SubControl under_mouse = getSubControl(event->pos());
+ QStyle::SubControl under_mouse = getSubControl(event->position().toPoint());
if (under_mouse == activeControl) {
switch (activeControl) {
case QStyle::SC_MdiCloseButton:
@@ -653,7 +653,7 @@ void ControllerWidget::mouseReleaseEvent(QMouseEvent *event)
*/
void ControllerWidget::mouseMoveEvent(QMouseEvent *event)
{
- QStyle::SubControl under_mouse = getSubControl(event->pos());
+ QStyle::SubControl under_mouse = getSubControl(event->position().toPoint());
//test if hover state changes
if (hoverControl != under_mouse) {
hoverControl = under_mouse;
@@ -2659,12 +2659,12 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
if (d->systemMenu && d->systemMenu == object) {
if (event->type() == QEvent::MouseButtonDblClick) {
const QMouseEvent *mouseEvent = static_cast<const QMouseEvent *>(event);
- const QAction *action = d->systemMenu->actionAt(mouseEvent->pos());
+ const QAction *action = d->systemMenu->actionAt(mouseEvent->position().toPoint());
if (!action || action->isEnabled())
close();
} else if (event->type() == QEvent::MouseMove) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- d->hoveredSubControl = d->getSubControl(mapFromGlobal(mouseEvent->globalPos()));
+ d->hoveredSubControl = d->getSubControl(mapFromGlobal(mouseEvent->globalPosition().toPoint()));
} else if (event->type() == QEvent::Hide) {
d->activeSubControl = QStyle::SC_None;
update(QRegion(0, 0, width(), d->titleBarHeight()));
@@ -2678,7 +2678,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
if (event->type() != QEvent::MouseButtonPress || !testOption(QMdiSubWindow::RubberBandResize))
return QWidget::eventFilter(object, event);
const QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- d->mousePressPosition = parentWidget()->mapFromGlobal(mouseEvent->globalPos());
+ d->mousePressPosition = parentWidget()->mapFromGlobal(mouseEvent->globalPosition().toPoint());
d->oldGeometry = geometry();
d->currentOperation = isLeftToRight() ? QMdiSubWindowPrivate::BottomRightResize
: QMdiSubWindowPrivate::BottomLeftResize;
@@ -3173,7 +3173,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
if (d->currentOperation != QMdiSubWindowPrivate::None) {
d->updateCursor();
- d->mousePressPosition = mapToParent(mouseEvent->pos());
+ d->mousePressPosition = mapToParent(mouseEvent->position().toPoint());
if (d->resizeEnabled || d->moveEnabled)
d->oldGeometry = geometry();
#if QT_CONFIG(rubberband)
@@ -3264,10 +3264,10 @@ void QMdiSubWindow::mouseReleaseEvent(QMouseEvent *mouseEvent)
d->oldGeometry = geometry();
}
- d->currentOperation = d->getOperation(mouseEvent->pos());
+ d->currentOperation = d->getOperation(mouseEvent->position().toPoint());
d->updateCursor();
- d->hoveredSubControl = d->getSubControl(mouseEvent->pos());
+ d->hoveredSubControl = d->getSubControl(mouseEvent->position().toPoint());
if (d->activeSubControl != QStyle::SC_None
&& d->activeSubControl == d->hoveredSubControl) {
d->processClickedSubControl();
@@ -3292,7 +3292,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
// Find previous and current hover region.
const QStyleOptionTitleBar options = d->titleBarOptions();
QStyle::SubControl oldHover = d->hoveredSubControl;
- d->hoveredSubControl = d->getSubControl(mouseEvent->pos());
+ d->hoveredSubControl = d->getSubControl(mouseEvent->position().toPoint());
QRegion hoverRegion;
if (isHoverControl(oldHover) && oldHover != d->hoveredSubControl)
hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, oldHover, this);
@@ -3312,13 +3312,13 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
if ((d->isResizeOperation() && d->resizeEnabled) || (d->isMoveOperation() && d->moveEnabled)) {
// As setNewGeometry moves the window, it invalidates the pos() value of any mouse move events that are
// currently queued in the event loop. Map to parent using globalPos() instead.
- d->setNewGeometry(parentWidget()->mapFromGlobal(mouseEvent->globalPos()));
+ d->setNewGeometry(parentWidget()->mapFromGlobal(mouseEvent->globalPosition().toPoint()));
}
return;
}
// Do not resize/move if not allowed.
- d->currentOperation = d->getOperation(mouseEvent->pos());
+ d->currentOperation = d->getOperation(mouseEvent->position().toPoint());
if ((d->isResizeOperation() && !d->resizeEnabled) || (d->isMoveOperation() && !d->moveEnabled))
d->currentOperation = QMdiSubWindowPrivate::None;
d->updateCursor();
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 7b72379d40..fdfa9b327f 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1303,7 +1303,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool pag
bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
{
Q_Q(QMenu);
- QPoint pos = q->mapFromGlobal(e->globalPos());
+ QPoint pos = q->mapFromGlobal(e->globalPosition().toPoint());
QStyle *style = q->style();
QStyleOption opt(0);
@@ -1342,7 +1342,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
if (scroll && scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
tearRect.translate(0, scrollerHeight());
q->update(tearRect);
- if (tearRect.contains(pos) && hasMouseMoved(e->globalPos())) {
+ if (tearRect.contains(pos) && hasMouseMoved(e->globalPosition().toPoint())) {
setCurrentAction(nullptr);
tearoffHighlighted = 1;
if (e->type() == QEvent::MouseButtonRelease) {
@@ -1357,13 +1357,13 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
tearoffHighlighted = 0;
}
- if (q->frameGeometry().contains(e->globalPos()))
+ if (q->frameGeometry().contains(e->globalPosition().toPoint()))
return false; //otherwise if the event is in our rect we want it..
for(QWidget *caused = causedPopup.widget; caused;) {
bool passOnEvent = false;
QWidget *next_widget = nullptr;
- QPoint cpos = caused->mapFromGlobal(e->globalPos());
+ QPoint cpos = caused->mapFromGlobal(e->globalPosition().toPoint());
#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
passOnEvent = mb->rect().contains(cpos);
@@ -1375,7 +1375,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
}
if (passOnEvent) {
if (e->type() != QEvent::MouseButtonRelease || mouseDown == caused) {
- QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(),
+ QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->globalPosition(),
e->button(), e->buttons(), e->modifiers(), e->source());
QCoreApplication::sendEvent(caused, &new_e);
return true;
@@ -2934,9 +2934,9 @@ void QMenu::mousePressEvent(QMouseEvent *e)
// and mouse clicks on second screen, e->pos() is QPoint(0,0) and the menu doesn't hide. This trick makes
// possible to hide the menu when mouse clicks on another screen (e->screenPos() returns correct value).
// Only when mouse clicks in QPoint(0,0) on second screen, the menu doesn't hide.
- if ((e->pos().isNull() && !e->screenPos().isNull()) || !rect().contains(e->pos())) {
+ if ((e->position().toPoint().isNull() && !e->globalPosition().isNull()) || !rect().contains(e->position().toPoint())) {
if (d->noReplayFor
- && QRect(d->noReplayFor->mapToGlobal(QPoint()), d->noReplayFor->size()).contains(e->globalPos()))
+ && QRect(d->noReplayFor->mapToGlobal(QPoint()), d->noReplayFor->size()).contains(e->globalPosition().toPoint()))
setAttribute(Qt::WA_NoMouseReplay);
if (d->eventLoop) // synchronous operation
d->syncAction = nullptr;
@@ -2945,7 +2945,7 @@ void QMenu::mousePressEvent(QMouseEvent *e)
}
QMenuPrivate::mouseDown = this;
- QAction *action = d->actionAt(e->pos());
+ QAction *action = d->actionAt(e->position().toPoint());
d->setCurrentAction(action, 20);
update();
}
@@ -2965,7 +2965,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
QMenuPrivate::mouseDown = nullptr;
d->setSyncAction();
- QAction *action = d->actionAt(e->pos());
+ QAction *action = d->actionAt(e->position().toPoint());
if (action && action == d->currentAction) {
if (!action->menu()){
@@ -2975,7 +2975,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
#endif
d->activateAction(action, QAction::Trigger);
}
- } else if ((!action || action->isEnabled()) && d->hasMouseMoved(e->globalPos())) {
+ } else if ((!action || action->isEnabled()) && d->hasMouseMoved(e->globalPosition().toPoint())) {
d->hideUpToMenuBar();
}
}
@@ -3485,9 +3485,9 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
if (d->motions == 0)
return;
- d->hasHadMouse = d->hasHadMouse || rect().contains(e->pos());
+ d->hasHadMouse = d->hasHadMouse || rect().contains(e->position().toPoint());
- QAction *action = d->actionAt(e->pos());
+ QAction *action = d->actionAt(e->position().toPoint());
if ((!action || action->isSeparator()) && !d->sloppyState.enabled()) {
if (d->hasHadMouse
|| (!d->currentAction || !d->currentAction->menu() || !d->currentAction->menu()->isVisible())) {
@@ -3502,7 +3502,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
if (d->activeMenu)
d->activeMenu->d_func()->setCurrentAction(nullptr);
- QMenuSloppyState::MouseEventResult sloppyEventResult = d->sloppyState.processMouseEvent(e->localPos(), action, d->currentAction);
+ QMenuSloppyState::MouseEventResult sloppyEventResult = d->sloppyState.processMouseEvent(e->position(), action, d->currentAction);
if (sloppyEventResult == QMenuSloppyState::EventShouldBePropagated) {
d->setCurrentAction(action, d->mousePopupDelay);
} else if (sloppyEventResult == QMenuSloppyState::EventDiscardsSloppyState) {
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index b45a6b5b01..b7c071bfcd 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1053,12 +1053,12 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
d->mouseDown = true;
- QAction *action = d->actionAt(e->pos());
+ QAction *action = d->actionAt(e->position().toPoint());
if (!action || !d->isVisible(action) || !action->isEnabled()) {
d->setCurrentAction(nullptr);
#if QT_CONFIG(whatsthis)
if (QWhatsThis::inWhatsThisMode())
- QWhatsThis::showText(e->globalPos(), d->whatsThis, this);
+ QWhatsThis::showText(e->globalPosition().toPoint(), d->whatsThis, this);
#endif
return;
}
@@ -1084,7 +1084,7 @@ void QMenuBar::mouseReleaseEvent(QMouseEvent *e)
return;
d->mouseDown = false;
- QAction *action = d->actionAt(e->pos());
+ QAction *action = d->actionAt(e->position().toPoint());
// do noting if the action is hidden
if (!d->isVisible(action))
@@ -1222,7 +1222,7 @@ void QMenuBar::mouseMoveEvent(QMouseEvent *e)
}
bool popupState = d->popupState || d->mouseDown;
- QAction *action = d->actionAt(e->pos());
+ QAction *action = d->actionAt(e->position().toPoint());
if ((action && d->isVisible(action)) || !popupState)
d->setCurrentAction(action, popupState);
}
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index c33b99432a..58203ba921 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -2091,7 +2091,7 @@ void QPlainTextEdit::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QPlainTextEdit);
d->inDrag = false; // paranoia
- const QPoint pos = e->pos();
+ const QPoint pos = e->position().toPoint();
d->sendControlEvent(e);
if (!(e->buttons() & Qt::LeftButton))
return;
@@ -2115,7 +2115,7 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e)
d->ensureCursorVisible();
}
- if (!isReadOnly() && rect().contains(e->pos()))
+ if (!isReadOnly() && rect().contains(e->position().toPoint()))
d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
d->clickCausedFocus = 0;
}
@@ -2186,7 +2186,7 @@ void QPlainTextEdit::dragLeaveEvent(QDragLeaveEvent *e)
void QPlainTextEdit::dragMoveEvent(QDragMoveEvent *e)
{
Q_D(QPlainTextEdit);
- d->autoScrollDragPos = e->pos();
+ d->autoScrollDragPos = e->position().toPoint();
if (!d->autoScrollTimer.isActive())
d->autoScrollTimer.start(100, this);
d->sendControlEvent(e);
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index 103f3ac441..8e880a3f35 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -226,7 +226,7 @@ void QRadioButton::mouseMoveEvent(QMouseEvent *e)
if (testAttribute(Qt::WA_Hover)) {
bool hit = false;
if (underMouse())
- hit = hitButton(e->pos());
+ hit = hitButton(e->position().toPoint());
if (hit != d->hovering) {
update();
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 188ee7c25c..59575b9f2b 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -468,7 +468,7 @@ bool QScrollBar::event(QEvent *event)
case QEvent::HoverLeave:
case QEvent::HoverMove:
if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d_func()->updateHoverControl(he->pos());
+ d_func()->updateHoverControl(he->position().toPoint());
break;
case QEvent::StyleChange:
d_func()->setTransient(style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, this));
@@ -559,12 +559,12 @@ void QScrollBar::mousePressEvent(QMouseEvent *e)
|| !(e->button() == Qt::LeftButton || (midButtonAbsPos && e->button() == Qt::MidButton)))
return;
- d->pressedControl = style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, e->pos(), this);
+ d->pressedControl = style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, e->position().toPoint(), this);
d->pointerOutsidePressedControl = false;
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
QStyle::SC_ScrollBarSlider, this);
- QPoint click = e->pos();
+ QPoint click = e->position().toPoint();
QPoint pressValue = click - sr.center() + sr.topLeft();
d->pressValue = d->orientation == Qt::Horizontal ? d->pixelPosToRangeValue(pressValue.x()) :
d->pixelPosToRangeValue(pressValue.y());
@@ -579,8 +579,8 @@ void QScrollBar::mousePressEvent(QMouseEvent *e)
|| (style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition, &opt, this)
&& e->button() == Qt::LeftButton))) {
int sliderLength = HORIZONTAL ? sr.width() : sr.height();
- setSliderPosition(d->pixelPosToRangeValue((HORIZONTAL ? e->pos().x()
- : e->pos().y()) - sliderLength / 2));
+ setSliderPosition(d->pixelPosToRangeValue((HORIZONTAL ? e->position().toPoint().x()
+ : e->position().toPoint().y()) - sliderLength / 2));
d->pressedControl = QStyle::SC_ScrollBarSlider;
d->clickOffset = sliderLength / 2;
}
@@ -636,13 +636,13 @@ void QScrollBar::mouseMoveEvent(QMouseEvent *e)
return;
if (d->pressedControl == QStyle::SC_ScrollBarSlider) {
- QPoint click = e->pos();
+ QPoint click = e->position().toPoint();
int newPosition = d->pixelPosToRangeValue((HORIZONTAL ? click.x() : click.y()) -d->clickOffset);
int m = style()->pixelMetric(QStyle::PM_MaximumDragDistance, &opt, this);
if (m >= 0) {
QRect r = rect();
r.adjust(-m, -m, m, m);
- if (! r.contains(e->pos()))
+ if (! r.contains(e->position().toPoint()))
newPosition = d->snapBackPosition;
}
setSliderPosition(newPosition);
@@ -650,7 +650,7 @@ void QScrollBar::mouseMoveEvent(QMouseEvent *e)
if (style()->styleHint(QStyle::SH_ScrollBar_RollBetweenButtons, &opt, this)
&& d->pressedControl & (QStyle::SC_ScrollBarAddLine | QStyle::SC_ScrollBarSubLine)) {
- QStyle::SubControl newSc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, e->pos(), this);
+ QStyle::SubControl newSc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, e->position().toPoint(), this);
if (newSc == d->pressedControl && !d->pointerOutsidePressedControl)
return; // nothing to do
if (newSc & (QStyle::SC_ScrollBarAddLine | QStyle::SC_ScrollBarSubLine)) {
@@ -667,7 +667,7 @@ void QScrollBar::mouseMoveEvent(QMouseEvent *e)
// stop scrolling when the mouse pointer leaves a control
// similar to push buttons
QRect pr = style()->subControlRect(QStyle::CC_ScrollBar, &opt, d->pressedControl, this);
- if (pr.contains(e->pos()) == d->pointerOutsidePressedControl) {
+ if (pr.contains(e->position().toPoint()) == d->pointerOutsidePressedControl) {
if ((d->pointerOutsidePressedControl = !d->pointerOutsidePressedControl)) {
d->pointerOutsidePressedControl = true;
setRepeatAction(SliderNoAction);
diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp
index 68fd3ddce1..396503566c 100644
--- a/src/widgets/widgets/qsizegrip.cpp
+++ b/src/widgets/widgets/qsizegrip.cpp
@@ -279,7 +279,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
Q_D(QSizeGrip);
QWidget *tlw = qt_sizegrip_topLevelWidget(this);
- d->p = e->globalPos();
+ d->p = e->globalPosition().toPoint();
d->gotMousePress = true;
d->r = tlw->geometry();
@@ -373,7 +373,7 @@ void QSizeGrip::mouseMoveEvent(QMouseEvent * e)
if (!d->gotMousePress || tlw->testAttribute(Qt::WA_WState_ConfigPending))
return;
- QPoint np(e->globalPos());
+ QPoint np(e->globalPosition().toPoint());
// Don't extend beyond the available geometry; bound to dyMax and dxMax.
QSize ns;
diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp
index 7008da32b5..c344d496a7 100644
--- a/src/widgets/widgets/qslider.cpp
+++ b/src/widgets/widgets/qslider.cpp
@@ -338,7 +338,7 @@ bool QSlider::event(QEvent *event)
case QEvent::HoverLeave:
case QEvent::HoverMove:
if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d->updateHoverControl(he->pos());
+ d->updateHoverControl(he->position().toPoint());
break;
case QEvent::StyleChange:
case QEvent::MacSizeChange:
@@ -372,7 +372,7 @@ void QSlider::mousePressEvent(QMouseEvent *ev)
const QPoint center = sliderRect.center() - sliderRect.topLeft();
// to take half of the slider off for the setSliderPosition call we use the center - topLeft
- setSliderPosition(d->pixelPosToRangeValue(d->pick(ev->pos() - center)));
+ setSliderPosition(d->pixelPosToRangeValue(d->pick(ev->position().toPoint() - center)));
triggerAction(SliderMove);
setRepeatAction(SliderNoAction);
d->pressedControl = QStyle::SC_SliderHandle;
@@ -381,11 +381,11 @@ void QSlider::mousePressEvent(QMouseEvent *ev)
QStyleOptionSlider opt;
initStyleOption(&opt);
d->pressedControl = style()->hitTestComplexControl(QStyle::CC_Slider,
- &opt, ev->pos(), this);
+ &opt, ev->position().toPoint(), this);
SliderAction action = SliderNoAction;
if (d->pressedControl == QStyle::SC_SliderGroove) {
const QRect sliderRect = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
- int pressValue = d->pixelPosToRangeValue(d->pick(ev->pos() - sliderRect.center() + sliderRect.topLeft()));
+ int pressValue = d->pixelPosToRangeValue(d->pick(ev->position().toPoint() - sliderRect.center() + sliderRect.topLeft()));
d->pressValue = pressValue;
if (pressValue > d->value)
action = SliderPageStepAdd;
@@ -406,7 +406,7 @@ void QSlider::mousePressEvent(QMouseEvent *ev)
initStyleOption(&opt);
setRepeatAction(SliderNoAction);
QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
- d->clickOffset = d->pick(ev->pos() - sr.topLeft());
+ d->clickOffset = d->pick(ev->position().toPoint() - sr.topLeft());
update(sr);
setSliderDown(true);
}
@@ -423,7 +423,7 @@ void QSlider::mouseMoveEvent(QMouseEvent *ev)
return;
}
ev->accept();
- int newPosition = d->pixelPosToRangeValue(d->pick(ev->pos()) - d->clickOffset);
+ int newPosition = d->pixelPosToRangeValue(d->pick(ev->position().toPoint()) - d->clickOffset);
QStyleOptionSlider opt;
initStyleOption(&opt);
setSliderPosition(newPosition);
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index b8540176e7..8f98bcdedd 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -292,7 +292,7 @@ void QSplitterHandle::mouseMoveEvent(QMouseEvent *e)
Q_D(QSplitterHandle);
if (!(e->buttons() & Qt::LeftButton))
return;
- int pos = d->pick(parentWidget()->mapFromGlobal(e->globalPos()))
+ int pos = d->pick(parentWidget()->mapFromGlobal(e->globalPosition().toPoint()))
- d->mouseOffset;
if (opaqueResize()) {
moveSplitter(pos);
@@ -308,7 +308,7 @@ void QSplitterHandle::mousePressEvent(QMouseEvent *e)
{
Q_D(QSplitterHandle);
if (e->button() == Qt::LeftButton) {
- d->mouseOffset = d->pick(e->pos());
+ d->mouseOffset = d->pick(e->position().toPoint());
d->pressed = true;
update();
}
@@ -321,7 +321,7 @@ void QSplitterHandle::mouseReleaseEvent(QMouseEvent *e)
{
Q_D(QSplitterHandle);
if (!opaqueResize() && e->button() == Qt::LeftButton) {
- int pos = d->pick(parentWidget()->mapFromGlobal(e->globalPos()))
+ int pos = d->pick(parentWidget()->mapFromGlobal(e->globalPosition().toPoint()))
- d->mouseOffset;
d->s->setRubberBand(-1);
moveSplitter(pos);
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 0f0fa52a05..f70cf77fb3 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1685,12 +1685,12 @@ bool QTabBar::event(QEvent *event)
case QEvent::HoverMove:
case QEvent::HoverEnter: {
QHoverEvent *he = static_cast<QHoverEvent *>(event);
- if (!d->hoverRect.contains(he->pos())) {
+ if (!d->hoverRect.contains(he->position().toPoint())) {
QRect oldHoverRect = d->hoverRect;
bool cursorOverTabs = false;
for (int i = 0; i < d->tabList.count(); ++i) {
QRect area = tabRect(i);
- if (area.contains(he->pos())) {
+ if (area.contains(he->position().toPoint())) {
d->hoverIndex = i;
d->hoverRect = area;
cursorOverTabs = true;
@@ -1766,7 +1766,7 @@ bool QTabBar::event(QEvent *event)
break;
case QEvent::DragMove:
if (d->changeCurrentOnDrag) {
- const int tabIndex = tabAt(static_cast<QDragMoveEvent *>(event)->pos());
+ const int tabIndex = tabAt(static_cast<QDragMoveEvent *>(event)->position().toPoint());
if (isTabEnabled(tabIndex) && d->switchTabCurrentIndex != tabIndex) {
d->switchTabCurrentIndex = tabIndex;
if (d->switchTabTimerId)
@@ -2100,7 +2100,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
{
Q_D(QTabBar);
- const QPoint pos = event->pos();
+ const QPoint pos = event->position().toPoint();
const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos))
|| (!d->rightB->isHidden() && d->rightB->geometry().contains(pos));
if (!isEventInCornerButtons) {
@@ -2116,7 +2116,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
if (d->pressedIndex != -1 && d->movable)
d->moveTabFinished(d->pressedIndex);
- d->pressedIndex = d->indexAtPos(event->pos());
+ d->pressedIndex = d->indexAtPos(event->position().toPoint());
if (d->validIndex(d->pressedIndex)) {
QStyleOptionTabBarBase optTabBase;
@@ -2127,7 +2127,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
else
repaint(tabRect(d->pressedIndex));
if (d->movable) {
- d->dragStartPosition = event->pos();
+ d->dragStartPosition = event->position().toPoint();
}
}
}
@@ -2145,7 +2145,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
// Start drag
if (!d->dragInProgress && d->pressedIndex != -1) {
- if ((event->pos() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance()) {
+ if ((event->position().toPoint() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance()) {
d->dragInProgress = true;
d->setupMovableTab();
}
@@ -2157,9 +2157,9 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
bool vertical = verticalTabs(d->shape);
int dragDistance;
if (vertical) {
- dragDistance = (event->pos().y() - d->dragStartPosition.y());
+ dragDistance = (event->position().toPoint().y() - d->dragStartPosition.y());
} else {
- dragDistance = (event->pos().x() - d->dragStartPosition.x());
+ dragDistance = (event->position().toPoint().x() - d->dragStartPosition.x());
}
d->tabList[d->pressedIndex].dragOffset = dragDistance;
@@ -2304,7 +2304,7 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
d->dragStartPosition = QPoint();
}
- int i = d->indexAtPos(event->pos()) == d->pressedIndex ? d->pressedIndex : -1;
+ int i = d->indexAtPos(event->position().toPoint()) == d->pressedIndex ? d->pressedIndex : -1;
d->pressedIndex = -1;
QStyleOptionTabBarBase optTabBase;
optTabBase.initFrom(this);
@@ -2322,7 +2322,7 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
void QTabBar::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_D(QTabBar);
- const QPoint pos = event->pos();
+ const QPoint pos = event->position().toPoint();
const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos))
|| (!d->rightB->isHidden() && d->rightB->geometry().contains(pos));
if (!isEventInCornerButtons)
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 9a02721e61..f98c99c72b 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1677,7 +1677,7 @@ void QTextEdit::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QTextEdit);
d->inDrag = false; // paranoia
- const QPoint pos = e->pos();
+ const QPoint pos = e->position().toPoint();
d->sendControlEvent(e);
if (!(e->buttons() & Qt::LeftButton))
return;
@@ -1700,7 +1700,7 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e)
d->autoScrollTimer.stop();
ensureCursorVisible();
}
- if (!isReadOnly() && rect().contains(e->pos()))
+ if (!isReadOnly() && rect().contains(e->position().toPoint()))
d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
d->clickCausedFocus = 0;
}
@@ -1771,7 +1771,7 @@ void QTextEdit::dragLeaveEvent(QDragLeaveEvent *e)
void QTextEdit::dragMoveEvent(QDragMoveEvent *e)
{
Q_D(QTextEdit);
- d->autoScrollDragPos = e->pos();
+ d->autoScrollDragPos = e->position().toPoint();
if (!d->autoScrollTimer.isActive())
d->autoScrollTimer.start(100, this);
d->sendControlEvent(e);
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 9c63f98a73..c76c7f6c70 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -247,7 +247,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
Q_Q(QToolBar);
QStyleOptionToolBar opt;
q->initStyleOption(&opt);
- if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) {
+ if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->position().toPoint()) == false) {
#ifdef Q_OS_MACOS
// When using the unified toolbar on OS X, the user can click and
// drag between toolbar contents to move the window. Make this work by
@@ -272,7 +272,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
if (!layout->movable())
return true;
- initDrag(event->pos());
+ initDrag(event->position().toPoint());
return true;
}
@@ -317,11 +317,11 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
Q_ASSERT(layout != nullptr);
if (layout->pluggingWidget == nullptr
- && (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) {
+ && (event->position().toPoint() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) {
const bool wasDragging = state->dragging;
const bool moving = !q->isWindow() && (orientation == Qt::Vertical ?
- event->x() >= 0 && event->x() < q->width() :
- event->y() >= 0 && event->y() < q->height());
+ event->position().toPoint().x() >= 0 && event->position().toPoint().x() < q->width() :
+ event->position().toPoint().y() >= 0 && event->position().toPoint().y() < q->height());
startDrag(moving);
if (!moving && !wasDragging)
@@ -329,7 +329,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
}
if (state->dragging) {
- QPoint pos = event->globalPos();
+ QPoint pos = event->globalPosition().toPoint();
// if we are right-to-left, we move so as to keep the right edge the same distance
// from the mouse
if (q->isLeftToRight())
@@ -338,14 +338,14 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
pos += QPoint(state->pressPos.x() - q->width(), -state->pressPos.y());
q->move(pos);
- layout->hover(state->widgetItem, event->globalPos());
+ layout->hover(state->widgetItem, event->globalPosition().toPoint());
} else if (state->moving) {
const QPoint rtl(q->width() - state->pressPos.x(), state->pressPos.y()); //for RTL
const QPoint globalPressPos = q->mapToGlobal(q->isRightToLeft() ? rtl : state->pressPos);
int pos = 0;
- QPoint delta = event->globalPos() - globalPressPos;
+ QPoint delta = event->globalPosition().toPoint() - globalPressPos;
if (orientation == Qt::Vertical) {
pos = q->y() + delta.y();
} else {
@@ -1150,7 +1150,7 @@ bool QToolBar::event(QEvent *event)
QHoverEvent *e = static_cast<QHoverEvent*>(event);
QStyleOptionToolBar opt;
initStyleOption(&opt);
- if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos()))
+ if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->position().toPoint()))
setCursor(Qt::SizeAllCursor);
else
unsetCursor();
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index e8cb502650..d350e1731e 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -603,7 +603,7 @@ void QToolButton::mousePressEvent(QMouseEvent *e)
if (e->button() == Qt::LeftButton && (d->popupMode == MenuButtonPopup)) {
QRect popupr = style()->subControlRect(QStyle::CC_ToolButton, &opt,
QStyle::SC_ToolButtonMenu, this);
- if (popupr.isValid() && popupr.contains(e->pos())) {
+ if (popupr.isValid() && popupr.contains(e->position().toPoint())) {
d->buttonPressed = QToolButtonPrivate::MenuButtonPressed;
showMenu();
return;
@@ -1004,7 +1004,7 @@ bool QToolButton::event(QEvent *event)
case QEvent::HoverLeave:
case QEvent::HoverMove:
if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d_func()->updateHoverControl(he->pos());
+ d_func()->updateHoverControl(he->position().toPoint());
break;
default:
break;
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index e012ca624d..1c850741bb 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -111,7 +111,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
if (w->isMaximized())
break;
const QRect widgetRect = widget->rect().marginsAdded(QMargins(range, range, range, range));
- const QPoint cursorPoint = widget->mapFromGlobal(e->globalPos());
+ const QPoint cursorPoint = widget->mapFromGlobal(e->globalPosition().toPoint());
if (!widgetRect.contains(cursorPoint))
return false;
if (e->button() == Qt::LeftButton) {
@@ -119,7 +119,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
emit activate();
mouseMoveEvent(e);
buttonDown = true;
- moveOffset = widget->mapFromGlobal(e->globalPos());
+ moveOffset = widget->mapFromGlobal(e->globalPosition().toPoint());
invertedMoveOffset = widget->rect().bottomRight() - moveOffset;
if (mode != Center)
return true;
@@ -165,7 +165,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e)
{
- QPoint pos = widget->mapFromGlobal(e->globalPos());
+ QPoint pos = widget->mapFromGlobal(e->globalPosition().toPoint());
if (!active && !buttonDown) {
if (pos.y() <= range && pos.x() <= range)
mode = TopLeft;
@@ -204,7 +204,7 @@ void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e)
QPoint globalPos = (!widget->isWindow() && widget->parentWidget()) ?
- widget->parentWidget()->mapFromGlobal(e->globalPos()) : e->globalPos();
+ widget->parentWidget()->mapFromGlobal(e->globalPosition().toPoint()) : e->globalPosition().toPoint();
if (!widget->isWindow() && !widget->parentWidget()->rect().contains(globalPos)) {
if (globalPos.x() < 0)
globalPos.rx() = 0;
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index cb9dffc8c0..ff82b1d37c 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -1040,23 +1040,23 @@ void QWidgetTextControl::processEvent(QEvent *e, const QTransform &transform, QW
break;
case QEvent::MouseButtonPress: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mousePressEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
- ev->buttons(), ev->globalPos());
+ d->mousePressEvent(ev, ev->button(), transform.map(ev->position().toPoint()), ev->modifiers(),
+ ev->buttons(), ev->globalPosition().toPoint());
break; }
case QEvent::MouseMove: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mouseMoveEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
- ev->buttons(), ev->globalPos());
+ d->mouseMoveEvent(ev, ev->button(), transform.map(ev->position().toPoint()), ev->modifiers(),
+ ev->buttons(), ev->globalPosition().toPoint());
break; }
case QEvent::MouseButtonRelease: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
- ev->buttons(), ev->globalPos());
+ d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->position().toPoint()), ev->modifiers(),
+ ev->buttons(), ev->globalPosition().toPoint());
break; }
case QEvent::MouseButtonDblClick: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
- d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
- ev->buttons(), ev->globalPos());
+ d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->position().toPoint()), ev->modifiers(),
+ ev->buttons(), ev->globalPosition().toPoint());
break; }
case QEvent::InputMethod:
d->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
@@ -1096,13 +1096,13 @@ void QWidgetTextControl::processEvent(QEvent *e, const QTransform &transform, QW
break;
case QEvent::DragMove: {
QDragMoveEvent *ev = static_cast<QDragMoveEvent *>(e);
- if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->pos())))
+ if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->position().toPoint())))
ev->acceptProposedAction();
break;
}
case QEvent::Drop: {
QDropEvent *ev = static_cast<QDropEvent *>(e);
- if (d->dropEvent(ev->mimeData(), transform.map(ev->pos()), ev->dropAction(), ev->source()))
+ if (d->dropEvent(ev->mimeData(), transform.map(ev->position().toPoint()), ev->dropAction(), ev->source()))
ev->acceptProposedAction();
break;
}
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
index a1de205571..1e813cc397 100644
--- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
@@ -117,15 +117,15 @@ void tst_QMouseEvent::mouseEventBasic()
QCOMPARE(me.isAccepted(), true);
QCOMPARE(me.button(), Qt::LeftButton);
QCOMPARE(me.buttons(), Qt::LeftButton);
- QCOMPARE(me.localPos(), local);
- QCOMPARE(me.windowPos(), scene);
- QCOMPARE(me.screenPos(), screen);
+ QCOMPARE(me.position(), local);
+ QCOMPARE(me.scenePosition(), scene);
+ QCOMPARE(me.globalPosition(), screen);
QPointF changedLocal(33, 66);
me.setLocalPos(changedLocal);
- QCOMPARE(me.localPos(), changedLocal);
- QCOMPARE(me.windowPos(), scene);
- QCOMPARE(me.screenPos(), screen);
+ QCOMPARE(me.position(), changedLocal);
+ QCOMPARE(me.scenePosition(), scene);
+ QCOMPARE(me.globalPosition(), screen);
}
void tst_QMouseEvent::checkMousePressEvent_data()
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index ff4f4111fe..4499ba1334 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -306,8 +306,8 @@ void tst_QTouchEvent::touchDisabledByDefault()
QTouchEvent::TouchPoint touchPoint(0);
touchPoint.setState(Qt::TouchPointPressed);
touchPoint.setPos(view.mapFromScene(item.mapToScene(item.boundingRect().center())));
- touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
- touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.position().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.position().toPoint()));
QTouchEvent touchEvent(QEvent::TouchBegin,
touchScreenDevice,
Qt::NoModifier,
@@ -365,8 +365,8 @@ void tst_QTouchEvent::touchEventAcceptedByDefault()
QTouchEvent::TouchPoint touchPoint(0);
touchPoint.setState(Qt::TouchPointPressed);
touchPoint.setPos(view.mapFromScene(item.mapToScene(item.boundingRect().center())));
- touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
- touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.position().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.position().toPoint()));
QTouchEvent touchEvent(QEvent::TouchBegin,
touchScreenDevice,
Qt::NoModifier,
@@ -442,8 +442,8 @@ void tst_QTouchEvent::touchBeginPropagatesWhenIgnored()
QTouchEvent::TouchPoint touchPoint(0);
touchPoint.setState(Qt::TouchPointPressed);
touchPoint.setPos(view.mapFromScene(grandchild.mapToScene(grandchild.boundingRect().center())));
- touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
- touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.position().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.position().toPoint()));
QTouchEvent touchEvent(QEvent::TouchBegin,
touchScreenDevice,
Qt::NoModifier,
@@ -477,8 +477,8 @@ void tst_QTouchEvent::touchBeginPropagatesWhenIgnored()
QTouchEvent::TouchPoint touchPoint(0);
touchPoint.setState(Qt::TouchPointPressed);
touchPoint.setPos(view.mapFromScene(grandchild.mapToScene(grandchild.boundingRect().center())));
- touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
- touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.position().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.position().toPoint()));
QTouchEvent touchEvent(QEvent::TouchBegin,
touchScreenDevice,
Qt::NoModifier,
@@ -560,8 +560,8 @@ void tst_QTouchEvent::touchUpdateAndEndNeverPropagate()
QTouchEvent::TouchPoint touchPoint(0);
touchPoint.setState(Qt::TouchPointPressed);
touchPoint.setPos(view.mapFromScene(grandchild.mapToScene(grandchild.boundingRect().center())));
- touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
- touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.position().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.position().toPoint()));
QTouchEvent touchBeginEvent(QEvent::TouchBegin,
touchScreenDevice,
Qt::NoModifier,
@@ -625,7 +625,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
// this should be translated to a TouchBegin
rawTouchPoint.setState(Qt::TouchPointPressed);
rawTouchPoint.setScreenPos(screenPos);
- rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
+ rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.position(), screenGeometry));
QVector<QPointF> rawPosList;
rawPosList << QPointF(12, 34) << QPointF(56, 78);
rawTouchPoint.setRawScreenPositions(rawPosList);
@@ -644,21 +644,21 @@ void tst_QTouchEvent::basicRawEventTranslation()
const int touchPointId = (QTouchDevicePrivate::get(touchScreenDevice)->id << 24) + 1;
QCOMPARE(touchBeginPoint.id(), touchPointId);
QCOMPARE(touchBeginPoint.state(), rawTouchPoint.state());
- QCOMPARE(touchBeginPoint.pos(), pos);
- QCOMPARE(touchBeginPoint.startPos(), pos);
+ QCOMPARE(touchBeginPoint.position(), pos);
+ QCOMPARE(touchBeginPoint.pressPosition(), pos);
QCOMPARE(touchBeginPoint.lastPos(), pos);
- QCOMPARE(touchBeginPoint.scenePos(), rawTouchPoint.screenPos());
- QCOMPARE(touchBeginPoint.startScenePos(), rawTouchPoint.screenPos());
- QCOMPARE(touchBeginPoint.lastScenePos(), rawTouchPoint.screenPos());
- QCOMPARE(touchBeginPoint.screenPos(), rawTouchPoint.screenPos());
- QCOMPARE(touchBeginPoint.startScreenPos(), rawTouchPoint.screenPos());
- QCOMPARE(touchBeginPoint.lastScreenPos(), rawTouchPoint.screenPos());
+ QCOMPARE(touchBeginPoint.scenePosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchBeginPoint.scenePressPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchBeginPoint.lastScenePos(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchBeginPoint.globalPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchBeginPoint.globalPressPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchBeginPoint.lastScreenPos(), rawTouchPoint.globalPosition());
QCOMPARE(touchBeginPoint.normalizedPos(), rawTouchPoint.normalizedPos());
QCOMPARE(touchBeginPoint.startNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchBeginPoint.lastNormalizedPos(), touchBeginPoint.normalizedPos());
- QCOMPARE(touchBeginPoint.pos(), pos);
- QCOMPARE(touchBeginPoint.screenPos(), rawTouchPoint.screenPos());
- QCOMPARE(touchBeginPoint.scenePos(), touchBeginPoint.scenePos());
+ QCOMPARE(touchBeginPoint.position(), pos);
+ QCOMPARE(touchBeginPoint.globalPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchBeginPoint.scenePosition(), touchBeginPoint.scenePosition());
QCOMPARE(touchBeginPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(touchBeginPoint.pressure(), qreal(1.));
QCOMPARE(touchBeginPoint.velocity(), QVector2D());
@@ -668,7 +668,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
// moving the point should translate to TouchUpdate
rawTouchPoint.setState(Qt::TouchPointMoved);
rawTouchPoint.setScreenPos(screenPos + delta);
- rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
+ rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoint, window);
QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
@@ -680,28 +680,28 @@ void tst_QTouchEvent::basicRawEventTranslation()
QTouchEvent::TouchPoint touchUpdatePoint = touchWidget.touchUpdatePoints.first();
QCOMPARE(touchUpdatePoint.id(), touchPointId);
QCOMPARE(touchUpdatePoint.state(), rawTouchPoint.state());
- QCOMPARE(touchUpdatePoint.pos(), pos + delta);
- QCOMPARE(touchUpdatePoint.startPos(), pos);
+ QCOMPARE(touchUpdatePoint.position(), pos + delta);
+ QCOMPARE(touchUpdatePoint.pressPosition(), pos);
QCOMPARE(touchUpdatePoint.lastPos(), pos);
- QCOMPARE(touchUpdatePoint.scenePos(), rawTouchPoint.screenPos());
- QCOMPARE(touchUpdatePoint.startScenePos(), screenPos);
+ QCOMPARE(touchUpdatePoint.scenePosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchUpdatePoint.scenePressPosition(), screenPos);
QCOMPARE(touchUpdatePoint.lastScenePos(), screenPos);
- QCOMPARE(touchUpdatePoint.screenPos(), rawTouchPoint.screenPos());
- QCOMPARE(touchUpdatePoint.startScreenPos(), screenPos);
+ QCOMPARE(touchUpdatePoint.globalPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchUpdatePoint.globalPressPosition(), screenPos);
QCOMPARE(touchUpdatePoint.lastScreenPos(), screenPos);
QCOMPARE(touchUpdatePoint.normalizedPos(), rawTouchPoint.normalizedPos());
QCOMPARE(touchUpdatePoint.startNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchUpdatePoint.lastNormalizedPos(), touchBeginPoint.normalizedPos());
- QCOMPARE(touchUpdatePoint.pos(), pos + delta);
- QCOMPARE(touchUpdatePoint.screenPos(), rawTouchPoint.screenPos());
- QCOMPARE(touchUpdatePoint.scenePos(), touchUpdatePoint.scenePos());
+ QCOMPARE(touchUpdatePoint.position(), pos + delta);
+ QCOMPARE(touchUpdatePoint.globalPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchUpdatePoint.scenePosition(), touchUpdatePoint.scenePosition());
QCOMPARE(touchUpdatePoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(touchUpdatePoint.pressure(), qreal(1.));
// releasing the point translates to TouchEnd
rawTouchPoint.setState(Qt::TouchPointReleased);
rawTouchPoint.setScreenPos(screenPos + delta + delta);
- rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
+ rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoint, window);
QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
@@ -713,21 +713,21 @@ void tst_QTouchEvent::basicRawEventTranslation()
QTouchEvent::TouchPoint touchEndPoint = touchWidget.touchEndPoints.first();
QCOMPARE(touchEndPoint.id(), touchPointId);
QCOMPARE(touchEndPoint.state(), rawTouchPoint.state());
- QCOMPARE(touchEndPoint.pos(), pos + delta + delta);
- QCOMPARE(touchEndPoint.startPos(), pos);
+ QCOMPARE(touchEndPoint.position(), pos + delta + delta);
+ QCOMPARE(touchEndPoint.pressPosition(), pos);
QCOMPARE(touchEndPoint.lastPos(), pos + delta);
- QCOMPARE(touchEndPoint.scenePos(), rawTouchPoint.screenPos());
- QCOMPARE(touchEndPoint.startScenePos(), screenPos);
+ QCOMPARE(touchEndPoint.scenePosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchEndPoint.scenePressPosition(), screenPos);
QCOMPARE(touchEndPoint.lastScenePos(), screenPos + delta);
- QCOMPARE(touchEndPoint.screenPos(), rawTouchPoint.screenPos());
- QCOMPARE(touchEndPoint.startScreenPos(), screenPos);
+ QCOMPARE(touchEndPoint.globalPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchEndPoint.globalPressPosition(), screenPos);
QCOMPARE(touchEndPoint.lastScreenPos(), screenPos + delta);
QCOMPARE(touchEndPoint.normalizedPos(), rawTouchPoint.normalizedPos());
QCOMPARE(touchEndPoint.startNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchEndPoint.lastNormalizedPos(), touchUpdatePoint.normalizedPos());
- QCOMPARE(touchEndPoint.pos(), pos + delta + delta);
- QCOMPARE(touchEndPoint.screenPos(), rawTouchPoint.screenPos());
- QCOMPARE(touchEndPoint.scenePos(), touchEndPoint.scenePos());
+ QCOMPARE(touchEndPoint.position(), pos + delta + delta);
+ QCOMPARE(touchEndPoint.globalPosition(), rawTouchPoint.globalPosition());
+ QCOMPARE(touchEndPoint.scenePosition(), touchEndPoint.scenePosition());
QCOMPARE(touchEndPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(touchEndPoint.pressure(), qreal(0.));
}
@@ -765,10 +765,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
// generate TouchBegins on both leftWidget and rightWidget
rawTouchPoints[0].setState(Qt::TouchPointPressed);
rawTouchPoints[0].setScreenPos(leftScreenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[1].setState(Qt::TouchPointPressed);
rawTouchPoints[1].setScreenPos(rightScreenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
QWindow *window = touchWidget.windowHandle();
QList<QWindowSystemInterface::TouchPoint> nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
@@ -791,42 +791,42 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchBeginPoints.first();
QCOMPARE(leftTouchPoint.id(), touchPointId0);
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(leftTouchPoint.pos(), leftPos);
- QCOMPARE(leftTouchPoint.startPos(), leftPos);
+ QCOMPARE(leftTouchPoint.position(), leftPos);
+ QCOMPARE(leftTouchPoint.pressPosition(), leftPos);
QCOMPARE(leftTouchPoint.lastPos(), leftPos);
- QCOMPARE(leftTouchPoint.scenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.startScenePos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.scenePosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.scenePressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.startScreenPos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScreenPos(), leftScreenPos);
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
- QCOMPARE(leftTouchPoint.pos(), leftPos);
- QCOMPARE(leftTouchPoint.scenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.position(), leftPos);
+ QCOMPARE(leftTouchPoint.scenePosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchBeginPoints.first();
QCOMPARE(rightTouchPoint.id(), touchPointId1);
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
- QCOMPARE(rightTouchPoint.pos(), rightPos);
- QCOMPARE(rightTouchPoint.startPos(), rightPos);
+ QCOMPARE(rightTouchPoint.position(), rightPos);
+ QCOMPARE(rightTouchPoint.pressPosition(), rightPos);
QCOMPARE(rightTouchPoint.lastPos(), rightPos);
- QCOMPARE(rightTouchPoint.scenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.startScenePos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.scenePosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.scenePressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.startScreenPos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScreenPos(), rightScreenPos);
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
- QCOMPARE(rightTouchPoint.pos(), rightPos);
- QCOMPARE(rightTouchPoint.scenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.position(), rightPos);
+ QCOMPARE(rightTouchPoint.scenePosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
}
@@ -834,10 +834,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
// generate TouchUpdates on both leftWidget and rightWidget
rawTouchPoints[0].setState(Qt::TouchPointMoved);
rawTouchPoints[0].setScreenPos(centerScreenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[1].setState(Qt::TouchPointMoved);
rawTouchPoints[1].setScreenPos(centerScreenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
@@ -857,42 +857,42 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchUpdatePoints.first();
QCOMPARE(leftTouchPoint.id(), touchPointId0);
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(leftTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(leftTouchPoint.startPos(), leftPos);
+ QCOMPARE(leftTouchPoint.position(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(leftTouchPoint.pressPosition(), leftPos);
QCOMPARE(leftTouchPoint.lastPos(), leftPos);
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScenePos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.scenePressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScreenPos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScreenPos(), leftScreenPos);
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
- QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.position(), leftWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchUpdatePoints.first();
QCOMPARE(rightTouchPoint.id(), touchPointId1);
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
- QCOMPARE(rightTouchPoint.pos(), QPointF(rightWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(rightTouchPoint.startPos(), rightPos);
+ QCOMPARE(rightTouchPoint.position(), QPointF(rightWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(rightTouchPoint.pressPosition(), rightPos);
QCOMPARE(rightTouchPoint.lastPos(), rightPos);
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScenePos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.scenePressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScreenPos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScreenPos(), rightScreenPos);
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
- QCOMPARE(rightTouchPoint.pos(), rightWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.position(), rightWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
}
@@ -900,10 +900,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
// generate TouchEnds on both leftWidget and rightWidget
rawTouchPoints[0].setState(Qt::TouchPointReleased);
rawTouchPoints[0].setScreenPos(centerScreenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[1].setState(Qt::TouchPointReleased);
rawTouchPoints[1].setScreenPos(centerScreenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
@@ -923,42 +923,42 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchEndPoints.first();
QCOMPARE(leftTouchPoint.id(), touchPointId0);
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(leftTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(leftTouchPoint.startPos(), leftPos);
- QCOMPARE(leftTouchPoint.lastPos(), leftTouchPoint.pos());
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.lastScenePos(), leftTouchPoint.scenePos());
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScreenPos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.lastScreenPos(), leftTouchPoint.screenPos());
+ QCOMPARE(leftTouchPoint.position(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(leftTouchPoint.pressPosition(), leftPos);
+ QCOMPARE(leftTouchPoint.lastPos(), leftTouchPoint.position());
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.scenePressPosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.lastScenePos(), leftTouchPoint.scenePosition());
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPressPosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.lastScreenPos(), leftTouchPoint.globalPosition());
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
- QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.position(), leftWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(0.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchEndPoints.first();
QCOMPARE(rightTouchPoint.id(), touchPointId1);
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
- QCOMPARE(rightTouchPoint.pos(), QPointF(rightWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(rightTouchPoint.startPos(), rightPos);
- QCOMPARE(rightTouchPoint.lastPos(), rightTouchPoint.pos());
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.lastScenePos(), rightTouchPoint.scenePos());
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScreenPos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.lastScreenPos(), rightTouchPoint.screenPos());
+ QCOMPARE(rightTouchPoint.position(), QPointF(rightWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(rightTouchPoint.pressPosition(), rightPos);
+ QCOMPARE(rightTouchPoint.lastPos(), rightTouchPoint.position());
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.scenePressPosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.lastScenePos(), rightTouchPoint.scenePosition());
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPressPosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.lastScreenPos(), rightTouchPoint.globalPosition());
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
- QCOMPARE(rightTouchPoint.pos(), rightWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.position(), rightWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(0.));
}
@@ -987,7 +987,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
// this should be translated to a TouchBegin
rawTouchPoints[0].setState(Qt::TouchPointPressed);
rawTouchPoints[0].setScreenPos(screenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[0].setRawScreenPositions({{12, 34}, {56, 78}});
ulong timestamp = 1234;
QList<QWindowSystemInterface::TouchPoint> nativeTouchPoints =
@@ -1004,13 +1004,13 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
const int secTouchPointId = (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 2;
QCOMPARE(touchBeginPoint.id(), touchPointId);
QCOMPARE(touchBeginPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(touchBeginPoint.pos(), pos);
+ QCOMPARE(touchBeginPoint.position(), pos);
// press a point on secondaryTouchScreenDevice
touchWidget.seenTouchBegin = false;
rawTouchPoints[1].setState(Qt::TouchPointPressed);
rawTouchPoints[1].setScreenPos(screenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
rawTouchPoints[1].setRawScreenPositions({{90, 100}, {110, 120}});
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[1], window);
@@ -1022,13 +1022,13 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
touchBeginPoint = touchWidget.touchBeginPoints[0];
QCOMPARE(touchBeginPoint.id(), (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 2);
QCOMPARE(touchBeginPoint.state(), rawTouchPoints[1].state());
- QCOMPARE(touchBeginPoint.pos(), pos);
+ QCOMPARE(touchBeginPoint.position(), pos);
// press another point on secondaryTouchScreenDevice
touchWidget.seenTouchBegin = false;
rawTouchPoints[2].setState(Qt::TouchPointPressed);
rawTouchPoints[2].setScreenPos(screenPos);
- rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].pos(), screenGeometry));
+ rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].position(), screenGeometry));
rawTouchPoints[2].setRawScreenPositions({{130, 140}, {150, 160}});
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[2], window);
@@ -1040,12 +1040,12 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
touchBeginPoint = touchWidget.touchBeginPoints[0];
QCOMPARE(touchBeginPoint.id(), (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 3);
QCOMPARE(touchBeginPoint.state(), rawTouchPoints[2].state());
- QCOMPARE(touchBeginPoint.pos(), pos);
+ QCOMPARE(touchBeginPoint.position(), pos);
// moving the first point should translate to TouchUpdate
rawTouchPoints[0].setState(Qt::TouchPointMoved);
rawTouchPoints[0].setScreenPos(screenPos + delta);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, touchScreenDevice, nativeTouchPoints);
@@ -1057,12 +1057,12 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
QTouchEvent::TouchPoint touchUpdatePoint = touchWidget.touchUpdatePoints.first();
QCOMPARE(touchUpdatePoint.id(), touchPointId);
QCOMPARE(touchUpdatePoint.state(), rawTouchPoints[0].state());
- QCOMPARE(touchUpdatePoint.pos(), pos + delta);
+ QCOMPARE(touchUpdatePoint.position(), pos + delta);
// releasing the first point translates to TouchEnd
rawTouchPoints[0].setState(Qt::TouchPointReleased);
rawTouchPoints[0].setScreenPos(screenPos + delta + delta);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, touchScreenDevice, nativeTouchPoints);
@@ -1074,7 +1074,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
QTouchEvent::TouchPoint touchEndPoint = touchWidget.touchEndPoints.first();
QCOMPARE(touchEndPoint.id(), touchPointId);
QCOMPARE(touchEndPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(touchEndPoint.pos(), pos + delta + delta);
+ QCOMPARE(touchEndPoint.position(), pos + delta + delta);
// Widgets don't normally handle this case: if a TouchEnd was seen before, then
// WA_WState_AcceptedTouchBeginEvent will be false, and
@@ -1149,10 +1149,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
// generate TouchBegin on leftWidget only
rawTouchPoints[0].setState(Qt::TouchPointPressed);
rawTouchPoints[0].setScreenPos(leftScreenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[1].setState(Qt::TouchPointPressed);
rawTouchPoints[1].setScreenPos(rightScreenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
QWindow *window = touchWidget.windowHandle();
QList<QWindowSystemInterface::TouchPoint> nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
@@ -1174,42 +1174,42 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchBeginPoints.at(0);
QCOMPARE(leftTouchPoint.id(), rawTouchPoints[0].id());
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(leftTouchPoint.pos(), leftPos);
- QCOMPARE(leftTouchPoint.startPos(), leftPos);
+ QCOMPARE(leftTouchPoint.position(), leftPos);
+ QCOMPARE(leftTouchPoint.pressPosition(), leftPos);
QCOMPARE(leftTouchPoint.lastPos(), leftPos);
- QCOMPARE(leftTouchPoint.scenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.startScenePos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.scenePosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.scenePressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.startScreenPos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScreenPos(), leftScreenPos);
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
- QCOMPARE(leftTouchPoint.pos(), leftPos);
- QCOMPARE(leftTouchPoint.scenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.position(), leftPos);
+ QCOMPARE(leftTouchPoint.scenePosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchBeginPoints.at(1);
QCOMPARE(rightTouchPoint.id(), rawTouchPoints[1].id());
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
- QCOMPARE(rightTouchPoint.pos(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
- QCOMPARE(rightTouchPoint.startPos(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
+ QCOMPARE(rightTouchPoint.position(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
+ QCOMPARE(rightTouchPoint.pressPosition(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
QCOMPARE(rightTouchPoint.lastPos(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
- QCOMPARE(rightTouchPoint.scenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.startScenePos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.scenePosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.scenePressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.startScreenPos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScreenPos(), rightScreenPos);
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
- QCOMPARE(rightTouchPoint.pos(), rightWidget.mapFromParent(rightScreenPos.toPoint()));
- QCOMPARE(rightTouchPoint.scenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.position(), rightWidget.mapFromParent(rightScreenPos.toPoint()));
+ QCOMPARE(rightTouchPoint.scenePosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
}
@@ -1217,10 +1217,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
// generate TouchUpdate on leftWidget
rawTouchPoints[0].setState(Qt::TouchPointMoved);
rawTouchPoints[0].setScreenPos(centerScreenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[1].setState(Qt::TouchPointMoved);
rawTouchPoints[1].setScreenPos(centerScreenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
QWindowSystemInterface::handleTouchEvent(window, 0, touchPadDevice, nativeTouchPoints);
@@ -1240,42 +1240,42 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchUpdatePoints.at(0);
QCOMPARE(leftTouchPoint.id(), rawTouchPoints[0].id());
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(leftTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(leftTouchPoint.startPos(), leftPos);
+ QCOMPARE(leftTouchPoint.position(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(leftTouchPoint.pressPosition(), leftPos);
QCOMPARE(leftTouchPoint.lastPos(), leftPos);
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScenePos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.scenePressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScreenPos(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPressPosition(), leftScreenPos);
QCOMPARE(leftTouchPoint.lastScreenPos(), leftScreenPos);
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
- QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.position(), leftWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchUpdatePoints.at(1);
QCOMPARE(rightTouchPoint.id(), rawTouchPoints[1].id());
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
- QCOMPARE(rightTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(rightTouchPoint.startPos(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
+ QCOMPARE(rightTouchPoint.position(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(rightTouchPoint.pressPosition(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
QCOMPARE(rightTouchPoint.lastPos(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScenePos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.scenePressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScreenPos(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPressPosition(), rightScreenPos);
QCOMPARE(rightTouchPoint.lastScreenPos(), rightScreenPos);
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
- QCOMPARE(rightTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.position(), leftWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
}
@@ -1283,10 +1283,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
// generate TouchEnd on leftWidget
rawTouchPoints[0].setState(Qt::TouchPointReleased);
rawTouchPoints[0].setScreenPos(centerScreenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[1].setState(Qt::TouchPointReleased);
rawTouchPoints[1].setScreenPos(centerScreenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
QWindowSystemInterface::handleTouchEvent(window, 0, touchPadDevice, nativeTouchPoints);
@@ -1306,42 +1306,42 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchEndPoints.at(0);
QCOMPARE(leftTouchPoint.id(), rawTouchPoints[0].id());
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
- QCOMPARE(leftTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(leftTouchPoint.startPos(), leftPos);
- QCOMPARE(leftTouchPoint.lastPos(), leftTouchPoint.pos());
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScenePos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.lastScenePos(), leftTouchPoint.scenePos());
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.startScreenPos(), leftScreenPos);
- QCOMPARE(leftTouchPoint.lastScreenPos(), leftTouchPoint.screenPos());
+ QCOMPARE(leftTouchPoint.position(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(leftTouchPoint.pressPosition(), leftPos);
+ QCOMPARE(leftTouchPoint.lastPos(), leftTouchPoint.position());
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.scenePressPosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.lastScenePos(), leftTouchPoint.scenePosition());
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPressPosition(), leftScreenPos);
+ QCOMPARE(leftTouchPoint.lastScreenPos(), leftTouchPoint.globalPosition());
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
- QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.position(), leftWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(leftTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(leftTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(0.));
QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchEndPoints.at(1);
QCOMPARE(rightTouchPoint.id(), rawTouchPoints[1].id());
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
- QCOMPARE(rightTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
- QCOMPARE(rightTouchPoint.startPos(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
- QCOMPARE(rightTouchPoint.lastPos(), rightTouchPoint.pos());
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScenePos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.lastScenePos(), rightTouchPoint.scenePos());
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.startScreenPos(), rightScreenPos);
- QCOMPARE(rightTouchPoint.lastScreenPos(), rightTouchPoint.screenPos());
+ QCOMPARE(rightTouchPoint.position(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
+ QCOMPARE(rightTouchPoint.pressPosition(), QPointF(leftWidget.mapFromGlobal(rightScreenPos.toPoint())));
+ QCOMPARE(rightTouchPoint.lastPos(), rightTouchPoint.position());
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.scenePressPosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.lastScenePos(), rightTouchPoint.scenePosition());
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPressPosition(), rightScreenPos);
+ QCOMPARE(rightTouchPoint.lastScreenPos(), rightTouchPoint.globalPosition());
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
- QCOMPARE(rightTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
- QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
- QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.position(), leftWidget.mapFromParent(centerPos.toPoint()));
+ QCOMPARE(rightTouchPoint.scenePosition(), centerScreenPos);
+ QCOMPARE(rightTouchPoint.globalPosition(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(0.));
}
@@ -1376,7 +1376,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds()
rawTouchPoint.setId(i);
rawTouchPoint.setState(Qt::TouchPointPressed);
rawTouchPoint.setScreenPos(screenPos[i]);
- rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
+ rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.position(), screenGeometry));
rawTouchPoint.setRawScreenPositions(rawPosList);
rawTouchPoints << rawTouchPoint;
}
@@ -1406,8 +1406,8 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds()
for (int i = 0; i < rawTouchPoints.count(); ++i) {
QTouchEvent::TouchPoint &p = rawTouchPoints[i];
p.setState(Qt::TouchPointMoved);
- p.setScreenPos(p.screenPos() + delta);
- p.setNormalizedPos(normalized(p.pos(), screenGeometry));
+ p.setScreenPos(p.globalPosition() + delta);
+ p.setNormalizedPos(normalized(p.position(), screenGeometry));
}
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
@@ -1550,8 +1550,8 @@ void tst_QTouchEvent::deleteInEventHandler()
QTouchEvent::TouchPoint touchPoint(0);
touchPoint.setState(Qt::TouchPointPressed);
touchPoint.setPos(view.mapFromScene(child1->mapToScene(child1->boundingRect().center())));
- touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
- touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.position().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.position().toPoint()));
QList<QTouchEvent::TouchPoint> touchPoints;
touchPoints.append(touchPoint);
QTouchEvent touchBeginEvent(QEvent::TouchBegin,
@@ -1652,13 +1652,13 @@ void tst_QTouchEvent::deleteInRawEventTranslation()
rawTouchPoints.append(QTouchEvent::TouchPoint(2));
rawTouchPoints[0].setState(Qt::TouchPointPressed);
rawTouchPoints[0].setScreenPos(leftScreenPos);
- rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].position(), screenGeometry));
rawTouchPoints[1].setState(Qt::TouchPointPressed);
rawTouchPoints[1].setScreenPos(centerScreenPos);
- rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].position(), screenGeometry));
rawTouchPoints[2].setState(Qt::TouchPointPressed);
rawTouchPoints[2].setScreenPos(rightScreenPos);
- rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].pos(), screenGeometry));
+ rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].position(), screenGeometry));
// generate begin events on all widgets, the left widget should die
QWindow *window = touchWidget.windowHandle();
@@ -1895,14 +1895,14 @@ void tst_QTouchEvent::testMultiDevice()
QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1);
QCOMPARE(filter.d.value(deviceTwo).points.count(), 2);
- QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).screenPos(), area0.center());
+ QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).globalPosition(), area0.center());
QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).ellipseDiameters(), area0.size());
QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).state(), pointsOne[0].state);
- QCOMPARE(filter.d.value(deviceTwo).points.at(0).screenPos(), area0.center());
+ QCOMPARE(filter.d.value(deviceTwo).points.at(0).globalPosition(), area0.center());
QCOMPARE(filter.d.value(deviceTwo).points.at(0).ellipseDiameters(), area0.size());
QCOMPARE(filter.d.value(deviceTwo).points.at(0).state(), pointsTwo[0].state);
- QCOMPARE(filter.d.value(deviceTwo).points.at(1).screenPos(), area1.center());
+ QCOMPARE(filter.d.value(deviceTwo).points.at(1).globalPosition(), area1.center());
QCOMPARE(filter.d.value(deviceTwo).points.at(1).state(), pointsTwo[1].state);
}
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 5843516d85..f22c23f6e0 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -911,8 +911,8 @@ public:
++mousePressedCount;
mouseSequenceSignature += 'p';
mousePressButton = event->button();
- mousePressScreenPos = event->screenPos();
- mousePressLocalPos = event->localPos();
+ mousePressScreenPos = event->globalPosition();
+ mousePressLocalPos = event->position();
if (spinLoopWhenPressed)
QCoreApplication::processEvents();
}
@@ -935,7 +935,7 @@ public:
} else {
++mouseMovedCount;
mouseMoveButton = event->button();
- mouseMoveScreenPos = event->screenPos();
+ mouseMoveScreenPos = event->globalPosition();
}
}
void mouseDoubleClickEvent(QMouseEvent *event) override
@@ -1697,8 +1697,8 @@ public:
void tabletEvent(QTabletEvent *ev) override
{
eventType = ev->type();
- eventGlobal = ev->globalPosF();
- eventLocal = ev->posF();
+ eventGlobal = ev->globalPosition();
+ eventLocal = ev->position();
eventDevice = ev->deviceType();
}
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp
index 278e1d3070..5b34ebb013 100644
--- a/tests/auto/other/gestures/tst_gestures.cpp
+++ b/tests/auto/other/gestures/tst_gestures.cpp
@@ -2099,7 +2099,7 @@ public:
switch(event->type()) {
case QEvent::MouseButtonPress:
if (me->button() == mouseButton && gesture->state() == Qt::NoGesture) {
- gesture->setHotSpot(QPointF(me->globalPos()));
+ gesture->setHotSpot(QPointF(me->globalPosition().toPoint()));
if (m_type == RmbAndCancelAllType)
gesture->setGestureCancelPolicy(QGesture::CancelAllInContext);
return QGestureRecognizer::TriggerGesture;
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index a999ea05df..873d0460ff 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -10489,7 +10489,7 @@ protected:
case QEvent::MouseMove:
case QEvent::MouseButtonRelease: {
QMouseEvent *me = static_cast<QMouseEvent *>(e);
- m_log->push_back(mouseEventLogEntry(objectName(), me->type(), me->pos(), me->buttons()));
+ m_log->push_back(mouseEventLogEntry(objectName(), me->type(), me->position().toPoint(), me->buttons()));
me->accept();
return true;
}
@@ -10613,7 +10613,7 @@ protected:
case QEvent::MouseMove:
case QEvent::MouseButtonRelease:
++m_mouseEventCount;
- m_lastMouseEventPos = static_cast<QMouseEvent *>(e)->localPos();
+ m_lastMouseEventPos = static_cast<QMouseEvent *>(e)->position();
if (m_acceptMouse)
e->accept();
else
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index ee40fc56c9..a0842201ae 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -533,7 +533,7 @@ private:
void DnDEventLoggerWidget::formatDropEvent(const char *function, const QDropEvent *e, QTextStream &str) const
{
- str << objectName() << "::" << function << " at " << e->pos().x() << ',' << e->pos().y()
+ str << objectName() << "::" << function << " at " << e->position().toPoint().x() << ',' << e->position().toPoint().y()
<< " action=" << e->dropAction()
<< ' ' << quintptr(e->mimeData()) << " '" << e->mimeData()->text() << '\'';
}
@@ -577,7 +577,7 @@ static QString msgEventAccepted(const QDropEvent &e)
{
QString message;
QTextStream str(&message);
- str << "Event at " << e.pos().x() << ',' << e.pos().y() << ' ' << (e.isAccepted() ? "accepted" : "ignored");
+ str << "Event at " << e.position().toPoint().x() << ',' << e.position().toPoint().y() << ' ' << (e.isAccepted() ? "accepted" : "ignored");
return message;
}