where to #including QtObjects ? (Forward declaration)
Solved
General and Desktop
-
Hi !!..
I saw that could not possible to use forward declaration the way:
//MyHeader.h class X{ class QPushButton * getMyButton(); }; //Source #include "MyHeader.h" #include <QPushButton> QPushButton * X::getMyButton(){ return new QPushButton; }
It gives me the error "Return type of out-of-line definition of X::getMyButton() differs from that in the declaration"
If I remove the "class" word and include the QPushButton directly on header, the problem goes away.... So this points me to a question...
Do I´m forced to #include all my QtObjects inside the header file ?... or is there any way that I can do forward declaration in Qt ?..Thanks so much...
-
Hi
When use pointers to widgets, you can forward likeclass QPushButton ; // forward //MyHeader.h class X{ QPushButton * getMyButton(); };
-
Good, thanks friend...