QComboBox & QAbstractItemModel - editable/filtering
-
Hey
What function do I have to implement in my abstract model to allow for filtering to work when I plug the model inside combo box? I'm trying to select item/filter while typing - have auto complete...
I've set
combo->setView(new QTreeView())
as well ascombo->setView(new myTree())
neither seem to affect it so it must be model related?TIA
Edit I actually even struggle to get text display in the comboBox line edit from model items... hmmm what do I need to link it properly?
Did more digging, still no luck, none of signals/slots in QComboWidget return a QModelIndex, thus if I click on item inside another item(child) then I get wrong index. As the index is relevant to rootItem not parentItem... oh dear...
Trying to get a signal from treeView directly seem to not work either?
connect(mCombo_scene->view(), &QAbstractItemView::activated, [=](const QModelIndex &index) { qDebug() << "EH? " <<"I got correct Index?"; //mCombo_scene->setCurrentText(index.data(Qt::DisplayRole).toString()); });
-
Hi,
This Wiki entry gives a good starting point.