Morea
24th February 2006, 07:54
Hi.
As I understand it, I need Q_OBJECT macro if I declare a class that should use signals and slots, and it should then also be derived from QObject?
Like
class Foo:public QObject{
Q_OBJECT
// etc.
}
But if I derive from a class that already is derived from a QObject, like
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget * parent = 0);
private:
Ui::MainWindow ui;
};
Is Q_OBJECT really needed here? I mean, there is nothing that uses signals/slots, the MainWindow constructor contains no signals emits or connects.
I mean, the QMainWindow class is derived from QObject, doesn't it get the Q_OBJECT for that part?
As I understand it, I need Q_OBJECT macro if I declare a class that should use signals and slots, and it should then also be derived from QObject?
Like
class Foo:public QObject{
Q_OBJECT
// etc.
}
But if I derive from a class that already is derived from a QObject, like
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget * parent = 0);
private:
Ui::MainWindow ui;
};
Is Q_OBJECT really needed here? I mean, there is nothing that uses signals/slots, the MainWindow constructor contains no signals emits or connects.
I mean, the QMainWindow class is derived from QObject, doesn't it get the Q_OBJECT for that part?