Hello
Can someone tell me how I can select multiple items in a combobox?
Regards,
Daniel Sousa
Hello
Can someone tell me how I can select multiple items in a combobox?
Regards,
Daniel Sousa
You can't. That's whole idea of a combobox: You click the arrow, it opens, you select a new item, it closes, and the new item is displayed in the edit box. What kind of behaviour would you expect if you could select multiple items? Which one of them would you display in the edit box?Can someone tell me how I can select multiple items in a combobox?
If you think you need to select multiple items from a list, then you should be using QListWidget.
I wanted something this genre -> http://libqxt.bitbucket.org/doc/tip/...kcombobox.html
If you want the QxtCheckComboBox then use the Qxt library. Seems obvious enough.
d_stranz (29th April 2012)
Take this class QMultiComboBox
sousadaniel7 (29th April 2012)
I implemented your class and it works well but appears in the layout looks like this:comboBox.png
How do I solve this?
And how can I increase the height of comboBox?
Last edited by sousadaniel7; 2nd May 2012 at 15:16.
Set correct minimum size, re-implement and return correct sizeHint() and set resonable size policies.
You may want to look at minimumSizeHint() as well.
Is not can you tell me how do I get items that are selected?Qt Code:
To copy to clipboard, switch view to plain text mode
This code is from QMultiComboBox.h; it returns QVariant(true) if the item in "row" is checked, QVariant(false) if it isn't. You should be able to figure out how to use that method in your own code.
sousadaniel7 (2nd May 2012)
Bookmarks