aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/doc/src/concepts/positioning/righttoleft.qdoc')
-rw-r--r--src/quick/doc/src/concepts/positioning/righttoleft.qdoc72
1 files changed, 25 insertions, 47 deletions
diff --git a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
index 1f3602cde1..7c7c314fc3 100644
--- a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
+++ b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtquick-positioning-righttoleft.html
@@ -138,27 +114,25 @@ The painting of these icons can be mirrored with a dedicated \c mirror property:
\section1 Default Layout Direction
-The \l {QtQml::Qt::application}{Qt.application.layoutDirection} property can be used to query the active layout direction of the
-application. It is based on QGuiApplication::layoutDirection(), which most commonly determines the layout
-direction from the active language translation file.
+Use the \l {QtQml::Qt::application}{Qt.application.layoutDirection} property
+to query the active layout direction of the application. It inherits
+QGuiApplication::layoutDirection(), which determines the layout direction from
+the active language translation file.
-To define the layout direction for a particular locale, declare the dedicated string literal
-\c QT_LAYOUT_DIRECTION in context \c QGuiApplication as either "LTR" or "RTL".
+To define the layout direction for a particular locale, declare the dedicated
+string literal \c QT_LAYOUT_DIRECTION in the context \c QGuiApplication as
+either \c LTR or \c RTL.
-You can do this by first introducing this line
+First, introduce this line somewhere in your QML source code:
\code
qsTr("QT_LAYOUT_DIRECTION","QGuiApplication");
\endcode
-somewhere in your QML source code and calling \c lupdate to generate the translation source file.
+Then use \l {Using lupdate} to generate the translation source file.
-\code
-lupdate myapp.qml -ts myapp.ts
-\endcode
-
-This will append the following declaration to the translation file, where you can fill in either "LTR" or
-"RTL" as the translation for the locale.
+This appends the following declaration to the translation file, where you can
+enter either \c LTR or \c RTL as the translation for the locale.
\code
<context>
@@ -171,21 +145,25 @@ This will append the following declaration to the translation file, where you ca
</context>
\endcode
-You can test that the layout direction works as expected by running your Qt Quick application with
-the compiled translation file:
-
+Next, add the following bindings to the root QML component of your application:
\code
-qmlscene myapp.qml -translation myapp.qm
+LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
+LayoutMirroring.childrenInherit: true
\endcode
-You can test your application in right-to-left layout direction simply by executing qmlscene with a
-command-line parameter "-reverse":
+The first binding ensures that the UI will be mirrored appropriately when a
+right-to-left locale is set. The second binding ensures that child items of the
+root component will also respect mirroring.
+
+You can test that the layout direction works as expected by running your Qt Quick application with
+the compiled translation file:
\code
-qmlscene myapp.qml -reverse
+qml myapp.qml -translation myapp.qm
\endcode
-The layout direction can also be set from C++ by calling the static function \l QGuiApplication::setLayoutDirection():
+You can test your application in right-to-left layout direction by calling the
+static function \l QGuiApplication::setLayoutDirection():
\code
QGuiApplication app(argc, argv);