I then created this header file:
Expand|Select|Wrap|Line Numbers
- // myqtapp.h:
- #ifndef MYQTAPP_H
- #define MYQTAPP_H
- #include "ui_myqtapp.h"
- class myQtApp : public QWidget, private Ui::frmMain
- {
- Q_OBJECT
- public:
- myQtApp(QWidget* parent = 0);
- public slots:
- void getPath();
- void doSomething();
- void clear();
- void about();
- };
- #endif
Expand|Select|Wrap|Line Numbers
- // myqtapp.cpp:
- #include <QtGui>
- // if we include <QtGui> there is no need to include every class used: <QString>, <QFileDialog>,...
- #include "myqtapp.h"
- myQtApp::myQtApp( QWidget* parent )
- {
- setupUi(this); // Set up the GUI
- // signals / slots mechanisms in action -> link a action in the GUI to a subroutine in this class
- connect( btn_Browse, SIGNAL(clicked()), this, SLOT(getPath()) );
- connect(btn_DoSomething,SIGNAL(clicked()), this, SLOT(doSomething()) );
- connect( btn_Clear, SIGNAL(clicked()), this, SLOT(clear()) );
- connect( btn_About, SIGNAL(clicked()), this, SLOT(about()) );
- }
Expand|Select|Wrap|Line Numbers
- // main.cpp:
- #include <QApplication>
- #include "myqtapp.h"
- int main(int argc, char* argv[])
- {
- QApplication app(argc, argv);
- myQtApp* dialog = new myQtApp;
- dialog->show();
- return app.exec();
- }
Expand|Select|Wrap|Line Numbers
- /home/jBrandt/Code/qt/myqtapp.cpp|5|undefined reference to `vtable for myQtApp'|