QML Combobox with QStringListModel
I have a QStringListModel which is configured using the setStringList method.
I'm trying to use this model in QML Combobox. And I have exposed this model to qml using setContextProperty but I can't find the role name to be used in QML
I can't find a way to do so.
Please suggest.
Re: QML Combobox with QStringListModel
"display", the name for Qt::DisplayRole
See QAbstractItemModel::roleNames() for the default mapping.
Cheers,
_
Re: QML Combobox with QStringListModel
Thanks for the suggestion anda_skoa
Is there any way to disable selection in the combobox? I want to use the combobox to show the first item and not allow click on the item at index 1 or index 2
Re: QML Combobox with QStringListModel
Not sure. You could try adding a MouseArea to those items and letting it take the events.
Cheers,
_