summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-13 07:42:17 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-14 05:10:42 (GMT)
commit063a2d45de349b4bc9c7bb23197392a92159ddc9 (patch)
tree9ed8089996fb50b9894818993cd3a207ce7542df /doc
parentffd45093795e9481505af0ae9bf5df7b6c704c72 (diff)
downloadQt-063a2d45de349b4bc9c7bb23197392a92159ddc9.zip
Qt-063a2d45de349b4bc9c7bb23197392a92159ddc9.tar.gz
Qt-063a2d45de349b4bc9c7bb23197392a92159ddc9.tar.bz2
Merged 'orientation' into 'runtime' context property in qmlruntime
Removed the 'Screen' element from DeclarativeViewer, as it was used only for the orientation property. Now access the 'orientation' property like this: 'runtime.orientation' and the enum is accessed as 'Orientation.Landscape', when using the qmlruntime. Updated docs for qmlruntime. Reviewed-by: Martin Jones
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/qmlruntime.qdoc46
1 files changed, 36 insertions, 10 deletions
diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc
index 8bb3ec7..fbe82c6 100644
--- a/doc/src/declarative/qmlruntime.qdoc
+++ b/doc/src/declarative/qmlruntime.qdoc
@@ -70,7 +70,7 @@
\code
qml myQmlFile.qml
\endcode
-
+
Deploying a QML application via the \c qml executable allows for QML only deployments, but can also
include custom C++ modules just as easily. Below is an example of how you might structure
a complex application deployed via the qml runtime, it is a listing of the files that would
@@ -101,7 +101,7 @@
import "MyAppCore"
import "OtherModule" 1.0 as Other
\endcode
-
+
\section1 \c qml application functionality
The \c qml application implements some additional functionality to help it serve the role of a launcher
for myriad applications. If you implement your own launcher application, you may also wish to reimplement
@@ -134,23 +134,25 @@
Any QML can be used in the dummy data files. You could even animate the
fictional data!
- \section2 Screen Orientation
+ \section2 Runtime Object
+
+ All applications using the qmlruntime will have access to the 'runtime'
+ property on the root context. This property contains several information
+ about the runtime environment of the application.
+
+ \section3 Screen Orientation
A special piece of dummy data which is integrated into the runtime is
a simple orientation property. The orientation can be set via the
settings menu in the application, or by pressing Ctrl+T to toggle it.
- To use this from within your QML file, import QDeclarativeViewer 1.0 and create a
- Screen object. This object has a property, orientation, which can be either
- Screen.Landscape or Screen.Portrait and which can be bound to in your
+ To use this from within your QML file, access runtime.orientation,
+ which can be either Orientation.Landscape or Orientation.Portrait and which can be bound to in your
application. An example is below:
\code
- import QDeclarativeViewer 1.0 as QDeclarativeViewer
-
Item {
- QDeclarativeViewer.Screen { id: screen }
- state: (screen.orientation == QDeclarativeViewer.Screen.Landscape) ? 'landscape' : ''
+ state: (runtime.orientation == Orientation.Landscape) ? 'landscape' : ''
}
\endcode
@@ -158,4 +160,28 @@
will automatically update this on some platforms (currently the N900 only) to match the physical
screen's orientation. On other plaforms orientation changes will only happen when explictly asked for.
+ \section3 Window Active
+
+ The runtime.isActiveWindow property tells whether the main window of the qml runtime is currently active
+ or not. This is specially useful for embedded devices when you want to pause parts of your application,
+ including animations, when your application looses focus or goes to the background.
+
+ The example below, stops the animation when the application's window is deactivated and resumes on activation:
+
+\code
+ Item {
+ width: 300; height: 200
+ Rectangle {
+ width: 100; height: 100
+ color: "green"
+ SequentialAnimation on x {
+ running: runtime.isActiveWindow
+ loops: Animation.Infinite
+ NumberAnimation {to: 200}
+ NumberAnimation {to: 0}
+ }
+ }
+ }
+\endcode
+
*/