I have a simple need : I have defined a C++ class
class MyClass: public QDeclarativeItem
{
Q_OBJECT
public:
MyClass(QDeclarativeItem * parent=0);
...
private:
QList<QString> mList
}
And of course, I've registered it : qmlRegisterType<MyClass>(...)
I want to access in the QML code to my QList<QString> mList
. How can I do it?
It annoys me as it looks like a simple problem, but I can't find anything about this. (I can create a Q_INVOKABLE slot, but I can't read the results, etc...)
Edit : QML supported Data Types
I don't think that QList
is a supported data type for Qt's QML binding. I've had similar problems interfacing between C++ and JavaScript using the QtWebkit Bridge.
If possible, try using a QVariantList
instead of a QList
. Although this is technically a typedef for QList<QVariant>
I think it should work.