MADDE/Qt example

TECHNOLOGY PREVIEW

Introduction
This example requires a working configuration of MADDE. At least one target has to be installed and set as 'default'. The basic steps to do this are described in this guide. If you want to run the example on the device, please install the Qt Gui library. This example will show how to:


 * start a project in MADDE
 * use template-projects for developing
 * compile a project in MADDE
 * build a package

Templates
Templates are used in MADDE to simplify the set up of the basic skeleton for a project. The following command shows the list of available templates:

mad pscreate -l


 * The command gives following output:

TEMPLATE NAME   TYPE     DESCRIPTION empty           prog     Empty project lib_simple      lib      Simple example for C/C++ libraries qt_lib_simple   qtlib    Simple example for QT libraries qt_simple       qtprog   Simple example for QT programs simple          prog     Simple example for C/C++ programs

Start the project
The goal of this example is to create a simple Qt application. Therefore we can use the "qt_simple" template out of the list. The following command creates a project using the "qt_simple" template and named as "qthello"

mad pscreate -t qt_simple qthello

Afterwards the skeleton is created with the following subdirectories:


 * src:qtmain.cpp - a simple hello world in Qt
 * debian:configuration files, which are needed to create the package later on
 * uis:empty folder for ui files, which are created with Qt Designer.

Further it contains a file named "qtprog.pro", which is a project file, needed to create the Makefile with qmake.

/* * Created: 05/25/09-15:51:27 * Author: username */ int main(int argc, char *argv[]) {       QApplication app(argc, argv); QPushButton hello("Hello world!"); hello.show; return app.exec; }
 * 1) include 
 * 2) include 

Compile & build
The following steps describe how to compile and build the project.

1. Create the Makefile:

mad qmake

2. Compile the project.

mad make


 * Now the executable program qthello is created in the qthello/build directory.

3. Create a debian package:

mad dpkg-buildpackage


 * This command will build the project and make a debian package called qthello_0.1_armel.deb. The debian package will be created in the projects' parent directory.