5
votes

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.

1
I think the QAbstractItemView::ExtendedSelection is what you expect.vahancho
@vahancho, perfect, that was it. If you post it as an answer I would accept it.Devolus

1 Answers

9
votes

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".