MADDE/Qt example

m (1 revision)
(Undo revision 45956 by 200.251.58.190 (Talk) vandalism)
 
(7 intermediate revisions not shown)
Line 1: Line 1:
-
<div style="border: 1px solid red; background-color: #faa; padding: 20px;"><div style="text-align:center;">'''TECHNOLOGY PREVIEW'''</div></div>
+
{{MADDE}}
=== Introduction ===
=== 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 [[MADDE/Configuration | guide]]. If you want to run the example on the device, please install the Qt Gui library. This example will show how to:
+
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 [[MADDE/Configuration | 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  
* start a project in MADDE  
Line 22: Line 22:
  empty            prog    Empty project
  empty            prog    Empty project
  lib_simple      lib      Simple example for C/C++ libraries
  lib_simple      lib      Simple example for C/C++ libraries
-
  qt_lib_simple    qtlib    Simple example for QT libraries
+
  qt_lib_simple    qtlib    Simple example for Qt libraries
-
  qt_simple        qtprog  Simple example for QT programs
+
  qt_simple        qtprog  Simple example for Qt programs
  simple          prog    Simple example for C/C++ programs
  simple          prog    Simple example for C/C++ programs
-
 
-
 
=== Start the project ===
=== 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"
+
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
  mad pscreate -t qt_simple qthello
Line 66: Line 64:
1. Create the Makefile:
1. Create the Makefile:
 +
cd qthello
  mad qmake
  mad qmake
Line 79: Line 78:
: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 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.
 +
 +
[[Category:Development]]
 +
[[Category:Qt]]

Latest revision as of 23:11, 10 December 2011

Image:Ambox_notice.png
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.