Problem defining a QML type having a property being another QML type
Solved
QML and Qt Quick
-
I would like to create a plugin that publish 2 QML types : TypeA and TypeB.
I have created 2 QObject base class for TypeA and TypeB. The creation of the classes and plugin is running well but now I need that TypeB could have TypeA as a property (actually, TypeB is a QAbstractItemListModel base class and I would like to fill the model using methods of TypeA).What I have done so far...
C++ side :class TypeA : public QObject { Q_OBJECT ... } class TypeB : public QAbstractListModel { Q_OBJECT Q_PROPERTY( TypeA* client READ getClient WRITE setClient NOTIFY clientChanged) public: TypeA* getClient() { return client; } void setClient(TypeA * _client){ if (be) client = _client; } signals: void clientChanged(); ... private: TypeA* client = nullptr; }
and now from the QML side :
TypeA{ id:myTypeA } TypeB{ client:myTypeA }
This is not working : setClient is never called.
note : I have defined others properties in TypeA and TypeB (QString, bool..) which are working ok - and I haven't found warning raised by the moc compiler.
Do you know what I am doing wrong ?