Unsolved Adding sound feedback to touchscreen
-
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.
-
Hi
What kind of touch screen is it ?
Most i have seen have a tool to enable a beep sound on touch. -
@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
-
@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.
-
This post is deleted! -
@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.
-
@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.