diff --git a/src/native/QmlNet/QmlNet/qml/NetListModel.cpp b/src/native/QmlNet/QmlNet/qml/NetListModel.cpp index 41fb2d51..a3c0ee82 100644 --- a/src/native/QmlNet/QmlNet/qml/NetListModel.cpp +++ b/src/native/QmlNet/QmlNet/qml/NetListModel.cpp @@ -52,3 +52,17 @@ QHash NetListModel::roleNames() const roles[0] = "modelData"; return roles; } + +QVariant NetListModel::at(int index) +{ + QSharedPointer result = _facade->getIndexed(_reference, static_cast(index)); + if(result == nullptr) { + return QVariant(); + } + return result->toQVariant(); +} + +int NetListModel::length() +{ + return static_cast(_facade->getLength(_reference)); +} diff --git a/src/native/QmlNet/QmlNet/qml/NetListModel.h b/src/native/QmlNet/QmlNet/qml/NetListModel.h index 03ee7774..da2b5b2f 100644 --- a/src/native/QmlNet/QmlNet/qml/NetListModel.h +++ b/src/native/QmlNet/QmlNet/qml/NetListModel.h @@ -19,6 +19,9 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const; QHash roleNames() const; + Q_INVOKABLE QVariant at(int index); + Q_INVOKABLE int length(); + private: QSharedPointer _facade; QSharedPointer _reference;