Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QListWidget MultiSelection always does multiple selections

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.

like image 267
Devolus Avatar asked Jul 03 '14 10:07

Devolus


1 Answers

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

like image 159
vahancho Avatar answered Nov 17 '22 08:11

vahancho