summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2019-07-05 17:24:22 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2019-07-08 20:51:22 +0200
commitd8688d44840dd3f2324769d10b927c442b42e2c0 (patch)
tree4166ae6ec8854b0c44e171fb144df4f7406601ac /tests/auto/widgets/graphicsview
parent307403f8b4f25f3fa711fb64102c755d50283c2b (diff)
Don't set the mouse cursor for items that are disabled
As with widgets, items that are disabled should not receive any input events. Similar to QGraphicsScene, which ignores disabled items when handling mouse presses, the view should also ignore them when handling mouse moves to update the cursor. Since QGraphicsView only adjusts the cursors on mouse moves, reenabling an item that is currently under the mouse will not change the cursor. This is consistent with other changes of item attributes that would position the item under the mouse (such as moving it). The overhead of hit-testing items for every such attribute change would be too large, and applications can generate a mouse move event if they really need to adjust the cursor in all situations. [ChangeLog][QtWidgets][QGraphicsView] Ignore disabled items when setting the mouse cursor. Fixes: QTBUG-76765 Change-Id: Ifcd31fc0581e8421e58eeb436a55b031909eed7e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index af4b6c9e4a..3260e09943 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -4219,6 +4219,15 @@ void tst_QGraphicsItem::cursor()
}
QTRY_COMPARE(view.viewport()->cursor().shape(), viewportShape);
+
+ item1->setEnabled(false);
+ {
+ QTest::mouseMove(view.viewport(), item1Center);
+ QMouseEvent event(QEvent::MouseMove, item1Center, view.viewport()->mapToGlobal(item1Center), Qt::NoButton, 0, 0);
+ QApplication::sendEvent(view.viewport(), &event);
+ }
+
+ QTRY_COMPARE(view.viewport()->cursor().shape(), viewportShape);
}
#endif
/*