summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-03-14 06:45:15 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-03-18 06:51:27 (GMT)
commit0d481aa65254d76b7d22dc1e073dcd18e2c65f9b (patch)
treea01d287ebf9bb57f5a94cc68161f996ff26c4d9b /doc/src/snippets
parent73d30f514e1411102fb6f8f21258276e72c836ec (diff)
downloadQt-0d481aa65254d76b7d22dc1e073dcd18e2c65f9b.zip
Qt-0d481aa65254d76b7d22dc1e073dcd18e2c65f9b.tar.gz
Qt-0d481aa65254d76b7d22dc1e073dcd18e2c65f9b.tar.bz2
Write Qt Quick 1.1 right-to-left documentation and examples
Task-number: QTBUG-11042 Reviewed-by: Martin Jones Change-Id: I6319992dec52a4d9252c2df39801ebe6a7dee75d
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/declarative/arrow.pngbin0 -> 454 bytes
-rw-r--r--doc/src/snippets/declarative/righttoleft.qml146
-rw-r--r--doc/src/snippets/declarative/righttoleft/Child.qml11
3 files changed, 157 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/arrow.png b/doc/src/snippets/declarative/arrow.png
new file mode 100644
index 0000000..f0cae21
--- /dev/null
+++ b/doc/src/snippets/declarative/arrow.png
Binary files differ
diff --git a/doc/src/snippets/declarative/righttoleft.qml b/doc/src/snippets/declarative/righttoleft.qml
new file mode 100644
index 0000000..5d34f50
--- /dev/null
+++ b/doc/src/snippets/declarative/righttoleft.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "righttoleft"
+
+Column {
+ width: 200
+//![0]
+// aligned to the left
+Text {
+ text: "Phone"
+ width: 200
+}
+
+// aligned to the right
+Text {
+ text: "خامل"
+ width: 200
+}
+
+// aligned to the left
+Text {
+ text: "خامل"
+ horizontalAlignment: Text.AlignLeft
+ width: 200
+}
+
+// aligned to the right
+Text {
+ text: "خامل"
+ horizontalAlignment: Text.AlignLeft
+ LayoutMirroring.enabled: true
+ width: 200
+}
+//![0]
+
+//![1]
+// by default positions child items from the left to right
+Row {
+ Child {}
+ Child {}
+}
+
+// positions child items from the right to left
+Row {
+ layoutDirection: Qt.RightToLeft
+ Child {}
+ Child {}
+}
+
+// positions child items from the left to right
+Row {
+ LayoutMirroring.enabled: true
+ layoutDirection: Qt.RightToLeft
+ Child {}
+ Child {}
+}
+//![1]
+
+//![2]
+Item {
+ // anchor left becomes right
+ height: 50; width: 150
+ LayoutMirroring.enabled: true
+ anchors.left: parent.left
+ Row {
+ // flows from the left to right
+ Child {}
+ Child {}
+ Child {}
+ }
+}
+//![2]
+
+//![3]
+Item {
+ // anchor left becomes right
+ height: 50; width: 150
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: true
+ anchors.left: parent.left
+ Row {
+ // flows from the right to left
+ Child {}
+ Child {}
+ Child {}
+ }
+}
+//![3]
+
+//![4]
+Rectangle {
+ color: "black"
+ height: 50; width: 50
+ x: mirror(10)
+ function mirror(value) {
+ return LayoutMirroring.enabled ? (parent.width - width - value) : value;
+ }
+}
+//![4]
+
+//![5]
+Image {
+ source: "arrow.png"
+ mirror: true
+}
+//![5]
+} \ No newline at end of file
diff --git a/doc/src/snippets/declarative/righttoleft/Child.qml b/doc/src/snippets/declarative/righttoleft/Child.qml
new file mode 100644
index 0000000..2b3564e
--- /dev/null
+++ b/doc/src/snippets/declarative/righttoleft/Child.qml
@@ -0,0 +1,11 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 50; height: 50
+ color: "black"
+ Text {
+ color: "white"
+ text: String.fromCharCode(65 + Math.floor(26*Math.random()))
+ anchors.centerIn: parent
+ }
+} \ No newline at end of file