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 110: Line 110:
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 197: Line 197:
A developer can change it by using:
A developer can change it by using:
-
<source lang="cpp-qt">
+
<source lang="cpp">
void QInputContext::setInputMode(int mode);
void QInputContext::setInputMode(int mode);
</source>
</source>
Line 203: Line 203:
HIC Modes:
HIC Modes:
-
* <code>HILDON_GTK_INPUT_MODE_ALPHA</code> alphabetical characters and whitespace
+
* HILDON_GTK_INPUT_MODE_ALPHA alphabetical characters and whitespace
-
* <code>HILDON_GTK_INPUT_MODE_NUMERIC</code> numbers 0-9 and the '-' character
+
* HILDON_GTK_INPUT_MODE_NUMERIC numbers 0-9 and the '-' character
-
* <code>HILDON_GTK_INPUT_MODE_SPECIAL</code> special characters
+
* HILDON_GTK_INPUT_MODE_SPECIAL special characters
-
* <code>HILDON_GTK_INPUT_MODE_HEXA</code> hexadecimal characters; numbers 0-9, characters a-f, and A-F
+
* HILDON_GTK_INPUT_MODE_HEXA 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/().-+*#?,"
+
* HILDON_GTK_INPUT_MODE_TELE 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.
+
* HILDON_GTK_INPUT_MODE_FULL 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.
+
* HILDON_GTK_INPUT_MODE_MULTILINE 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.
+
* HILDON_GTK_INPUT_MODE_INVISIBLE 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.
+
* HILDON_GTK_INPUT_MODE_AUTOCAP 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.
+
* HILDON_GTK_INPUT_MODE_DICTIONARY enable predictive dictionaries and learning based on the input.
Example:
Example:
For a password field we need to set a specific IM mode:
For a password field we need to set a specific IM mode:
-
<source lang="cpp-qt">
+
<source lang="cpp">
int mode = HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE
int mode = HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE
QInputContext *qic = widget->inputContext();
QInputContext *qic = widget->inputContext();
Line 227: Line 227:
Setting the ImMode is quite easy. Check the code below for more understanding.
Setting the ImMode is quite easy. Check the code below for more understanding.
-
<source lang="cpp-qt">
+
<source lang="cpp">
#ifdef Q_WS_HILDON
#ifdef Q_WS_HILDON
#include <QInputContext>
#include <QInputContext>
Line 253: Line 253:
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">
+
<source lang="cpp">
QTableWidget *table = new QTableWidget(this);
QTableWidget *table = new QTableWidget(this);
table->setProperty("FingerScrollable", true);  
table->setProperty("FingerScrollable", true);  
Line 279: Line 279:
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">
+
<source lang="cpp">
QMainWindow *fistStackableWindow = new QMainWindow;
QMainWindow *fistStackableWindow = new QMainWindow;
QMainWindow *secondStackableWindow = new QMainWindow(fistStackableWindow);
QMainWindow *secondStackableWindow = new QMainWindow(fistStackableWindow);
Line 296: Line 296:
=== How to minimize a Qt application? ===
=== How to minimize a Qt application? ===
-
<source lang="cpp-qt">
+
<source lang="cpp">
QDBusConnection c = QDBusConnection::sessionBus();
QDBusConnection c = QDBusConnection::sessionBus();
QDBusMessage m = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
QDBusMessage m = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
Line 304: Line 304:
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">
+
<source lang="cpp">
#ifdef Q_WS_HILDON
#ifdef Q_WS_HILDON
//Includes for portrait mode support
//Includes for portrait mode support
Line 337: Line 337:
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)
  {
  {

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: