summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 24647dd74c..b14b23909e 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -691,7 +691,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
}
// Find the topmost item under the mouse with a cursor.
foreach (QGraphicsItem *item, scene->d_func()->cachedItemsUnderMouse) {
- if (item->hasCursor()) {
+ if (item->isEnabled() && item->hasCursor()) {
_q_setViewportCursor(item->cursor());
return;
}
@@ -808,7 +808,7 @@ void QGraphicsViewPrivate::_q_unsetViewportCursor()
Q_Q(QGraphicsView);
const auto items = q->items(lastMouseEvent.pos());
for (QGraphicsItem *item : items) {
- if (item->hasCursor()) {
+ if (item->isEnabled() && item->hasCursor()) {
_q_setViewportCursor(item->cursor());
return;
}
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
/*