MouseArea and WebEngine: Qt6 Bug?
-
I have some QML code that is supposed to track whether the mouse is over a WebEngineView, with a similar intent as mentioned here.
Except, my code is arranged the other way around: MouseArea wraps the WebEngineView, rather than having the WebEngineView wrap the MouseArea:
MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { main.title = "onEntered"; console.log("##### onEntered"); } onExited: { main.title = "onExited"; console.log("##### onExited"); } WebEngineView { x: 30 y: 30 width: parent.width-(x*2) height: parent.height-(x*2) url : "http://www.example.com" } }
Now in Qt5 this works as expected: when you enter the MouseArea and keep moving across the MouseArea / WebEngineView, the only code that ever gets called here is onEnter.
With Qt6 this is different: onEnter is called when the MouseArea is entered but here is the difference: as soon as the mouse moves over the WebEngineView, onExit gets called (and onEnter is called again when moving the mouse from the WebEngineView object over the MouseArea).
It seems to me that the more correcter approach would be having the MouseArea inside the WebEngineView object, but then there is the still valid issue that all MouseArea events appear to be consumed as already mentioned in the other question.
So here are two questions:
- Is this a Qt 6 bug? If so, will it be fixed?
- Isn't it more correct to rearrange the Obejcts that the MouseArea is inside the WebEngineView (in which case there should be a way to pass events through to the WebEngineView)?