All the examples I’ve found online say to do what I’ve done in the following example, however I get an error.
QQmlListProperty<QString> ReadXML::listElements()
{
QList<QString> eleList;
eleList.append("one");
eleList.append("two");
eleList.append("three");
return QQmlListProperty<QString>(this, eleList);
}
readxml.cpp:14: error: C2665: 'QQmlListProperty<QString>::QQmlListProperty' : none of the 5 overloads could convert all the argument types
d:\qt\qt5.3.2\5.3\msvc2013_opengl\include\qtqml\qqmllist.h(67): could be 'QQmlListProperty<QString>::QQmlListProperty(QObject *,QList<T *> &)'
with
[
T=QString
]
while trying to match the argument list '(ReadXML *const , QList<QString>)'
Due to the lack of information given by the compiler I don’t know how to troubleshoot it. It sounds as if it is telling me to do this:
return QQmlListProperty<QString>(this, eleList<QString>);
But that just results in it complaining:
readxml.cpp:14: error: C2275: 'QString' : illegal use of this type as an expression
I would appreciate any help.
↧