Different behavior in Qt5 and Qt6 with respect to QML files
-
I am trying to create 2 classes derived from QQuickItem (ParentItem and ChildItem). Both these quickitems have event handlers (mousePressEvent and mouseReleaseEvent) overridden from QQuickItem.
In QML, I am trying to create the quickitem as follows:
ParentItem{ id: parentItem width: 300 height: 300 visible: true Rectangle { color: "yellow" anchors.fill: parent z: -1 ChildItem{ id: childItem width: 150 height: 150 visible: true Rectangle { color: "blue" anchors.fill: parent } } } }
If I click on the blue rectangle (ChildItem), the ParentItem's event handlers are triggered.
In Qt5, for the same project, the ChildItem's event handlers are triggered.
Is this a new behavior with Qt6? Or is it a bug with Qt6? -
@devil_coder any specific parts that cause this behavior? The z index comes to mind.
I'd love it if you can share your thoughts on the most detailed reason you deducted that caused this change.
Also, which Qt versions exactly?
-
@devil_coder said in Different behavior in Qt5 and Qt6 with respect to QML files:
Specifically, behavioral difference when clicked was the main reason why I am suspecting z order can be causing the issue.
As you have the code, and we don't. Please confirm that by playing with the z index in that qml.
Please report back your findings.