Doug Broadwell
11th October 2006, 02:13
I have created a Main Window app in Designer and run qmake to get the ui_n1.h file created. I have subclassed my Main Window object to place my functionality in it. My n1.h file is:
class MainWindow : public QMainWindow, public Ui::MainWindow {
Q_OBJECT
public:
MainWindow();
};
My MainWindow.cpp file is:
#include <QtGui>
#include "n1.h"
MainWindow::MainWindow() : QMainWindow() {
setupUi(this);
}
My main.cpp is:
#include <QApplication>
#include "n1.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MainWindow *mainwindow = new MainWindow;
mainwindow->show();
return app.exec();
}
Does this seem right? When I run it nothing happens (or it opens and immediatly closes??).
Thanks
Update! Added code tags.
class MainWindow : public QMainWindow, public Ui::MainWindow {
Q_OBJECT
public:
MainWindow();
};
My MainWindow.cpp file is:
#include <QtGui>
#include "n1.h"
MainWindow::MainWindow() : QMainWindow() {
setupUi(this);
}
My main.cpp is:
#include <QApplication>
#include "n1.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MainWindow *mainwindow = new MainWindow;
mainwindow->show();
return app.exec();
}
Does this seem right? When I run it nothing happens (or it opens and immediatly closes??).
Thanks
Update! Added code tags.