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
Q_OBJECT
// etc.
}
class Foo:public QObject{
Q_OBJECT
// etc.
}
To copy to clipboard, switch view to plain text mode
But if I derive from a class that already is derived from a QObject, like
{
Q_OBJECT
public:
private:
Ui::MainWindow ui;
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget * parent = 0);
private:
Ui::MainWindow ui;
};
To copy to clipboard, switch view to plain text mode
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?
Bookmarks