I'm currently looking for a way to implement touch sounds for a Qt5 Quick Controls 2 app, comparable to touch sounds that are natively available on Android. However, so far I couldn't find a way to implement them reliably. The touch sounds should only occur when, e.g. a button was pressed but not when the user taps on random parts of the screen.
My first attempt was to scan the QML Object tree and connect to all clicked()
signals in C++. This worked partially, but since I'm dynamically loading QML Code using a QML Loader Component I wasn't able to keep this synchronized even when I installed a filter for ChildAdded events on all objects in the tree. I also didn't catch all (sub) components with this approach because, e.g. the internally used QQuickSpinButton does not emit clicked()
signals.
Has anybody ideas for alternative solutions?