Reputation: 29966
I would like to make a list of checkboxes for my programm, so that the users are be able to check/uncheck a number of different flags. However, I would like to make it behave like a QComboBox: to be folded most of the time, but to open itself when clicked.
What is the best way to add such functionality (e.g. derive a custom class from QComboBox, or do something with a QListView)? Thank you.
Upvotes: 1
Views: 209
Reputation: 4909
There is a solution for it on the Qt forum:
http://qt-project.org/forums/viewthread/7740
It recommends the usage of a custom model/view, based on the tutorial 2_formatting
in the examples folder.
Upvotes: 1
Reputation: 11648
Create your own QWidget
that has a QCheckBox
and the QComboBox
.
Make signals and slot connections between the checkbox and the combobox.
Add your custom widget to the QListWidget
using QListWidget::setItemWidget..
Using this you can add custom widgets to your QListWidget.
Hope that helps.
Upvotes: 1