Unsolved Populate QStandardItemModel item to QML
-
Hello. As a forword, everybody uses Qt models with QML objects that provide "model" property (like ListView, TableView etc.) that then delegates model item to QML objects through
QQmlDMAbstractItemModelData
.
But what if I need only one item of my model in particular QML Object?
Of course I was able to register my model to use it in QML withqmlRegisterType
. Created an invokable methodgetIndex(int row, int col, QModelIndex index = QModelIndex())
and got a model index of an item inside QML. Last thing that left was to useitemFromIndex(const QModelIndex &)
to get a pointer to the model item and probably the ability to use it similar as the delegate but instead the result in QML isQVariant(QStandardItem*)