Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85712

WebAssembly: RoundButton has odd behaviour on repeated clicks

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.1.0
    • 5.15.0
    • Quick: Controls 2
    • None
    • Qt 5.15 via MaintenanceTool on Debian Buster amd64 ; emscripten install per wiki instructions for that version. Running in chromium 83.0.4103.
    • WebAssembly
    • f785849768981a1fcfc778f2f593b9e564e784a8 (qt/qtbase/dev) 7ba6ce9ed5c3e3a775f5ea2fcbbbc1f628e0624a (qt/qtbase/5.15)

    Description

      I've been playing with wasm. Very cool! But I noticed an odd behaviour with a RoundButton in my app's UI. The behaviour in wasm isn't the same as the native build.

      Observed behaviour in wasm build is that clicking the button generates an onClicked as expected. But then, after an indefinite delay, if the mouse is not moved away from the button in the meanwhile, then the next click does not generate an onClicked. Instead it generates an onDoubleClicked, no matter how long ago the original click was (and then the next click will be an onClicked, then onDoubleClicked and so on). However, if the mouse is moved away from the button and then back again, then an onClicked will be generated by the second click as expected.

      Behaviour in the native build (gcc_64) is as expected: an onDoubleClicked is only generated by clicks repeated within a short interval and a delay between clicks will result in onClicked only.

      This is an extract from the ApplicationWindow-based app (appends to a text label because I have no idea to see console.log logging in wasm builds); I'd guess pasting it into any other ApplicationWindow app would exhibit the same:

      header: ToolBar {
          RowLayout {
            RoundButton {
              id: hamburger
              text: '\u2630'  // Unicode hamburger character
              onClicked: {title.text=title.text+'!';}
              onDoubleClicked: {title.text=title.text+'*';}
            }
            Label {
              id: title
              text: 'Title'
            }
          }
        }
      

      If the mouse is not moved away from the button between clicks, the title will be extended by '! * ! * ! * ! *' no matter how long is left between clicks. If the mouse is moved away from the button and then back between clicks, then the title will be extended by ' ! ! ! ! ! ! ' as expected.

      I've not investigated whether any other button types misbehave similarly (my app doesn't have any yet). Not noticed any problems with clickable MouseAreas though.

      A viable workround for my app seems to be to provide an onDoubleClicked handler with the same functionality as onClicked.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lpotter Lorn Potter
            timday Tim Day
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes