introduce FallbackTapHandler
ClosedPublic

Authored by mart on Jul 31 2019, 4:25 PM.

Details

Summary

This element is intended to be used as "click on empty areas
to dismiss" use case.
a MouseArea or a TapHandler are not enough for this, because Flickables
eat mouse events even tough no dragging would happen
this filters explicitly events of flickables to emit clicks when no drag
happened on them

Test Plan

have a listview as child of the FallbackTapHandler and delegates with
a mousearea. The handler will emit tapped only when the user taps on an empty area
of the listview, but not on tap of its delegates

Diff Detail

Repository
R296 KDeclarative
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart created this revision.Jul 31 2019, 4:25 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 31 2019, 4:25 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mart requested review of this revision.Jul 31 2019, 4:25 PM
davidedmundson requested changes to this revision.Aug 1 2019, 8:15 AM
davidedmundson added a subscriber: davidedmundson.
davidedmundson added inline comments.
src/qmlcontrols/kquickcontrolsaddons/fallbacktaphandler.cpp
72

You're clearing before doing the tap evaluation which uses this

78

I don't follow this line. Should it be < startDragDistance?

src/qmlcontrols/kquickcontrolsaddons/fallbacktaphandler.h
50

We need to update

setAcceptedMouseButtons(Qt::LeftButton);

when this changes

This revision now requires changes to proceed.Aug 1 2019, 8:15 AM
mart updated this revision to Diff 62890.Aug 1 2019, 10:22 AM
  • adress comments
mart marked 3 inline comments as done.Aug 1 2019, 10:26 AM
davidedmundson added inline comments.Aug 1 2019, 10:31 AM
src/qmlcontrols/kquickcontrolsaddons/fallbacktaphandler.cpp
51

m_buttons = buttons

or change the getter for acceptedButtons to call QQuickItem::acceptedMouseButtons

mart updated this revision to Diff 62891.Aug 1 2019, 10:35 AM
  • get completely rid of acceptedMouse§Buttons
davidedmundson accepted this revision.Aug 1 2019, 11:08 AM
This revision is now accepted and ready to land.Aug 1 2019, 11:08 AM
This revision was automatically updated to reflect the committed changes.