Editing Documentation/Maemo 5 Developer Guide/Development Environment/Maemo Programming Environments/Using Maemo 5 specific APIs in Qt application

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 15: Line 15:
We've moved D-Bus related functionality and orientation based calculations to a separate library that implements <code>DeviceOrientationNotifier</code> class.  
We've moved D-Bus related functionality and orientation based calculations to a separate library that implements <code>DeviceOrientationNotifier</code> class.  
Our notifier asks MCE about orientation parameters with a certain period,  
Our notifier asks MCE about orientation parameters with a certain period,  
-
<source lang="cpp-qt">
+
<source lang="cpp">
void DeviceOrientationNotifier::timerEvent(QTimerEvent *)
void DeviceOrientationNotifier::timerEvent(QTimerEvent *)
{
{
Line 23: Line 23:
</source>
</source>
processes answers in `mceOrientationSlot', and emits data needed by the application with the following signal:
processes answers in `mceOrientationSlot', and emits data needed by the application with the following signal:
-
<source lang="cpp-qt">
+
<source lang="cpp">
void deviceOrientation(qreal pitch, qreal roll);
void deviceOrientation(qreal pitch, qreal roll);
</source>
</source>
Line 31: Line 31:
We've modified [http://qt.nokia.com/doc/4.5/graphicsview-collidingmice.html one of Qt4 Examples] in order to show how device orientation can be used.
We've modified [http://qt.nokia.com/doc/4.5/graphicsview-collidingmice.html one of Qt4 Examples] in order to show how device orientation can be used.
In our case pitch and roll are scene's characteristics, so we've implemented a `SceneTuner', whose slot can be connected to an appropriate signal in order to setup these scene properties.
In our case pitch and roll are scene's characteristics, so we've implemented a `SceneTuner', whose slot can be connected to an appropriate signal in order to setup these scene properties.
-
<source lang="cpp-qt">
+
<source lang="cpp">
DeviceOrientationNotifier notifier(100);
DeviceOrientationNotifier notifier(100);
SceneTuner tuner(&scene, TimerInterval);
SceneTuner tuner(&scene, TimerInterval);
Line 45: Line 45:
hardkeyhandler.cpp:
hardkeyhandler.cpp:
-
<source lang="cpp-qt">
+
<source lang="cpp">
void HardkeyHandler::grabIncreaseDecreaseKeys(QWidget* window, bool grab)
void HardkeyHandler::grabIncreaseDecreaseKeys(QWidget* window, bool grab)
{
{
Line 66: Line 66:
hardkeyhandler.cpp:
hardkeyhandler.cpp:
-
<source lang="cpp-qt">
+
<source lang="cpp">
bool HardkeyHandler::processX11Event(XEvent* event)
bool HardkeyHandler::processX11Event(XEvent* event)
{
{
Line 90: Line 90:
myapplication.cpp:
myapplication.cpp:
-
<source lang="cpp-qt">
+
<source lang="cpp">
void MyApplication::increaseKeyPressed()
void MyApplication::increaseKeyPressed()
{
{
Line 108: Line 108:
main.cpp:
main.cpp:
-
<source lang="cpp-qt">
+
<source lang="cpp">
QObject::connect(app.keyHandler(), SIGNAL(decreaseKeyPressed()), &app, SLOT(decreaseKeyPressed()));
QObject::connect(app.keyHandler(), SIGNAL(decreaseKeyPressed()), &app, SLOT(decreaseKeyPressed()));
QObject::connect(app.keyHandler(), SIGNAL(increaseKeyPressed()), &app, SLOT(increaseKeyPressed()));
QObject::connect(app.keyHandler(), SIGNAL(increaseKeyPressed()), &app, SLOT(increaseKeyPressed()));

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)