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();
};
class MainWindow : public QMainWindow, public Ui::MainWindow {
Q_OBJECT
public:
MainWindow();
};
To copy to clipboard, switch view to plain text mode
My MainWindow.cpp file is:
#include <QtGui>
#include "n1.h"
setupUi(this);
}
#include <QtGui>
#include "n1.h"
MainWindow::MainWindow() : QMainWindow() {
setupUi(this);
}
To copy to clipboard, switch view to plain text mode
My main.cpp is:
#include <QApplication>
#include "n1.h"
int main(int argc, char *argv[]) {
MainWindow *mainwindow = new MainWindow;
mainwindow->show();
return app.exec();
}
#include <QApplication>
#include "n1.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MainWindow *mainwindow = new MainWindow;
mainwindow->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Does this seem right? When I run it nothing happens (or it opens and immediatly closes??).
Thanks
Update! Added code tags.
Bookmarks