OK guys , I got it!!!!
here it is:
mydialog.h
#include <qapplication.h>
#include <qdialog.h>
#include <qmessagebox.h>
#include "ui_MyDialog.h" //This is the header generated by uic Mydialog.ui > ui_MyDialog.h
{
Q_OBJECT
public:
private:
Ui::MyDialog ui;
private slots:
void msgbox();
};
#include <qapplication.h>
#include <qdialog.h>
#include <qmessagebox.h>
#include "ui_MyDialog.h" //This is the header generated by uic Mydialog.ui > ui_MyDialog.h
class MyDialog : public QDialog
{
Q_OBJECT
public:
MyDialog(QWidget *parent = 0);
private:
Ui::MyDialog ui;
private slots:
void msgbox();
};
To copy to clipboard, switch view to plain text mode
mydialog.cpp
#include "mydialog.h"
MyDialog
::MyDialog( QWidget *parent
){
ui.setupUi(this);
connect(ui.helloButton,SIGNAL(clicked()),this,SLOT(msgbox()));
connect(ui.pressMe,SIGNAL(clicked()),this,SLOT(accept()));
}
void MyDialog::msgbox()
{
}
#include "mydialog.h"
MyDialog::MyDialog( QWidget *parent )
{
ui.setupUi(this);
connect(ui.helloButton,SIGNAL(clicked()),this,SLOT(msgbox()));
connect(ui.pressMe,SIGNAL(clicked()),this,SLOT(accept()));
}
void MyDialog::msgbox()
{
QMessageBox::information(0, "test","message");
}
To copy to clipboard, switch view to plain text mode
main.cpp
#include <qapplication.h>
#include <qdialog.h>
#include <qmessagebox.h>
#include "mydialog.h"
int main(int argc, char **argv)
{
MyDialog *window=new MyDialog;
window->show();
return app.exec();
}
#include <qapplication.h>
#include <qdialog.h>
#include <qmessagebox.h>
#include "mydialog.h"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
MyDialog *window=new MyDialog;
window->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
I still get an error concerning 'undefined reference to vtable for MyDialog' if I build inside Code::Blocks.
If I use:
qmake
mingw32-make
It works (finally!!!)
Bookmarks