QML Mouse interaction with WebAssembly
-
HI,
We have build a software based on Qt / QML for desktop (Windows + Linux). We have now to add some of the functionnalities for web. For that, the first idea is to port using WebAssembly support of Qt. We have been able to compile pretty much everything but now we are experiencing issue with mouse interaction. Each time we click on the view, the position received is always 0,0. To validate this is not an issue on our software stack, we just made a minimal example as followed.
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 ApplicationWindow { id: appWindow visible: true height: 100 width: 100 Rectangle { anchors.fill: parent color: "red" } ColumnLayout { anchors.fill: parent Button { text: "a" Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter onClicked: { console.log("Clicked button A") } } Button { text: "b" Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter onClicked: { console.log("Clicked button B") } } } MouseArea { anchors.fill: parent onPressed: { console.log("MouseArea pressed " + mouse.x + " " + mouse.y) } } }
Wherever we click we always got "MouseArea pressed 0 0" in the output console. We tested on Chrome and Firefox with same behavior. We are using Qt6.3.1.
Is that a known issue ? Is there something to setup when using WebAssembly that can explain the behavior ?Thanks a lot for your help
Best regards
Loic
-
That example is working for me using Qt 6.3.1 and 6.4 webassembly.
Did you self build 6.3.1 or using the binary release?