If I have class A that implements an interface (and uses Q_INTERFACES macro), then does child class B : public A also need to use the Q_INTERFACES macro?
For example:
IMovable.h
#include <QObject>
class IMovable
{
public slots:
virtual void moveLeft(int distance) = 0;
virtual void moveRight(int distance) = 0;
virtual void moveUp(int distance) = 0;
virtual void moveDown(int distance) = 0;
signals:
virtual void moved(int x, int y) = 0;
};
Q_DECLARE_INTERFACE(IMovable, "my_IMovable")
A.h
#include <QObject>
#include "IMovable.h"
class A : public QObject, public IMovable
{
Q_OBJECT
Q_INTERFACES(IMovable)
public:
explicit A(QObject *parent = nullptr);
virtual ~A();
public slots:
//implement IMovable public slots
void moveLeft(int distance) override;
void moveRight(int distance) override;
void moveUp(int distance) override;
void moveDown(int distance) override;
signals:
//implement IMovable signals
void moved(int x, int y) override;
};
B.h
#include "A.h"
class B : public A
{
Q_OBJECT
// Do I need Q_INTERFACES(IMovable) here?
...
};