On Fri, Mar 07, 2008 at 09:56:44PM +0100, Stefan Schimanski wrote: >>> Don't whether QComboBox supports tree models. >> >> It does. You can plug in any QAbstractItemModel. > > And then it makes what out of it? A QTreeView popup? A chained popup menu?
Well, whatever view you put in. #include <QtCore/QtCore> #include <QtGui/QtGui> int main(int argc, char *argv[]) { QApplication app(argc, argv); QStandardItemModel m; QStandardItem * itA = new QStandardItem("A"); itA->appendRow(new QStandardItem("A1")); itA->appendRow(new QStandardItem("A2")); QStandardItem * itB = new QStandardItem("B"); itB->appendRow(new QStandardItem("B1")); itB->appendRow(new QStandardItem("B2")); m.invisibleRootItem()->appendRow(itA); m.invisibleRootItem()->appendRow(itB); QTreeView t; t.header()->hide(); QComboBox w; w.setModel(&m); w.setView(&t); w.setMinimumContentsLength(10); w.show(); t.expandAll(); return app.exec(); } Some signal handling is needed to make it work properly, but this should get you started if you want something like that. Andre'