diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-04-11 14:56:22 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-04-11 16:05:03 +0200 |
commit | a896d4b39ec3d45ba708d9b36ea9c864b1df2136 (patch) | |
tree | 45cfe153cce6114c2c76c48dc0bdabde2a8cf3e3 /examples/qml | |
parent | 24fb8dc27eddfdd62bd2c3a6e863cbf433762cd6 (diff) | |
parent | 65bfc35429e845cf6b76d58107360a1360a654fc (diff) |
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
src/qml/debugger/qqmlprofilerservice_p.h
src/qml/qml/qqmlboundsignal.cpp
src/qml/qml/v4/qv4bindings.cpp
src/quick/items/qquickshadereffect.cpp
src/quick/particles/qquickcustomparticle.cpp
src/quick/qtquick2.cpp
Change-Id: Ia9c6517035ae912fa75e77473a452bd3383def56
Diffstat (limited to 'examples/qml')
-rw-r--r-- | examples/qml/dynamicscene/content/Button.qml | 7 | ||||
-rw-r--r-- | examples/qml/dynamicscene/content/Sun.qml | 35 | ||||
-rw-r--r-- | examples/qml/dynamicscene/dynamicscene.qml | 26 | ||||
-rw-r--r-- | examples/qml/i18n/i18n.qml | 40 |
4 files changed, 55 insertions, 53 deletions
diff --git a/examples/qml/dynamicscene/content/Button.qml b/examples/qml/dynamicscene/content/Button.qml index 014692274a..ba7db501cc 100644 --- a/examples/qml/dynamicscene/content/Button.qml +++ b/examples/qml/dynamicscene/content/Button.qml @@ -54,16 +54,14 @@ Rectangle { gradient: Gradient { GradientStop { position: 0.0 - color: !mouseArea.pressed ? activePalette.light : activePalette.button + color: !mouseArea.pressed ? "#eeeeee" : "#888888" } GradientStop { position: 1.0 - color: !mouseArea.pressed ? activePalette.button : activePalette.dark + color: !mouseArea.pressed ? "#888888" : "#333333" } } - SystemPalette { id: activePalette } - MouseArea { id: mouseArea anchors.fill: parent @@ -75,6 +73,5 @@ Rectangle { anchors.centerIn:parent font.pointSize: 10 text: parent.text - color: activePalette.buttonText } } diff --git a/examples/qml/dynamicscene/content/Sun.qml b/examples/qml/dynamicscene/content/Sun.qml index b84516eecc..9a956c9855 100644 --- a/examples/qml/dynamicscene/content/Sun.qml +++ b/examples/qml/dynamicscene/content/Sun.qml @@ -47,32 +47,27 @@ Image { property string image: "images/sun.png" source: image - - // once item is created, start moving offscreen - NumberAnimation on y { - to: (window.height / 2) + window.centerOffset - running: created - onRunningChanged: { - if (running) - duration = (window.height + window.centerOffset - sun.y) * 10; - else - state = "OffScreen" - } - } - - states: State { - name: "OffScreen" - StateChangeScript { - script: { sun.created = false; sun.destroy() } - } - } - onCreatedChanged: { if (created) { sun.z = 1; // above the sky but below the ground layer window.activeSuns++; + // once item is created, start moving offscreen + dropYAnim.duration = (window.height + window.centerOffset - sun.y) * 16; + dropAnim.running = true; } else { window.activeSuns--; } } + + SequentialAnimation on y{ + id: dropAnim + running: false + NumberAnimation { + id: dropYAnim + to: (window.height / 2) + window.centerOffset + } + ScriptAction { + script: { sun.created = false; sun.destroy() } + } + } } diff --git a/examples/qml/dynamicscene/dynamicscene.qml b/examples/qml/dynamicscene/dynamicscene.qml index c64df5cfc0..4771742621 100644 --- a/examples/qml/dynamicscene/dynamicscene.qml +++ b/examples/qml/dynamicscene/dynamicscene.qml @@ -38,6 +38,13 @@ ** ****************************************************************************/ +/*! + \title QML Example - Dynamic Scene + \example qml/dynamicscene + \brief This example demonstrates creating components dynamically. + \image qml-dynamicscene-example.png +*/ + import QtQuick 2.0 import QtQuick.Particles 2.0 import "content" @@ -95,7 +102,7 @@ Item { // sky Rectangle { id: sky - anchors { left: parent.left; top: toolbox.bottom; right: parent.right; bottomMargin: -centerOffset; bottom: parent.verticalCenter } + anchors { left: parent.left; top: toolbox.bottom; right: parent.right; bottomMargin: -window.centerOffset; bottom: parent.verticalCenter } gradient: Gradient { GradientStop { id: gradientStopA; position: 0.0; color: "#0E1533" } GradientStop { id: gradientStopB; position: 1.0; color: "#437284" } @@ -127,21 +134,19 @@ Item { Rectangle { id: ground z: 2 // just above the sun so that the sun can set behind it - anchors { left: parent.left; top: parent.verticalCenter; topMargin: centerOffset; right: parent.right; bottom: parent.bottom } + anchors { left: parent.left; top: parent.verticalCenter; topMargin: window.centerOffset; right: parent.right; bottom: parent.bottom } gradient: Gradient { GradientStop { position: 0.0; color: "ForestGreen" } GradientStop { position: 1.0; color: "DarkGreen" } } } - SystemPalette { id: activePalette } - - // right-hand panel + // top panel Rectangle { id: toolbox - height: centerOffset * 2 - color: activePalette.window + height: window.centerOffset * 2 + color: "white" anchors { right: parent.right; top: parent.top; left: parent.left} Column { @@ -192,7 +197,7 @@ Item { } } - Text { text: "Active Suns: " + activeSuns } + Text { text: "Active Suns: " + window.activeSuns } } } @@ -202,7 +207,7 @@ Item { z: 1000 width: parent.width height: popupColumn.height + 16 - color: activePalette.window + color: "white" property bool poppedUp: false property int downY: window.height - (createButton.height + 16) @@ -213,7 +218,6 @@ Item { Column { id: popupColumn y: 8 - anchors.centerIn: parent spacing: 8 Row { @@ -250,7 +254,7 @@ Item { selectByMouse: true wrapMode: TextEdit.WordWrap - text: "import QtQuick 2.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 180 * Math.random() \n source: 'content/images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}" + text: "import QtQuick 2.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 40 * Math.random() \n source: 'content/images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}" } } } diff --git a/examples/qml/i18n/i18n.qml b/examples/qml/i18n/i18n.qml index f8bf30d0f0..2ffdd1914f 100644 --- a/examples/qml/i18n/i18n.qml +++ b/examples/qml/i18n/i18n.qml @@ -40,23 +40,29 @@ import QtQuick 2.0 -// -// The QML runtime automatically loads a translation from the i18n subdirectory of the root -// QML file, based on the system language. -// -// The files are created/updated by running: -// -// lupdate i18n.qml -ts i18n/base.ts -// -// Translations for new languages are created by copying i18n/base.ts to i18n/qml_<lang>.ts -// The .ts files can then be edited with Linguist: -// -// linguist i18n/qml_fr.ts -// -// The run-time translation files are then generated by running: -// -// lrelease i18n/*.ts -// +/*! + \title QML Examples - Internationalization + \example qml/i18n + \image qml-i18n-example.png + \brief This is an internationalization example + + The QML runtime automatically loads a translation from the i18n subdirectory of the root + QML file, based on the system language. + + The files are created/updated by running: + + lupdate i18n.qml -ts i18n/base.ts + + Translations for new languages are created by copying i18n/base.ts to i18n/qml_<lang>.ts + The .ts files can then be edited with Linguist: + + linguist i18n/qml_fr.ts + + The run-time translation files are then generated by running: + + lrelease i18n/*.ts +*/ + Rectangle { width: 640; height: 480 |