[Interest] Mouse un-selecting behaviour of listviews

Bo Thorsen bthorsen at ics.com
Mon Jan 20 12:52:28 CET 2014


Den 13-01-2014 13:19, Philipp Kursawe skrev:
> I somehow do not understand the unselecting behaviour of Qt. Its totally
> confusing, if not broken.
> One an item has been selected its nearly impossible to clear the
> selection to click on a free space in the listview.
>
> Easily reproducible by just creating a listwidget with 2 items in it.

It's not broken, it's just not working the way you expect it to. In most 
cases I prefer the current behaviour.

However, I have met cases where unselecting is necessary. It's not 
difficult to implement this, but you have to do it manually by catching 
mouse clicks and clear the selection when clicking the current selection 
or outside the items.

You could do a patch with a new property on QAbstractItemView that sets 
whether deselection is allowed. It would be an improvement to have this.

This description is for widgets, but QML is done in a similar way.

Bo.

-- 
Bo Thorsen, European Engineering Manager, ICS
Integrated Computer Solutions. Delivering World-Class Applications
http://ics.com/services



More information about the Interest mailing list