@yassser said in Qt MetaType and Circular Dependency:
correct me if i'm wrong but does the copying part mean that you cant copy the properties to variant using QVariant::fromValue(QObject*) because it is working some QObject Derived classes in the Project , or you mean add the QObject subclass to the Qt Standard Types as in this exemple CustomTypes there is 3 requirement
Both. When adding a QObject * to a QVariant you copy nothing, you just transfer a reference, and if that reference disappears in the mean time, well that's cause for concern.
@yassser said in Qt MetaType and Circular Dependency:
as for declaring QList<B*> i will switch to the typedef solution as it is more safe like you said although the other one(declar_type(QList<B*>)) is working somehow
For what it's worth, declaration of metatypes should happen where the type is defined, not somewhere else. So even ideologically:
class B; Q_DECLARE_METATYPE(QList<B*>)is wrong. That metatype declaration should've gone where B is defined, aside from it being needed or not.
but the core problem i'm facing is the requirement of Q_DECLARE_METATYPE(B*) that B should be fully defined(defining the class using #include'b.h' instead of 'class B')
Still talking hypotheticals. I don't see any concrete error that one gets from the compiler, nor a specific piece of cpp code that's the cause of said error.
as i cant include the header files because it will cause circular dependency because A it self require the same process
Where does it require that and why? Please post a snippet, I'm getting rather frustrated here. Consider this in the meantime:
class B; typedef QList<B *> BList; class A { public: void setBList(const BList &); //< This doesn't require a definition of BList, and by extension a definition of B isn't required BList bList() const; //< Nor does this };