Reputation: 2407
I was trying to figure out how this code will loke like in plain C++ without any dependency so I was using the moc
compiler but apparently I'm wrong.
moc always returns
main.cpp:0: Note: No relevant classes found. No output generated.
the code is
#include <QApplication> #include <QWidget> #include <QPushButton> class MyButton : public QWidget { public: MyButton(QWidget *parent = 0); }; MyButton::MyButton(QWidget *parent) : QWidget(parent) { QPushButton *quit = new QPushButton("Quit", this); quit->setGeometry(50, 40, 75, 30); connect(quit, SIGNAL(clicked()), qApp, SLOT(quit())); } int main(int argc, char *argv[]) { QApplication app(argc, argv); MyButton window; window.resize(250, 150); window.move(300, 300); window.setWindowTitle("button"); window.show(); return app.exec(); }
In general terms I'm interested in creating my own signal slot system using only the C++ standard library ( no boost signal, no QT, no nothing else ) so I'm doing this for research purpose and I'm only interested on the infrastructure about signals and slots.
Thanks.
Upvotes: 4
Views: 1759