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

Why model data isn't exposed as properties of the delegate object?

$
0
0
In this case I need to create in my c++ model an Q_INVOKABLE method “get” that return an instance of an element, but while the delegate doesn’t require to register the element type, it’s need for the “get” method that can’t return a QVariant like “data” and “setData” methods. Doing this, will push me to do the job twice, that is my major issue. Roles for element properties are already declared when I create my model derived from QAbstractListModel. Notice that solution you propose can’t update properties of c++ elements in a better way I actually do (setter in QML). Delegate is meant for displaying model data in view. Model is the one you should ask for data you want. For example: @ TextField { text: projectsListView.model.get(projectsListView.currentIndex).name } @

Viewing all articles
Browse latest Browse all 4972

Trending Articles