Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Right Mouse Button is not detected
QtWS25 Last Chance

Right Mouse Button is not detected

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
qmlmouseareamouseeventswasm
4 Posts 3 Posters 835 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
    lonelyteapot
    wrote on 27 Oct 2021, 23:10 last edited by
    #1

    Below is QML code containing a MouseArea and some Texts that show if LeftButton and/or RightButton are pressed.

    On Desktop, everything works as expected. But when compiled for WebAssembly, only LeftButton press is registered.
    RightButton is not detected, even if Left is also pressed down. MiddleButton doesn't seem to work as well.

    Tested on Firefox and Chrome.
    The project is built using QtCreator with generated by default main.cpp and CMakeLists.txt.
    Versions used: Qt 6.2.1, Emscripten 2.0.14.

    import QtQuick
    import QtQuick.Window
    
    Window {
        width: 640
        height: 480
        visible: true
    
        MouseArea {
            anchors.fill: parent
            acceptedButtons: Qt.AllButtons
    
            Text {
                id: text_left
                anchors.centerIn: parent
                font.pixelSize: 28
                text: "Left button: " + ((parent.pressedButtons & Qt.LeftButton) ? "pressed" : "not pressed")
            }
    
            Text {
                id: text_right
                anchors.top: text_left.bottom
                anchors.horizontalCenter: parent.horizontalCenter
                font.pixelSize: 28
                text: "Right button: " + ((parent.pressedButtons & Qt.RightButton) ? "pressed" : "not pressed")
            }
        }
    }
    
    G 1 Reply Last reply 9 Dec 2021, 09:53
    1
    • L lonelyteapot
      27 Oct 2021, 23:10

      Below is QML code containing a MouseArea and some Texts that show if LeftButton and/or RightButton are pressed.

      On Desktop, everything works as expected. But when compiled for WebAssembly, only LeftButton press is registered.
      RightButton is not detected, even if Left is also pressed down. MiddleButton doesn't seem to work as well.

      Tested on Firefox and Chrome.
      The project is built using QtCreator with generated by default main.cpp and CMakeLists.txt.
      Versions used: Qt 6.2.1, Emscripten 2.0.14.

      import QtQuick
      import QtQuick.Window
      
      Window {
          width: 640
          height: 480
          visible: true
      
          MouseArea {
              anchors.fill: parent
              acceptedButtons: Qt.AllButtons
      
              Text {
                  id: text_left
                  anchors.centerIn: parent
                  font.pixelSize: 28
                  text: "Left button: " + ((parent.pressedButtons & Qt.LeftButton) ? "pressed" : "not pressed")
              }
      
              Text {
                  id: text_right
                  anchors.top: text_left.bottom
                  anchors.horizontalCenter: parent.horizontalCenter
                  font.pixelSize: 28
                  text: "Right button: " + ((parent.pressedButtons & Qt.RightButton) ? "pressed" : "not pressed")
              }
          }
      }
      
      G Offline
      G Offline
      greg2001
      wrote on 9 Dec 2021, 09:53 last edited by
      #2

      +1 for this issue, a real show-stopper for our project.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lorn.potter
        wrote on 27 Dec 2021, 20:23 last edited by
        #3

        Thanks for this. Although the proper place for bug reports is at https://bugreports.qt.io

        I have made one for you:
        https://bugreports.qt.io/browse/QTBUG-99474

        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
        1
        • L Offline
          L Offline
          lorn.potter
          wrote on 27 Dec 2021, 21:30 last edited by
          #4

          This is already fixed in 6.2.3, and 6.3

          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
          1

          • Login

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