Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.5.0 Beta2
-
None
Description
Try the attached example ( qquickwidget-cursor.tgz ) to reproduce: move the mouse cursor above the rectangle and press space to change mouse cursor. It doesn't work with QGraphicsView. See the comments in mainwindow.cpp.
This example looks artificial and pointless but this mimics QtWebEngine behavior:
- QQuickWidget handles events.
- Mouse events are not handled by the default Qt implementation (they are forwarded to Chromium in QtWebEngine).
- In this example, I use keyboard event for triggering the cursor change because using mouse events would complicate things even further.
The QtWebEngine issue is this: https://bugreports.qt.io/browse/QTBUG-108284
Cursor position and item geometry is verbosed in the example. As far as I can see, the problem is that it is not detected properly whether the mouse cursor is above the item if it is inside a QGraphicsView. See QQuickItem::setCursor() implementation:
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 5b293afaa3..c2ebafdb3a 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -8025,7 +8025,7 @@ void QQuickItem::setCursor(const QCursor &cursor) QWindow *renderWindow = QQuickRenderControl::renderWindowFor(d->window); QWindow *window = renderWindow ? renderWindow : d->window; QPointF pos = window->mapFromGlobal(QGuiApplicationPrivate::lastCursorPosition); - if (contains(mapFromScene(pos))) + if (contains(mapFromScene(pos))) // <- This should not return false. updateCursorPos = pos; } }
Attachments
Issue Links
- is required for
-
QTBUG-108284 CSS-styled cursors not shown when QWebEngineView is wrapped in QGraphicsProxyWidget
- Reported
- relates to
-
QTBUG-112190 QEventPoint::scenePosition is not reliable for QQuickWidget
- Reported
-
QTBUG-111927 Link hovering may not change cursor shape in web view
- Open