[Interest] How to handle click events in Flickable as well as MouseArea the same time (QML)

Daniel Kreuter daniel.kreuter85 at googlemail.com
Tue Jul 3 13:38:47 CEST 2012

Awesome, just what I wanted.

Thanks a lot for your help.

On Tue, Jul 3, 2012 at 1:34 PM, Roopesh Chander <roop at forwardbias.in> wrote:
> I've spent quite some time fighting with this problem. :)
> The trick, as I found out, is to have the MouseArea as a child of the
> Flickable (as opposed to a MouseArea with a higher z value). If we do
> that, then when the Flickable thinks that it has a flick, it can
> "steal" the mouse events for itself and doesn't deliver it at all to
> the MouseArea. If it thinks it's not a flick, it passes on the event
> to it's children. (This is how ListItems getting clicked works.)
> This is also mentioned in the docs, though somewhat hidden:
> http://qt-project.org/doc/qt-4.8/qml-flickable.html#pressDelay-prop
> http://qt-project.org/doc/qt-4.8/qml-mousearea.html#preventStealing-prop
> roop.
> On Tue, Jul 3, 2012 at 2:11 PM, Daniel Kreuter
> <daniel.kreuter85 at googlemail.com> wrote:
>> Hello,
>> I have a small pdf viewer in qml which enables scrolling using the
>> Flickable component. Now I want the navigation controls to switch
>> between the pages to switch it's opacity to 0 after a few seconds so
>> they won't be in the readers way. The only way to get them back
>> visible would be to have a MouseArea which will set opacity back to 1
>> and restart it's animation for fade out. Mouse hover will not work
>> because this viewer will only be used via touch events.
>> Now the problem is, that when I define the MouseArea which lays over
>> the Flickable catches each clicked() signal, so I won't be able to
>> scroll anymore. So how can I reemit the signal clicked to be caught by
>> the Flickable as well? Is this possible?
>> --
>> Mit freundlichen Grüßen
>> Greetings
>> Daniel Kreuter
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest

Mit freundlichen Grüßen


Daniel Kreuter

More information about the Interest mailing list