Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Mouse interaction with WebAssembly

QML Mouse interaction with WebAssembly

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 261 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    loiczimmermann
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • lorn.potterL Offline
      lorn.potterL Offline
      lorn.potter
      wrote on last edited by
      #2

      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?

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved