I recently wrote a a nice control that is an extension of QComboBox. The control displays items in a tree and allows you to easily select multiple items or groups of items. You can check/uncheck parents to select groups of children and the control can also run a QCompleter to quickly type and auto-complete items from the tree. The result is a lot like the standard control you see everywhere in Windows to select groups of features, e.g. in an installation wizard. There are two classes in here:
- StandardTreeComboBox, which lets you easily build a combo box with items using QStandardItemModel.
- TreeComboBox, which lets you use whatever QAbstractItemModel you want (such as a directory tree).
Attached find the code plus a screen shot.
Bookmarks