How to disable ListView or ListItem clicks in QML?

asked 2016-06-17 15:22:38 +0200

Fiery gravatar image

updated 2018-12-03 21:33:27 +0200

Tanghus gravatar image

I have a few SilicaListViews in my QML app with a bunch of ListItems each. I'd like to completely disable user clicks on one ListView, and only enable clicks for a few ListItems of another ListView. How to do that properly in QML? I've tried to use MouseArea, but I suppose I don't use it the right way. I can disable the ListItem highlighting (when clicked) and enable clicks, or enable highlighting and disable clicks -- both are the wrong combination :-) I'd like to disable both clicks and highlighting on user's touch event; and also enable touch event with ListItem highlighting effect, to indicate which ListItem the user clicked on.

edit retag flag offensive close delete


Hey, I see that you have many questions about developing Sailfish OS apps. That's great, and there is a better place for all those questions, the Sailfish devel ML:

Otherwise, I suppose you have tested enabled: false on Items?

Sthocs ( 2016-06-17 15:48:00 +0200 )edit

Thank you, I will switch to the devel ML. And your tip on "enabled: false" was spot on, thanks a lot! I never imagined it was this easy. I was foolishly tweaking MouseAreas embedded in ListItems :)

Fiery ( 2016-06-17 17:04:09 +0200 )edit