diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-01-31 16:09:38 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-02-03 10:18:43 +0100 |
commit | 0a64a044b6c1c44b0a2bb2be5e70fda920f5f6bf (patch) | |
tree | cf52d91141e3745f3aa3e550948de4256ce2a85e /tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | |
parent | 5c6f8b2c67852dbd3674658736d1a1ab96a2571d (diff) |
Add a QHoverEvent ctor taking global mouse position; deprecate the other
The QSinglePointEvent ctor assumes that the given globalPos is correct,
so it was wrong that the QHoverEvent ctor passed along a local position
as global. It's better to require globalPos as an argument; and in fact
it seems that everywhere we construct a QHoverEvent, global position is
available, or possible to get by transformation (which is better than
resorting to QCursor::pos()).
Also, don't convert to QPoint: pointer events have qreal resolution and
there's no reason to truncate them.
Fixes: QTBUG-100324
Change-Id: I919455da36265988d3d149eb97563c9ed0d2c660
Pick-to: 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp')
-rw-r--r-- | tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index f2a7981b4c..6bfe7f5371 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1859,11 +1859,11 @@ void tst_QMainWindow::setCursor() QVERIFY(QTest::qWaitForWindowActive(&mw)); QCOMPARE(cur.shape(), mw.cursor().shape()); - QHoverEvent enterE(QEvent::HoverEnter, QPoint(10,10), QPoint()); + QHoverEvent enterE(QEvent::HoverEnter, QPoint(10,10), QPoint(), QPoint()); mw.event(&enterE); QCOMPARE(cur.shape(), mw.cursor().shape()); - QHoverEvent leaveE(QEvent::HoverLeave, QPoint(), QPoint()); + QHoverEvent leaveE(QEvent::HoverLeave, QPoint(), QPoint(), QPoint()); mw.event(&leaveE); QCOMPARE(cur.shape(), mw.cursor().shape()); } |