MouseArea and underlying elements: events



  • Hi,

    I am trying to create a "page" with the following properties:

    The page can have any kind of controls, buttons, text fields, sliders etc.

    But on a long press anywhere on it, I should be able to react and do something that is unique to the page.

    I am trying to get it to work with a MouseArea covering the whole page, then settings the mouse.accepted to false for onClicked and handing only onPressedAndHold, but that does not work.

    After experimenting, I have realized that the only way to get the underlying controls to work, is to set mouse.accepted to false for onPressed.

    The problem then is that onPressedAndHold will never be called.

    I thought about starting a timer onPressed that would trigger after 800ms (the time for a long press) and get cancelled if released happened anywhere else, but the problem is that once you "accepted = false" onPressed, then onRelease is automatically ignored as well.

    As I want to create a generic solution without having to individually set each and every "onSomething" from the "base controls" under the MouseArea, having them call a function to let the Timer know "this was handled" is really not an option.

    Any ideas there?

    Thank you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.