PDA

View Full Version : QCombox with multiple items (or similar widget)



Nunkij
20th June 2021, 13:59
Hi,
is it possible for a QCombobox to show multiple items that can be selected? Or do I have to use another widget? In this case what is this windget?
I need to use an input widget like the one in the image that come from a Java application.
Thank you

13655

d_stranz
20th June 2021, 16:39
The screen shot you show is not a "combo box", it is a list. A combo box is a single line edit that has a drop down list of choices from which you can select a single item.

You want a QListWidget or QListView (depending on whether you let the list use its own internal item model (widget) or you provide an external item model for the source of choices (view).

If you want to allow the user to select multiple items, then you have to set the QAbstractItemModel::SelectionMode to the desired selection behavior.

Nunkij
23rd June 2021, 00:23
Thank you, I wasn't sure that it is a combobox! I will try with a QlistWidget soon :)