QListWidget MultiSelection always does multiple selections
Asked Answered
Y

1

5

I'm using a QListWidget and enabled multiple selections:

mReferenceList->setSelectionMode(QAbstractItemView::MultiSelection);

The problem is, that this mode doesn't behave as is expected as standard on Windows. Normally a listbox with mulötiple selections works in such a way that you click on item, click another and the previous one is unselected. Only when you use SHIFT+LButton or CTRL+LButton are multiple items selected.

Currently the listbox now selects one item after the other, when I click on several items. Is there some setting that enables this beahviour?

I'm using Qt 5.2 with MingW.

Yammer answered 3/7, 2014 at 10:5 Comment(2)
I think the QAbstractItemView::ExtendedSelection is what you expect.Lingcod
@vahancho, perfect, that was it. If you post it as an answer I would accept it.Yammer
L
11

According to the QAbstractItemView::MultiSelection mode description:

...the selection status of that item is toggled and the other items are left alone.

I think the QAbstractItemView::ExtendedSelection mode is what you expect, because for it "...the selection is cleared and the new item selected".

Lingcod answered 3/7, 2014 at 10:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.