Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top