Editing Qt4 development
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
- | '''IMPORTANT: This page is for Fremantle PR 1.2 using Qt 4.6 | + | '''IMPORTANT: This page is for Fremantle PR 1.2 using Qt 4.6.''' |
'''If you want to develop for Diablo or use Qt 4.5 please have a look at the [[Qt4_Hildon_Legacy|Qt4 Hildon Legacy Page]].''' | '''If you want to develop for Diablo or use Qt 4.5 please have a look at the [[Qt4_Hildon_Legacy|Qt4 Hildon Legacy Page]].''' | ||
- | = | + | = [[Image:Intro.png]] Introduction = |
To develop with [[Qt-Maemo|Qt for Maemo]], a working SDK installation is required. There are [[Documentation/Maemo_5_Final_SDK_Installation|instructions on how to install the Maemo SDK]], and you can [http://www.youtube.com/watch?v=c8myh_iBy8k watch the Maemo SDK in action]. Alternatively, you may want to try [[MADDE]], a cross-platform Maemo development tool, available as a technology preview. | To develop with [[Qt-Maemo|Qt for Maemo]], a working SDK installation is required. There are [[Documentation/Maemo_5_Final_SDK_Installation|instructions on how to install the Maemo SDK]], and you can [http://www.youtube.com/watch?v=c8myh_iBy8k watch the Maemo SDK in action]. Alternatively, you may want to try [[MADDE]], a cross-platform Maemo development tool, available as a technology preview. | ||
- | + | = [[Image:Rocket.png]] Getting started = | |
- | + | ||
- | + | ||
To start to develop with Maemo Qt, we need to [[Documentation/Maemo_5_Final_SDK_Installation|install the Maemo SDK]]. | To start to develop with Maemo Qt, we need to [[Documentation/Maemo_5_Final_SDK_Installation|install the Maemo SDK]]. | ||
- | Qt is available in public Fremantle repository | + | Since PR 1.2 release Qt 4.6 is available in public Fremantle repository |
+ | To upgrade older scratchbox targets to use the latest packages execute the following commands: | ||
fakeroot apt-get update | fakeroot apt-get update | ||
fakeroot apt-get dist-upgrade | fakeroot apt-get dist-upgrade | ||
Line 19: | Line 18: | ||
fakeroot apt-get install libqt4-dev | fakeroot apt-get install libqt4-dev | ||
- | + | ==How to compile a Qt application in scratchbox== | |
- | + | Qt applications are usually built using QMake. Project like KDE instead replaced | |
- | + | QMake with CMake for more flexibility. | |
- | + | ||
- | Qt applications are usually built using QMake. | + | |
- | + | === QMake === | |
- | [http://doc.trolltech.com/qt-maemo-4.6/qmake-manual.html QMake] is a tool that helps simplify the build process for development project across different platforms | + | [http://doc.trolltech.com/qt-maemo-4.6/qmake-manual.html QMake] is a tool from Trolltech that helps simplify the build process for development project across different platforms |
You can build your Maemo Qt application in 3 simple steps: | You can build your Maemo Qt application in 3 simple steps: | ||
- | # Generating project file (Required if there is no .pro file into the app source tree)<pre>qmake -project</pre> | + | # Generating project file (Required if there is no .pro file into the app source tree)<br/><pre>qmake -project</pre> |
- | # Generating Makefile from the QMake project file:<pre>qmake file.pro</pre> | + | # Generating Makefile from the QMake project file:<br/><pre>qmake file.pro</pre> |
# <pre>make</pre> | # <pre>make</pre> | ||
- | + | === CMake === | |
CMake projects usually have a <code>CMakeLists.txt</code> file instead of: | CMake projects usually have a <code>CMakeLists.txt</code> file instead of: | ||
# .pro file used by QMake projects | # .pro file used by QMake projects | ||
- | # | + | # Makefile.am used by Autotools projects (standard in Unix/Linux) |
- | Using CMake to build the project is extremely easy. In the directory containing | + | Using CMake to build the project is extremely easy. In the directory containing CMakeLists.txt, supply the following two commands, where path is the path to the source code. |
cmake path | cmake path | ||
make | make | ||
- | Note: CMake is not installed by default in [[:Category:Scratchbox| | + | Note: CMake is not installed by default in [[:Category:Scratchbox|scratchbox]]. You can install it with the command: |
fakeroot apt-get install cmake | fakeroot apt-get install cmake | ||
- | + | == Running a Qt application in: == | |
- | + | === Scratchbox === | |
- | Diablo and Fremantle Qt applications can run | + | Diablo and Fremantle Qt applications can run into the device as into scratchbox. |
First step to run a Qt application is starting the SDK UI: | First step to run a Qt application is starting the SDK UI: | ||
- | # Run Xephyr | + | # Run Xephyr. It is able to run a [http://en.wikipedia.org/wiki/X_Window_System X Server] inside another X Server.<br/><pre>Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -kb</pre> |
- | # | + | # Set display for application that runs inside scratchbox:<br/><pre>export DISPLAY=:2</pre> |
- | # You can now run the SDK UI. A Diablo or Fremantle desktop will appear in your Xephyr window:<pre>af-sb-init.sh start</pre> | + | # You can now run the SDK UI. A Diablo or Fremantle desktop will appear in your Xephyr window:<br/><pre>af-sb-init.sh start</pre> |
# Now you are ready to run any Maemo or Maemo Qt application with:<pre>run-standalone.sh ./qtapps</pre> | # Now you are ready to run any Maemo or Maemo Qt application with:<pre>run-standalone.sh ./qtapps</pre> | ||
- | Note: | + | Note: run-standalone.sh sets some variable needed by Qt to use the Hildon style. |
- | + | === Device === | |
+ | Maemo Qt applications are Linux binaries. They can run on the device without any problem if you copy them to "partitions" mounted with exec flag. (for example, /home/user or /opt in Fremantle). | ||
- | + | Fore example, if we want to run quassel (Qt IRC Client) we have to launch it with: | |
- | + | ||
- | + | ||
- | + | ||
su -c ./quassel user | su -c ./quassel user | ||
- | = | + | = [[Image:Hammer.png]] Porting Qt applications to Maemo = |
Porting a Qt desktop application to Maemo requires very little effort. This is because the Maemo Qt libraries will take care of giving the Hildon look & Feel and enabling the virtual input methods for your application. | Porting a Qt desktop application to Maemo requires very little effort. This is because the Maemo Qt libraries will take care of giving the Hildon look & Feel and enabling the virtual input methods for your application. | ||
- | + | ==Overriding the Qt Maemo changes== | |
- | + | ||
- | + | ||
+ | ===Maemo Style=== | ||
Hildon Style is the default Qt application style. Other style available are: | Hildon Style is the default Qt application style. Other style available are: | ||
- | * [http://doc.trolltech.com/ | + | * [http://doc.trolltech.com/4.4/gallery-cleanlooks.html QCleanLooks] |
- | * [http://doc.trolltech.com/ | + | * [http://doc.trolltech.com/4.4/gallery-windows.html Windows] |
- | * [http://doc.trolltech.com/ | + | * [http://doc.trolltech.com/4.4/gallery-plastique.html Plastique] |
Qt application can use other Qt styles; | Qt application can use other Qt styles; | ||
- | * Running your application with the style flag: | + | * Running your application with the style flag: |
- | + | ./qt-test-application -style windows | |
- | + | ||
- | + | * Using [http://doc.trolltech.com/4.4/qapplication.html#setStyle QApplication::setStyle( QStyle * style )] | |
- | + | * If you want to change the style of a widget:[http://doc.trolltech.com/4.4/qwidget.html#setStyle QWidget::setStyle( QStyle * style )] | |
- | + | ===Showing the status bar=== | |
+ | Hildon applications don't have a status bar. Qt for Maemo hides the status bar by default. | ||
+ | You can show it again by using method ''statusBar()->show()'' in your class derived from QMainWindow. | ||
- | ===Adding Maemo changes to a Qt Application | + | ===Using the Kinetic Finger Scrolling (cf Gtk's PannableArea)=== |
+ | See [[Qt/Finger Scrolling|Finger Scrolling]] | ||
+ | |||
+ | ==Adding Maemo changes to a Qt Application== | ||
Some methods of Qt for Maemo are not available in the "standard" Qt libs, so a Qt application with specific Maemo Qt code can't be built outside the Maemo SDK. To avoid this issue, the developer can use the preprocessor directives: | Some methods of Qt for Maemo are not available in the "standard" Qt libs, so a Qt application with specific Maemo Qt code can't be built outside the Maemo SDK. To avoid this issue, the developer can use the preprocessor directives: | ||
Line 99: | Line 97: | ||
In the source code: | In the source code: | ||
- | + | #ifdef Q_WS_MAEMO_5 | |
- | #ifdef Q_WS_MAEMO_5 | + | //specific hildon/maemo5 code here |
- | + | #endif | |
- | #endif | + | |
- | + | ||
In the project file: | In the project file: | ||
- | + | maemo5 { | |
- | maemo5 { | + | message("Hello Hildon") |
- | + | SOURCE += hildon.cpp | |
- | + | HEADER += hildon.h | |
- | + | FORMS += hildon.ui | |
- | + | } | |
- | } | + | |
- | + | ||
- | + | ||
- | + | ||
+ | == Home widget interaction == | ||
{{main|Qt4 and Hildon home widget interaction}} | {{main|Qt4 and Hildon home widget interaction}} | ||
- | == | + | |
+ | ==Limitations== | ||
+ | |||
+ | Currently Qt Maemo lacks full support for Hildon widgets introduced in Maemo 5. | ||
+ | |||
+ | '''At the moment, creating a Qt application that follows Maemo 5 UI Style requires using custom Qt widgets, coded within the application itself'''. | ||
+ | |||
+ | There is work ongoing to provide Qt Hildon widgets for Maemo 5, see [http://wiki.maemo.org/Qt4_Hildon/Qt_Hildon_Widgets Qt Hildon Widgets] | ||
+ | |||
+ | To get the benefits of the ongoing Maemo 5 hildon integration work in Qt, you must get the latest Qt source code and compile it yourself. See [http://wiki.maemo.org/Qt4_Hildon#Building_Qt_from_GIT_rep Building Qt from GIT repository]. | ||
+ | |||
+ | = [[Image:Bug.png]] Debugging a Qt application = | ||
{{main|Documentation/Maemo_5_Developer_Guide/Kernel_and_Debugging_Guide/Maemo_Debugging_Guide}} | {{main|Documentation/Maemo_5_Developer_Guide/Kernel_and_Debugging_Guide/Maemo_Debugging_Guide}} | ||
Line 128: | Line 132: | ||
/usr/local/bin/gdb7 ./myapp | /usr/local/bin/gdb7 ./myapp | ||
- | = | + | = [[Image:chart.png]] Profiling a Qt application = |
- | + | == OProfile == | |
{{main|Documentation/devtools/maemo5/oprofile}} | {{main|Documentation/devtools/maemo5/oprofile}} | ||
- | + | == Valgrind == | |
{{main|Documentation/devtools/maemo5/valgrind}} | {{main|Documentation/devtools/maemo5/valgrind}} | ||
- | = | + | |
+ | |||
+ | = [[Image:package.png]] Packaging a Qt application for Maemo = | ||
{{main|Packaging a Qt application}} | {{main|Packaging a Qt application}} | ||
- | = | + | = [[Image:Helmet.png]] Maemo Qt API Reference = |
- | Maemo Qt is based on Qt for X11. It shares same APIs avoiding API breaks. In this way every Qt application that runs in other platforms (Windows, Mac OS X, Linux, S60, etc.) can run in Maemo devices as well. To Develop a Qt application you can use the [http://qt.nokia.com/doc/qt-maemo-4.6 Official Qt 4.6 for Maemo API documentation] and the list below to see what are the Maemo changes. | + | Maemo Qt is based on Qt for X11. It shares same APIs avoiding API breaks. In this way every Qt application that runs in other platforms (Windows, Mac OS X, Linux, S60, etc.) can run in Maemo devices as well. |
+ | To Develop a Qt application you can use the [http://qt.nokia.com/doc/qt-maemo-4.6 Official Qt 4.6 for Maemo API documentation] and the list below to see what are the Maemo changes. | ||
- | Here are examples that show several | + | Here are examples that show several maemo5 Qt widgets in Qt 4.6. |
- | + | http://qt.nokia.com/doc/qt-maemo-4.6/examples-maemo5.html | |
- | + | ||
- | + | http://qt.gitorious.org/+qt-developers/qt/x11-maemo/trees/4.6-fremantle/examples/maemo5/widgets | |
- | |||
- | == Contributing to the Maemo Qt Project | + | ==Maemo5 Readme file== |
+ | There is a [http://qt.gitorious.org/+qt-developers/qt/x11-maemo/blobs/4.6-fremantle/README.maemo5 README file in Qt 4.6 source tree]. | ||
+ | |||
+ | = [[Image:Helmet.png]] Contributing to the Maemo Qt Project = | ||
Maemo Qt is a community project. Contributing to the forum, sending us patches, give us feedbacks, tracking bugs are all activities that help us to improve the quality of our work. | Maemo Qt is a community project. Contributing to the forum, sending us patches, give us feedbacks, tracking bugs are all activities that help us to improve the quality of our work. | ||
Line 161: | Line 169: | ||
Here there is a list of things that every person interested in helping us should read. | Here there is a list of things that every person interested in helping us should read. | ||
- | + | ==Stay updated== | |
- | + | Any Maemo Qt developer should be updated and should participate to the discussions, for that he must join the Mailing list. | |
- | Any Maemo Qt developer should be updated and should participate to the discussions, for that he must join the Mailing list. BTW the mailing list is not for Maemo Qt Developers but it's open to Maemo Qt application developers too. | + | BTW the mailing list is not for Maemo Qt Developers but it's open to Maemo Qt application developers too. |
- | + | ||
- | + | ||
+ | == Introduction to Git == | ||
If you are a git newbie you maybe find interesting these links: | If you are a git newbie you maybe find interesting these links: | ||
* http://www.sourcemage.org/Git_Guide | * http://www.sourcemage.org/Git_Guide | ||
Line 173: | Line 180: | ||
* Using the git protocol through a HTTP CONNECT proxy: http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/ | * Using the git protocol through a HTTP CONNECT proxy: http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/ | ||
- | + | ==Understanding the structure of our Git repository== | |
{{main|Qt Maemo Git Process}} | {{main|Qt Maemo Git Process}} | ||
- | + | == Preparation == | |
Make sure each scratchbox target has | Make sure each scratchbox target has | ||
Line 185: | Line 192: | ||
(you may need to apt-get install libgl-dev too as it's not in the Build-Depends: yet) | (you may need to apt-get install libgl-dev too as it's not in the Build-Depends: yet) | ||
- | + | ==Building Qt from Git repository== | |
- | |||
# Clone the repository:<br/><pre>git clone git://gitorious.org/+qt-developers/qt/x11-maemo.git qt-maemo</pre><br/> | # Clone the repository:<br/><pre>git clone git://gitorious.org/+qt-developers/qt/x11-maemo.git qt-maemo</pre><br/> | ||
# Change dir:<br/><pre>cd qt-maemo</pre> | # Change dir:<br/><pre>cd qt-maemo</pre> | ||
- | # Configure Qt:<br/> | + | # Configure Qt:<br/><pre>./configure -maemo5</pre> |
# Build Qt:<br/><pre>make</pre> | # Build Qt:<br/><pre>make</pre> | ||
# Install Qt:<br/><pre>make install</pre> | # Install Qt:<br/><pre>make install</pre> | ||
- | + | ==Merging branches changes in the mainline [OLD]== | |
Before to merge your changes in the mainline, the code must be full working, cleaned and tested. A review from another developer is also needed in order to reduce the possibility to add errors. | Before to merge your changes in the mainline, the code must be full working, cleaned and tested. A review from another developer is also needed in order to reduce the possibility to add errors. | ||
+ | <br><br> | ||
- | + | ==QML== | |
- | + | ||
[[QML]] is a GUI interface building scripting language for Qt. Check out the [[QML-EnhancedCalcExample | QML calculator example]]. | [[QML]] is a GUI interface building scripting language for Qt. Check out the [[QML-EnhancedCalcExample | QML calculator example]]. | ||
- | = | + | |
+ | =[[Image:Help-contents.png]] F.A.Q.= | ||
; ''I'm trying to compile a Qt application for ARMEL, but I got the error below. What's wrong?'' | ; ''I'm trying to compile a Qt application for ARMEL, but I got the error below. What's wrong?'' | ||
Line 216: | Line 223: | ||
: libqt4-dev should copy all header files, but now, at least in 4.5.2-1maemo1, some files are missing. Please download file below and extract to your scratchbox system. | : libqt4-dev should copy all header files, but now, at least in 4.5.2-1maemo1, some files are missing. Please download file below and extract to your scratchbox system. | ||
: <pre>http://qt4.garage.maemo.org/patches/qt4-missing-header.tgz</pre> | : <pre>http://qt4.garage.maemo.org/patches/qt4-missing-header.tgz</pre> | ||
+ | |||
+ | |||
[[Category:Development]] | [[Category:Development]] | ||
[[Category:Qt]] | [[Category:Qt]] |
Learn more about Contributing to the wiki.