Access Q_PROPERTY from ListModel
Unsolved
General and Desktop
-
Hi,
I'm struggling with accessing a Q_PROPERTY within a ListElement in a ListModel from QML:
model: ListModel { id:modelApps ListElement { itemTitle: qsTr("TEAM") itemSource: "qrc:/pages/Team.qml" itemImage: "qrc:/images/Icons/team.png" itemCount: _mainViewModel.rowCount } }
I always get following error message: ListElement: cannot use script for property value
Is there a proper way to achieve my intend?
Best regards,
wowalive -
@Wowalive said in Access Q_PROPERTY from ListModel:
Is there a proper way to achieve my intend?
Yes: don't use ListElements. Use other model types (like QObjectList model, or a full QAbstractItemModel) - more info in ther docs: https://doc.qt.io/qt-5/qtquick-modelviewsdata-modelview.html#models