Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Inheritance in Qt
eldayantec last edited by
This is what I'm trying to do: the class A inherits from B. This the code:
@// class B.h
// class B.cpp
class A : public B
explicit A(QObject *parent = 0);
A::A(QObject *parent) : B(parent)@
This doesn't work. Please help me!
Since B is not a QObject, and does not have a constructor that accepts QObject argument (see the last line of your code snippet), it will not work. You can just skip the B(parent) call and it should be ok.
Also, don't use the Q_OBJECT macro if your class doesn't inherit QObject.