Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Gui Advice/Opinion many check boxes
GrahamL last edited by
As part of my application the user needs to be able to select from a set of up to 64 options.
Any combination is allowed and I need a method of selecting/de-selecting all of the options. As a starting point I am showing (up to) 64 check boxes but by default these are 'ticked' which does not look particularly pleasing.
Has anyone got any ideas on how best to implement this?
If the list is not fixed, or if you feel like it, you can implement your settings as a QListView/ QListWidget. Items in that view can be checked (you need to set QListWidgetItem::setChecked() for the checkbox to appear) and are easy to iterate through (since you have a list of items, it's quite easy to loop through it and select/ deselect them).
Other option is to create a standard UI layout with QCheckBoxes. You can also keep them in a QList<QCheckBox *> for convenience (should make selection/ deselection easier), or use QWidget::findChildren<QCheckBox *>().