Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Adding sound feedback to touchscreen

Adding sound feedback to touchscreen

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 703 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.
  • B Offline
    B Offline
    bitbang
    wrote on last edited by
    #1

    My goal is nothing fancy, just getting screen "clicks" at every screen touch.
    I naively reimplemented and installed a QObject::eventFilter() playing a QSoundEffect whenever receiving a QEvent::MouseButtonPress, just to find that from a single touch I can get multiple press events.

    I suppose this is unavoidable because Qt can propagate unaccepted events to ancestors, according to https://doc.qt.io/qt-5/qevent.html

    So far my workaround is to reject repetead events closer than 300 mS, it works OK but I'm wondering what the most appropriate solution is.

    raven-worxR 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      What kind of touch screen is it ?
      Most i have seen have a tool to enable a beep sound on touch.

      B 1 Reply Last reply
      0
      • B bitbang

        My goal is nothing fancy, just getting screen "clicks" at every screen touch.
        I naively reimplemented and installed a QObject::eventFilter() playing a QSoundEffect whenever receiving a QEvent::MouseButtonPress, just to find that from a single touch I can get multiple press events.

        I suppose this is unavoidable because Qt can propagate unaccepted events to ancestors, according to https://doc.qt.io/qt-5/qevent.html

        So far my workaround is to reject repetead events closer than 300 mS, it works OK but I'm wondering what the most appropriate solution is.

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        @bitbang said in Adding sound feedback to touchscreen:

        I suppose this is unavoidable because Qt can propagate unaccepted events to ancestors, according to https://doc.qt.io/qt-5/qevent.html

        save the pointer value in a lastEvent variable and only trigger the soundeffect if the pointer value is different

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        B 1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          What kind of touch screen is it ?
          Most i have seen have a tool to enable a beep sound on touch.

          B Offline
          B Offline
          bitbang
          wrote on last edited by
          #4

          @mrjj Don't know the make, it is a resistive panel and works in conjunction with - I think - TsLib. As far as I can see, it generates the same events of a mouse.

          B 1 Reply Last reply
          0
          • B bitbang

            @mrjj Don't know the make, it is a resistive panel and works in conjunction with - I think - TsLib. As far as I can see, it generates the same events of a mouse.

            B Offline
            B Offline
            bitbang
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • raven-worxR raven-worx

              @bitbang said in Adding sound feedback to touchscreen:

              I suppose this is unavoidable because Qt can propagate unaccepted events to ancestors, according to https://doc.qt.io/qt-5/qevent.html

              save the pointer value in a lastEvent variable and only trigger the soundeffect if the pointer value is different

              B Offline
              B Offline
              bitbang
              wrote on last edited by
              #6

              @raven-worx Nice idea, I didn't think of storing event address! Though generally speaking I'm reluctant relying on pointers values for identity testing, except when the documentation explicitly guarantees objects are not copied.

              raven-worxR 1 Reply Last reply
              0
              • B bitbang

                @raven-worx Nice idea, I didn't think of storing event address! Though generally speaking I'm reluctant relying on pointers values for identity testing, except when the documentation explicitly guarantees objects are not copied.

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #7

                @bitbang
                i wont say that this generally true for all concepts.
                It is the case for events, since the same event is just passed on to the next item/widget.

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                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