Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

How to pass QModelIndex from QML to C++

$
0
0
Hello, I have an C++ based application which exposed QAbstractmodel to QML file as data model.I want to get the Qmodelindex from list view. so that why i set c++ model as visualdata model & visual data model as listmodel as following ListView     {         id: listView         anchors.fill: parent         model:VisualDataModel         {             model: cppModel //cppModel is model exposed from c++ file             delegate: petDelegate         }              } after that i want to get model index & pass it to c++. for that i write code as.. mainView.somesignal(listView.model.modelIndex(index)) but when i print modelindex’s value it print as: QVariant(QModelIndex) So How can get the value of model index in QML?? Edit: please wrap your code snippets with @ tags; Andre

Viewing all articles
Browse latest Browse all 4972

Trending Articles