2) design a GUI using Qt4 Designer, and save it as .ui file (user interface file), I'll call mine hsle.ui
3) in the same directory create main.cpp (change the hsle string inside main.cpp if you are using a different name):
- Code: Select all
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include <QWidget>
#include "hsle.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow w;
Ui_hsleMainWindow hsle;
hsle.setupUi(&w);
w.show();
return app.exec();
}
note that the name of the directory that contains your sources is important since it will become the name of your project (see the output of qmake-qt4 -project used next). my directory is also called hsle.
4) run the following to compile your project:
- Code: Select all
uic-qt4 hsle.ui -o hsle.h
qmake-qt4 -project
qmake-qt4
make
Here is the compilation output I got:
- Code: Select all
uic-qt4 hsle.ui -o hsle.h
qmake-qt4 -project
qmake-qt4
make
/usr/lib/qt4/bin/uic hsle.ui -o ui_hsle.h
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -I. -I. -o main.o main.cpp
g++ -o hsle main.o -lQtGui -lQtCore -lpthread
And here is the GUI produced when I run ./hsle
