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. simulating mouse area release event.

simulating mouse area release event.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
9 Posts 3 Posters 2.8k Views 2 Watching
  • 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.
  • A Offline
    A Offline
    AYYAPPA
    wrote on last edited by
    #1

    hi all,

    anyone know how to simulate a mouse release event , jut like imitating qt mouse area release event.

    i have a scenario where one button item stuck in pressed state. i want to send a simulated mouse area released event for this button.

    thanks,
    ayyappa.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can use QTest library for this: https://doc.qt.io/qt-5/qtest.html#mouseRelease

      Or construct a QMouseEvent yourself and pass it to the event loop.

      But, if your button is stuck, I'd rather say you should fix that.

      (Z(:^

      1 Reply Last reply
      2
      • A Offline
        A Offline
        AYYAPPA
        wrote on last edited by AYYAPPA
        #3

        @sierdzio said in simulating mouse area release event.:

        onstruct a QMouseEvent yourself and pass it to the event loop.

        thanks for your input. i will try fixing it in code without having to simulate mouse release events.i will also look into QTest library and update the topic accordingly.

        actually this button struck case occurs in following scenario:
        i have a soft keyboard item which contains many keys(buttons) in it.
        if i press a button(first) with finger(touch) , and with out releasing this button, if i click on different button(second) with mouse, second button click executed successfully,but even after taking finger off the first button i pressed , first button stayed in pressed state.

        could you please suggest any approach that you think that could solve this issue?.

        thanks,
        ayyappa.

        J.HilkJ 1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Whoa, that's an unusual use case. I have no idea how to help here, sorry. It sounds a bit like a bug in Qt (so perhaps report it?) and a bit like a corner case that might be intentionally left unimplemented.

          Perhaps MultiPointTouchArea could help? https://doc.qt.io/qt-5/qml-qtquick-multipointtoucharea.html It's a total guess, though.

          (Z(:^

          A 1 Reply Last reply
          2
          • A AYYAPPA

            @sierdzio said in simulating mouse area release event.:

            onstruct a QMouseEvent yourself and pass it to the event loop.

            thanks for your input. i will try fixing it in code without having to simulate mouse release events.i will also look into QTest library and update the topic accordingly.

            actually this button struck case occurs in following scenario:
            i have a soft keyboard item which contains many keys(buttons) in it.
            if i press a button(first) with finger(touch) , and with out releasing this button, if i click on different button(second) with mouse, second button click executed successfully,but even after taking finger off the first button i pressed , first button stayed in pressed state.

            could you please suggest any approach that you think that could solve this issue?.

            thanks,
            ayyappa.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @AYYAPPA have you already brought this to the Qt Bug Tracker system ?

            Seems like something that should not happen, but seems like a fringe case as well.
            The assignee may, at the very least - have an idea on how to deal with that.


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            A 1 Reply Last reply
            0
            • sierdzioS sierdzio

              Whoa, that's an unusual use case. I have no idea how to help here, sorry. It sounds a bit like a bug in Qt (so perhaps report it?) and a bit like a corner case that might be intentionally left unimplemented.

              Perhaps MultiPointTouchArea could help? https://doc.qt.io/qt-5/qml-qtquick-multipointtoucharea.html It's a total guess, though.

              A Offline
              A Offline
              AYYAPPA
              wrote on last edited by
              #6

              @sierdzio
              hi,

              i tried using multitouchpointarea in place of mousearea, and used mouseEnabled= true, it worked.This issue is not happening anymore. it treats both touch and mouse independently and it is an acceptable result for our product. thank you very much for your suggestion.

              MultiPointTouchArea {
              anchors.fill: parent
              maximumTouchPoints: 1
              mouseEnabled: true
              onpressed
              { //do something...}
              onreleased
              {//do something....}
              }

              It would have been better if this was handled by Qt itself, as i had some other functionalities i was making use from mouse area like DoubleClicked, hovered(entered, exited) which are not avaliable in multitouchpont area. I will investigate how to use both multitouchpointarea and mousearea together. but for now i am glad that the major issue is resolved.

              1 Reply Last reply
              2
              • J.HilkJ J.Hilk

                @AYYAPPA have you already brought this to the Qt Bug Tracker system ?

                Seems like something that should not happen, but seems like a fringe case as well.
                The assignee may, at the very least - have an idea on how to deal with that.

                A Offline
                A Offline
                AYYAPPA
                wrote on last edited by
                #7

                @J.Hilk i haven't raised a bug in Qt Bug Tracker system yet, i will do that as per your suggestion.thank you.

                J.HilkJ 1 Reply Last reply
                0
                • A AYYAPPA

                  @J.Hilk i haven't raised a bug in Qt Bug Tracker system yet, i will do that as per your suggestion.thank you.

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  @AYYAPPA
                  great make sure to link the case so others can check/find the bug report as well


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    AYYAPPA
                    wrote on last edited by
                    #9

                    i have raised a bug for this in Qt bug reporting system,
                    https://bugreports.qt.io/browse/QTBUG-75196

                    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