MADDE/Qt example
MADDE is currently a technology preview. These instructions are liable to change as development progresses. If some of the components do not work as expected, please add your question to the MADDE talk thread and follow up the discussion. tablets-dev.nokia.com is down, see MADDE#Installation for alternatives. |
Contents |
[edit] 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
[edit] 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
[edit] 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" (In Windows MADDE Terminal this template seems to be qt-simple)
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 */ #include <QApplication> #include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton hello("Hello world!"); hello.show(); return app.exec(); }
[edit] Compile & build
The following steps describe how to compile and build the project.
1. Create the Makefile:
cd qthello 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.
- This page was last modified on 10 December 2011, at 23:11.
- This page has been accessed 34,146 times.