Editing Qt4 Hildon Legacy

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:
-
== Introduction ==
+
= 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.
Line 9: Line 9:
Read more about [http://maemo.org/intro/platform/ the Maemo platform] and a [http://maemo.org/intro/developer_overview/ developer overview].
Read more about [http://maemo.org/intro/platform/ the Maemo platform] and a [http://maemo.org/intro/developer_overview/ developer overview].
-
== Getting started ==
+
= 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]].
-
=== Installing Qt packages in Scratchbox ===
+
== Installing Qt packages in Scratchbox ==
Maemo Qt developers offers a set of Qt packages for [[Open development/Maemo roadmap/Fremantle|Fremantle]] (Maemo5 - OS2009) and [[Open development/Maemo roadmap/Diablo|Diablo]] (Maemo4.1 - OS2008).
Maemo Qt developers offers a set of Qt packages for [[Open development/Maemo roadmap/Fremantle|Fremantle]] (Maemo5 - OS2009) and [[Open development/Maemo roadmap/Diablo|Diablo]] (Maemo4.1 - OS2008).
-
=== Fremantle ===
+
== Fremantle ==
You do not need to add any extra repository for Fremantle since Qt packages are already available in the SDK. You can install Qt with the command:
You do not need to add any extra repository for Fremantle since Qt packages are already available in the SDK. You can install Qt with the command:
  fakeroot apt-get install libqt4-dev
  fakeroot apt-get install libqt4-dev
-
==== Using Qt 4.6 in Fremantle ====
+
=== Using Qt 4.6 in Fremantle ===
Since the [[Maemo 5/PR1.2|PR1.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:
Since the [[Maemo 5/PR1.2|PR1.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:
Line 26: Line 26:
  fakeroot apt-get dist-upgrade
  fakeroot apt-get dist-upgrade
-
=== Diablo ===
+
== Diablo ==
Diablo Qt packages are into the official [[Extras]] repository. In order to start to develop with those packages you need to [[Extras#Diablo|add extras repository to your repository list]], and then install Qt packages in the terminal:
Diablo Qt packages are into the official [[Extras]] repository. In order to start to develop with those packages you need to [[Extras#Diablo|add extras repository to your repository list]], and then install Qt packages in the terminal:
  apt-get install libqt4-dev
  apt-get install libqt4-dev
Line 75: Line 75:
  su -c ./quassel user
  su -c ./quassel user
-
== Porting Qt applications to Maemo ==
+
= 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===
+
==Overriding the Qt Maemo changes==
-
 
+
-
====Maemo Style====
+
 +
===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/4.5/gallery-cleanlooks.html QCleanLooks]
* [http://doc.trolltech.com/4.5/gallery-cleanlooks.html QCleanLooks]
Line 96: Line 95:
* If you want to change the style of a widget:[http://doc.trolltech.com/4.5/qwidget.html#setStyle QWidget::setStyle( QStyle * style )]
* If you want to change the style of a widget:[http://doc.trolltech.com/4.5/qwidget.html#setStyle QWidget::setStyle( QStyle * style )]
-
====Showing the status bar====
+
===Showing the status bar===
Hildon applications don't have a status bar. Qt for Maemo hides the status bar by default.
Hildon applications don't have a status bar. Qt for Maemo hides the status bar by default.
Line 102: Line 101:
You can show it again by using method ''statusBar()->show()'' in your class derived from QMainWindow.
You can show it again by using method ''statusBar()->show()'' in your class derived from QMainWindow.
-
====Using the Kinetic Finger Scrolling (cf Gtk's PannableArea)====
+
===Using the Kinetic Finger Scrolling (cf Gtk's PannableArea)===
-
 
+
See [[Qt/Finger Scrolling|Finger Scrolling]]
See [[Qt/Finger Scrolling|Finger Scrolling]]
-
===Adding Maemo changes to a Qt Application===
+
==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, for example with Qt 4.5 on Diablo and Fremantle:
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, for example with Qt 4.5 on Diablo and Fremantle:
-
<source lang="cpp-qt">
+
<source lang="cpp">
#ifdef Q_WS_HILDON
#ifdef Q_WS_HILDON
   //Specific hildon/Maemo5 code here  
   //Specific hildon/Maemo5 code here  
Line 124: Line 122:
}
}
-
=== Home widget interaction ===
+
== Home widget interaction ==
-
 
+
{{main|Qt4 and Hildon home widget interaction}}
{{main|Qt4 and Hildon home widget interaction}}
-
===Limitations===
+
 
 +
==Limitations==
Currently Qt Maemo lacks full support for Hildon widgets introduced in Maemo 5.  
Currently Qt Maemo lacks full support for Hildon widgets introduced in Maemo 5.  
Line 138: Line 136:
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 [[Qt4_Hildon#Building_Qt_from_GIT_rep|Building Qt from GIT repository]].
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 [[Qt4_Hildon#Building_Qt_from_GIT_rep|Building Qt from GIT repository]].
-
== Debugging a Qt application ==
+
= 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 146: Line 144:
  /usr/local/bin/gdb7 ./myapp
  /usr/local/bin/gdb7 ./myapp
-
== Profiling a Qt application ==
+
= Profiling a Qt application =
-
=== OProfile ===
+
== OProfile ==
{{main|Documentation/devtools/maemo5/oprofile}}
{{main|Documentation/devtools/maemo5/oprofile}}
-
=== Valgrind ===
+
== Valgrind ==
{{main|Documentation/devtools/maemo5/valgrind}}
{{main|Documentation/devtools/maemo5/valgrind}}
-
== Packaging a Qt application for Maemo ==
 
-
{{main|Packaging a Qt application}}
 
-
== Maemo Qt API Reference ==
+
= Packaging a Qt application for Maemo =
-
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://doc.trolltech.com/4.5/index.html Official Qt 4.5 API documentation] and the list below to see what are the Maemo changes.
+
{{main|Packaging a Qt application}}
-
===Diablo===
+
= Maemo Qt API Reference =
-
'''QString QDesktopServices::storageLocation(StandardLocation type)''' returns specific Maemo locations for these types:
+
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.  
-
* DesktopLocation:  QDir::homePath() + QLatin1String("/MyDocs"),           instead of QDir::homePath() + QLatin1String("/Desktop")
+
To Develop a Qt application you can use the [http://doc.trolltech.com/4.5/index.html Official Qt 4.5 API documentation] and the list below to see what are the Maemo changes.
-
* DocumentsLocation: QDir::homePath() + QLatin1String("/MyDocs/.documents"), instead of QDir::homePath() + QLatin1String("/MyDocs/.documents")
+
-
* PicturesLocation:  QDir::homePath() + QLatin1String("/MyDocs/.images"),    instead of QDir::homePath() + QLatin1String("/Pictures")
+
-
* MusicLocation:     QDir::homePath() + QLatin1String("/MyDocs/.sounds"),    instead of QDir::homePath() + QLatin1String("/Music")
+
-
* MoviesLocation:    QDir::homePath() + QLatin1String("/MyDocs/.videos"),    instead of QDir::homePath() + QLatin1String("/MyDocs/.videos")
+
-
'''QTabletEvents''' are able to get the pressure value from the touchscreen. The eventdeviceType is for the touchscreen is set to QTabletEvent::Stylus. QTabletEvents won't be used anymore in Fremantle
+
==Diablo==
 +
  '''QString QDesktopServices::storageLocation(StandardLocation type)''' returns specific Maemo locations for these types:
 +
  - DesktopLocation:   QDir::homePath() + QLatin1String("/MyDocs"),            instead of QDir::homePath() + QLatin1String("/Desktop")
 +
  - DocumentsLocation: QDir::homePath() + QLatin1String("/MyDocs/.documents"), instead of QDir::homePath() + QLatin1String("/MyDocs/.documents")
 +
  - PicturesLocation:  QDir::homePath() + QLatin1String("/MyDocs/.images"),    instead of QDir::homePath() + QLatin1String("/Pictures")
 +
  - MusicLocation:    QDir::homePath() + QLatin1String("/MyDocs/.sounds"),    instead of QDir::homePath() + QLatin1String("/Music")
 +
  - MoviesLocation:    QDir::homePath() + QLatin1String("/MyDocs/.videos"),    instead of QDir::homePath() + QLatin1String("/MyDocs/.videos")
-
'''Finger poke''' is emulated in scratchbox by the Middle Mouse button (NOTE: There is no Fullscreen VKB in scratchbox)
+
  '''QTabletEvents''' are able to get the pressure value from the touchscreen.
-
 
+
  - The eventdeviceType is for the touchscreen is set to QTabletEvent::Stylus.
-
'''QInputEvents''' don't move the cursor.  
+
  - QTabletEvents won't be used anymore in Fremantle
-
It's mandatory to get working the HIM moving the cursor via QInputMethodEvents.
+
 
-
Why is it mandatory?  Because if the user select text with the finger from the right to the left, we are able to remove the highlighted text, but the cursor will be moved on the last char instead to stay on the first one.
+
  '''Finger poke''' is emulated in scratchbox by the Middle Mouse button (NOTE: There is no Fullscreen VKB in scratchbox)
 +
 +
  '''QInputEvents''' don't move the cursor.  
 +
  It's mandatory to get working the HIM moving the cursor via QInputMethodEvents.
 +
  Why is it mandatory?   
 +
  Because if the user select text with the finger from the right to the left, we are able to remove the highlighted text, but the
 +
  cursor will be moved on the last char instead to stay on the first one.
    
    
-
To do that some changes has been added to some widget function like: ''widget::inputMethodEvent(QInputMethodEvent *e)''.
+
  To do that some changes has been added to some widget function like: ''widget::inputMethodEvent(QInputMethodEvent *e)''.
-
Modifing that function in some custom widgets may be necessary. Don't reimplementing that function will break some fullscreen virtual keyboard features.
+
  Modifing that function in some custom widgets may be necessary.
 +
  Don't reimplementing that function will break some fullscreen virtual keyboard features.
    
    
-
'''Hardcoded Keys:'''
+
  '''Hardcoded Keys:'''
-
In the QMainWindow:
+
  In the QMainWindow:
-
* F6 - Toggle fullscreen the application
+
  - F6 - Toggle fullscreen the application
-
* F4 - Shows/Hides the application context menu
+
  - F4 - Shows/Hides the application context menu
-
* Zoom in  - is a standard [http://doc.trolltech.com/4.4/qkeysequence.html#StandardKey-enum key sequence] QKeySequence::ZoomIn
+
  - Zoom in  - is a standard [http://doc.trolltech.com/4.4/qkeysequence.html#StandardKey-enum key sequence] QKeySequence::ZoomIn
-
* Zoom out - is a standard [http://doc.trolltech.com/4.4/qkeysequence.html#StandardKey-enum key sequence] QKeySequence::ZoomOut
+
  - Zoom out - is a standard [http://doc.trolltech.com/4.4/qkeysequence.html#StandardKey-enum key sequence] QKeySequence::ZoomOut
-
'''Input Method:'''
+
  '''Input Method:'''
-
Maemo Qt uses the Hildon IM as default Input method. Each kind of widget can set the IM mode. This allows the input method to focus on the type of input that the application is expecting. Eg: spinboxes can receive only numeric characters (1-9).
+
  Maemo Qt uses the Hildon IM as default Input method.
-
 
+
  Each kind of widget can set the IM mode. This allows the input method to focus on the type of input that the application is expecting.
-
NOTE: Qt widgets like QTextEdit, QLineEdit... set the right input method mode automatically.
+
  Eg: spinboxes can receive only numeric characters (1-9).
-
 
+
-
A developer can change it by using:
+
-
<source lang="cpp-qt">
+
-
void QInputContext::setInputMode(int mode);
+
-
</source>
+
-
It will update immediately the Hildon Input method to use the selected IM mode. 
+
-
 
+
-
HIC Modes:
+
-
* <code>HILDON_GTK_INPUT_MODE_ALPHA</code> alphabetical characters and whitespace
+
-
* <code>HILDON_GTK_INPUT_MODE_NUMERIC</code> numbers 0-9 and the '-' character
+
-
* <code>HILDON_GTK_INPUT_MODE_SPECIAL</code> special characters
+
-
* <code>HILDON_GTK_INPUT_MODE_HEXA</code> hexadecimal characters; numbers 0-9, characters a-f, and A-F
+
-
* <code>HILDON_GTK_INPUT_MODE_TELE</code> telephone numbers; numbers 0-9, whitespace, and the characters "pwPW/().-+*#?,"
+
-
* <code>HILDON_GTK_INPUT_MODE_FULL</code> unrestricted entry mode, combination of the alpha, numeric and special modes.
+
-
* <code>HILDON_GTK_INPUT_MODE_MULTILINE</code> the client contains multiple lines of text or accepts linebreaks in the input.
+
-
* <code>HILDON_GTK_INPUT_MODE_INVISIBLE</code> do not echo or save the input in the IM when entering sensitive information such as passwords.
+
-
* <code>HILDON_GTK_INPUT_MODE_AUTOCAP</code> automatically capitalize the first letter at the start of a sentence.
+
-
* <code>HILDON_GTK_INPUT_MODE_DICTIONARY</code> enable predictive dictionaries and learning based on the input.
+
-
 
+
-
Example:
+
-
For a password field we need to set a specific IM mode:
+
-
<source lang="cpp-qt">
+
-
int mode = HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE
+
-
QInputContext *qic = widget->inputContext();
+
-
qic->setInputMode(mode);
+
-
</source>
+
-
If you are developing a Custom widget able to receive input text, you can instruct your widget to use the right IM Mode just returning the mode.
+
    
    
-
- How does it work?
+
  NOTE: Qt widgets like QTextEdit, QLineEdit... set the right input method mode automatically.
-
The Hildon IM sends a XMessage to pop up the "Virtual Keyboard" (or better the Main HIM UI) when an input widget receive the focus. The IM before to raise the VKB, makes an inputMethodQuery to the widget retrieving the IM mode. If the developer of the custom widget doesn't set the mode property, the IM will use <code>HILDON_GTK_INPUT_MODE_FULL</code> (the default mode) for that widget.
+
 
-
 
+
  A developer can change it by using:
-
Setting the ImMode is quite easy. Check the code below for more understanding.
+
    void QInputContext::setInputMode(int mode);
-
<source lang="cpp-qt">
+
  It will update immediately the Hildon Input method to use the selected IM mode. 
-
#ifdef Q_WS_HILDON
+
 
-
#include <QInputContext>
+
  HIC Modes:
-
#endif
+
    HILDON_GTK_INPUT_MODE_ALPHA alphabetical characters and whitespace
-
 
+
    HILDON_GTK_INPUT_MODE_NUMERIC numbers 0-9 and the '-' character
-
QVariant QAbstractSpinBox::inputMethodQuery(Qt::InputMethodQuery query) const
+
    HILDON_GTK_INPUT_MODE_SPECIAL special characters
-
{     
+
    HILDON_GTK_INPUT_MODE_HEXA hexadecimal characters; numbers 0-9, characters a-f, and A-F
-
  Q_D(const QAbstractSpinBox);
+
    HILDON_GTK_INPUT_MODE_TELE telephone numbers; numbers 0-9, whitespace, and the characters "pwPW/().-+*#?,"
-
  switch(query) {
+
    HILDON_GTK_INPUT_MODE_FULL unrestricted entry mode, combination of the alpha, numeric and special modes.
-
      case Qt::ImMode:{
+
    HILDON_GTK_INPUT_MODE_MULTILINE the client contains multiple lines of text or accepts linebreaks in the input.
-
          int mode = HILDON_GTK_INPUT_MODE_NUMERIC;
+
    HILDON_GTK_INPUT_MODE_INVISIBLE do not echo or save the input in the IM when entering sensitive information such as passwords.
-
          return QVariant(mode);
+
    HILDON_GTK_INPUT_MODE_AUTOCAP automatically capitalize the first letter at the start of a sentence.
-
      }
+
    HILDON_GTK_INPUT_MODE_DICTIONARY enable predictive dictionaries and learning based on the input.
-
      default:
+
 
-
          return d->edit->inputMethodQuery(query);
+
  Example:
 +
    For a password field we need to set a specific IM mode:
 +
    int mode = HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE
 +
    QInputContext *qic = widget->inputContext();
 +
    qic->setInputMode(mode);
 +
 
 +
  If you are developing a Custom widget able to receive input text, you can instruct your widget to use the right IM Mode just returning
 +
  the mode.
 +
 
 +
  - How does it work?
 +
  The Hildon IM sends a XMessage to pop up the "Virtual Keyboard" (or better the Main HIM UI) when an input widget receive the focus.
 +
  The IM before to raise the VKB, makes an inputMethodQuery to the widget retrieving the IM mode.
 +
  If the developer of the custom widget doesn't set the mode property, the IM will use HILDON_GTK_INPUT_MODE_FULL (the default mode) for that widget.
 +
 
 +
  Setting the ImMode is quite easy. Check the code below for more understanding.
 +
 
 +
  #ifdef Q_WS_HILDON
 +
  #include <QInputContext>
 +
  #endif
 +
 
 +
  QVariant QAbstractSpinBox::inputMethodQuery(Qt::InputMethodQuery query) const
 +
  {     
 +
    Q_D(const QAbstractSpinBox);
 +
    switch(query) {
 +
        case Qt::ImMode:{
 +
            int mode = HILDON_GTK_INPUT_MODE_NUMERIC;
 +
            return QVariant(mode);
 +
        }
 +
        default:
 +
            return d->edit->inputMethodQuery(query);
 +
    }
   }
   }
-
}
 
-
</source>
 
-
==FREMANTLE (Qt 4.5)==
+
=FREMANTLE (Qt 4.5)=
-
 
+
-
===Kinetic scrolling===
+
 +
==Kinetic scrolling==
Kinetic scrolling is enabled by default in QListWidgets and is supported by any Qt widget that inherits QScrollArea.
Kinetic scrolling is enabled by default in QListWidgets and is supported by any Qt widget that inherits QScrollArea.
Any item view widgets (QTreeView/QTreeWidget, QListView, QTableView/QTableWidget...) can use fingerscroll if it has "FingerScrollable" dynamic property set to true.
Any item view widgets (QTreeView/QTreeWidget, QListView, QTableView/QTableWidget...) can use fingerscroll if it has "FingerScrollable" dynamic property set to true.
Eg:
Eg:
-
<source lang="cpp-qt">
+
  QTableWidget *table = new QTableWidget(this);
-
QTableWidget *table = new QTableWidget(this);
+
  table->setProperty("FingerScrollable", true);  
-
table->setProperty("FingerScrollable", true);  
+
 
-
</source>
+
NOTE: Available in Qt > 4.5.3-xxxxx-maemo4
NOTE: Available in Qt > 4.5.3-xxxxx-maemo4
-
===Hildon-Desktop widgets===
+
==Hildon-Desktop widgets==
{{main|Qt4 Hildon/Qt Hildon Widgets}}
{{main|Qt4 Hildon/Qt Hildon Widgets}}
Line 265: Line 269:
They are supported by Qt. An example (qt-example-hildondesktopwidget) is available in extras-devel.
They are supported by Qt. An example (qt-example-hildondesktopwidget) is available in extras-devel.
-
===Hildon menus===
+
==Hildon menus==
-
 
+
Maemo5 menus are created using QActions available in menu bar.  
Maemo5 menus are created using QActions available in menu bar.  
Hidden, disabled, separators and widget actions won't shown. (Same in Qt 4.6)
Hidden, disabled, separators and widget actions won't shown. (Same in Qt 4.6)
Line 275: Line 278:
Note: Maemo5 policy doesn't allow application to have more than 10 items.
Note: Maemo5 policy doesn't allow application to have more than 10 items.
-
===Stackable windows===
+
==Stackable windows==
-
 
+
http://maemomm.garage.maemo.org/docs/tutorial/figures/stackable-window.png
http://maemomm.garage.maemo.org/docs/tutorial/figures/stackable-window.png
Are supported by Qt. To create them you need to create a MainWindow child of another Main window.
Are supported by Qt. To create them you need to create a MainWindow child of another Main window.
-
<source lang="cpp-qt">
+
 
-
QMainWindow *fistStackableWindow = new QMainWindow;
+
QMainWindow *fistStackableWindow = new QMainWindow;
-
QMainWindow *secondStackableWindow = new QMainWindow(fistStackableWindow);
+
QMainWindow *secondStackableWindow = new QMainWindow(fistStackableWindow);
// you need the below line to see the back button on the top right hand corner of the stacked window instead of a cross
// you need the below line to see the back button on the top right hand corner of the stacked window instead of a cross
-
secondStackableWindow->setAttribute(Qt::WA_Maemo5StackedWindow);
+
secondStackableWindow->setAttribute(Qt::WA_Maemo5StackedWindow);
-
</source>
+
 
 +
 
''Note: this is not entirely accurate, see''
''Note: this is not entirely accurate, see''
http://qt.nokia.com/doc/qt-maemo-4.6/maemo5-stackedwindows.html
http://qt.nokia.com/doc/qt-maemo-4.6/maemo5-stackedwindows.html
-
===Raise a Qt application in background===
+
==Raise a Qt application in background==
-
 
+
QWidget::activateWindow() does the job.
-
<code>QWidget::activateWindow()</code> does the job.
+
Implemented in Qt packages >= qt-4.5.3-xxxx-maemo6
Implemented in Qt packages >= qt-4.5.3-xxxx-maemo6
 +
== How to minimize a Qt application? ==
 +
QDBusConnection c = QDBusConnection::sessionBus();
 +
QDBusMessage m = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
 +
c.send(m);
-
=== How to minimize a Qt application? ===
+
==Portrait mode and listening for orientation changes==
-
<source lang="cpp-qt">
+
-
QDBusConnection c = QDBusConnection::sessionBus();
+
-
QDBusMessage m = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
+
-
c.send(m);
+
-
</source>
+
-
===Portrait mode and listening for orientation changes===
+
-
 
+
If you want to run your application in portrait mode then you can add these lines to your application. The code goes in your main widget constructor.
If you want to run your application in portrait mode then you can add these lines to your application. The code goes in your main widget constructor.
-
<source lang="cpp-qt">
 
-
#ifdef Q_WS_HILDON
 
-
//Includes for portrait mode support
 
-
# include <X11/Xlib.h>
 
-
# include <X11/Xatom.h>
 
-
# include <QtGui/QX11Info>
 
-
#endif
 
-
#ifndef Q_WS_HILDON
+
#ifdef Q_WS_HILDON
-
int value = 1;
+
//Includes for portrait mode support
-
Atom portraitSupport = XInternAtom(QX11Info::display(), "_HILDON_PORTRAIT_MODE_SUPPORT", false);
+
# include <X11/Xlib.h>
-
Atom portraitRequest = XInternAtom(QX11Info::display(), "_HILDON_PORTRAIT_MODE_REQUEST", false);
+
# include <X11/Xatom.h>
-
XChangeProperty(QX11Info::display(), winId(), portraitSupport, XA_CARDINAL, 32, PropModeReplace, (uchar *)&value, 1);
+
# include <QtGui/QX11Info>
-
XChangeProperty(QX11Info::display(), winId(), portraitRequest, XA_CARDINAL, 32, PropModeReplace, (uchar *)&value, 1);
+
#endif
-
#endif
+
-
</source>
+
#ifndef Q_WS_HILDON
-
If you want to listen for orientation changes and then switch the view to landscape or potrait mode automatically than take a look at [[Maemo Qt Extra Libraries]] for more information.
+
int value = 1;
 +
Atom portraitSupport = XInternAtom(QX11Info::display(), "_HILDON_PORTRAIT_MODE_SUPPORT", false);
 +
Atom portraitRequest = XInternAtom(QX11Info::display(), "_HILDON_PORTRAIT_MODE_REQUEST", false);
 +
XChangeProperty(QX11Info::display(), winId(), portraitSupport, XA_CARDINAL, 32, PropModeReplace, (uchar *)&value, 1);
 +
XChangeProperty(QX11Info::display(), winId(), portraitRequest, XA_CARDINAL, 32, PropModeReplace, (uchar *)&value, 1);
 +
#endif
-
=== QDockWidgets ===
+
If you want to listen for orientation changes and then switch the view to landscape or potrait mode automatically than take a look at [[Maemo_Qt_Extra_Libraries]] for more information.
 +
== QDockWidgets ==
QDockWidgets are not finger friendly widgets. They should not be used in Maemo.
QDockWidgets are not finger friendly widgets. They should not be used in Maemo.
In case you are porting an application to Maemo maybe you want to do
In case you are porting an application to Maemo maybe you want to do
few changes as possible into your UI. Then you could use QDockWidget::setFeatures(QDockWidget::NoDockWidgetFeatures); to hide float and close button and lock the position of the dock widget.
few changes as possible into your UI. Then you could use QDockWidget::setFeatures(QDockWidget::NoDockWidgetFeatures); to hide float and close button and lock the position of the dock widget.
-
=== QPrint* and QSystemTray support missing ===
+
== QPrint* and QSystemTray support missing ==
 +
Printing (QPrint*) and System tray support is missing in current
 +
Qt 4.5.3-xxxx-maemo4 packages.
 +
Since incompatibility with KDE and other Qt application, they will be enabled again in next Qt 4.5.3 packages.
-
Printing (QPrint*) and System tray support is missing in current Qt 4.5.3-xxxx-maemo4 packages. Since incompatibility with KDE and other Qt application, they will be enabled again in next Qt 4.5.3 packages.
+
== QSplashScreen not fully compatible with Hildon-Desktop ==
-
 
+
-
=== QSplashScreen not fully compatible with Hildon-Desktop ===
+
QSplashScreen's window type is not supported in Fremantle. The splash screen is shown in full screen and the image is repeated to fill the splash screen's window. When splash screen is closed normal window closing animation is shown before showing the actual application window. For these reasons developers are disencouraged to use splash screens in their applications.
QSplashScreen's window type is not supported in Fremantle. The splash screen is shown in full screen and the image is repeated to fill the splash screen's window. When splash screen is closed normal window closing animation is shown before showing the actual application window. For these reasons developers are disencouraged to use splash screens in their applications.
As a workaround for the problem you can set a window property that tells HD to skip the transitions:
As a workaround for the problem you can set a window property that tells HD to skip the transitions:
-
<source lang="cpp-qt">
+
 
 +
<source lang="cpp">
  static void set_no_transitions (Display *dpy, Window w)
  static void set_no_transitions (Display *dpy, Window w)
  {
  {
Line 349: Line 349:
</source>
</source>
-
=== QToolBar limitations ===
+
== QToolBar limitations ==
 +
Adding a QToolBar to a QMainWindow will always result in a toolbar at the
 +
bottom of the screen. (Justification/Workarounds?)
-
Adding a QToolBar to a QMainWindow will always result in a toolbar at the bottom of the screen. (Justification/Workarounds?)
 
-
== Contributing to the Maemo Qt Project ==
+
= 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 359: Line 360:
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===
+
==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 ===
+
 +
== 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 371: Line 371:
* 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===
+
==Understanding the structure of our Git repository==
{{main|Qt Maemo Git Process}}
{{main|Qt Maemo Git Process}}
-
=== Preparation ===
+
== Preparation ==
Make sure each scratchbox target has
Make sure each scratchbox target has
Line 383: Line 383:
(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===
+
==Building Qt from Git repository==
# Clone the repository:<pre>git clone git://gitorious.org/+qt-maemo-developers/qt/qt-maemo.git</pre>or if you are a member of our team:<pre>git clone git@gitorious.org:+qt-maemo-developers/qt/qt-maemo.git</pre>
# Clone the repository:<pre>git clone git://gitorious.org/+qt-maemo-developers/qt/qt-maemo.git</pre>or if you are a member of our team:<pre>git clone git@gitorious.org:+qt-maemo-developers/qt/qt-maemo.git</pre>
Line 391: Line 391:
# Build the packages:<pre>dpkg-buildpackage -rfakeroot -b</pre>
# Build the packages:<pre>dpkg-buildpackage -rfakeroot -b</pre>
-
===Merging branches changes in the mainline [OLD]===
+
==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.
-
===QML===
+
==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]].
-
==F.A.Q.==
+
 
 +
=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?''

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: