Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > 6e2327ca1c896c6d674ae53117299f21 > files > 965

qtdeclarative5-doc-5.12.6-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickitem.cpp -->
  <title>LayoutMirroring QML Type | Qt Quick 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >LayoutMirroring QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">LayoutMirroring QML Type</h1>
<span class="subtitle"></span>
<!-- $$$LayoutMirroring-brief -->
<p>Property used to mirror layout behavior. <a href="#details">More...</a></p>
<!-- @@@LayoutMirroring -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr></table></div><ul>
<li><a href="qml-qtquick-layoutmirroring-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-layoutmirroring.html#childrenInherit-prop">childrenInherit</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-layoutmirroring.html#enabled-prop">enabled</a></b></b> : bool</li>
</ul>
<!-- $$$LayoutMirroring-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>The <a href="qml-qtquick-layoutmirroring.html">LayoutMirroring</a> attached property is used to horizontally mirror <a href="qtquick-positioning-anchors.html">Item anchors</a>, <a href="qtquick-positioning-layouts.html">positioner</a> types (such as <a href="qml-qtquick-row.html">Row</a> and <a href="qml-qtquick-grid.html">Grid</a>) and views (such as <a href="qml-qtquick-gridview.html">GridView</a> and horizontal <a href="qml-qtquick-listview.html">ListView</a>). Mirroring is a visual change: left anchors become right anchors, and positioner types like <a href="qml-qtquick-grid.html">Grid</a> and <a href="qml-qtquick-row.html">Row</a> reverse the horizontal layout of child items.</p>
<p>Mirroring is enabled for an item by setting the <a href="qml-qtquick-layoutmirroring.html#enabled-prop">enabled</a> property to true. By default, this only affects the item itself; setting the <a href="qml-qtquick-layoutmirroring.html#childrenInherit-prop">childrenInherit</a> property to true propagates the mirroring behavior to all child items as well. If the <code>LayoutMirroring</code> attached property has not been defined for an item, mirroring is not enabled.</p>
<p><b>Note: </b>Since Qt 5.8, <code>LayoutMirroring</code> can be attached to a <a href="qml-qtquick-window-window.html">Window</a>. In practice, it is the same as attaching <code>LayoutMirroring</code> to the window's <code>contentItem</code>.</p><p>The following example shows mirroring in action. The <a href="qml-qtquick-row.html">Row</a> below is specified as being anchored to the left of its parent. However, since mirroring has been enabled, the anchor is horizontally reversed and it is now anchored to the right. Also, since items in a <a href="qml-qtquick-row.html">Row</a> are positioned from left to right by default, they are now positioned from right to left instead, as demonstrated by the numbering and opacity of the items:</p>
<pre class="qml">

  import QtQuick 2.0

  Rectangle {
      LayoutMirroring.enabled: true
      LayoutMirroring.childrenInherit: true

      width: 300; height: 50
      color: "yellow"
      border.width: 1

      Row {
          anchors { left: parent.left; margins: 5 }
          y: 5; spacing: 5

          Repeater {
              model: 5

              Rectangle {
                  color: "red"
                  opacity: (5 - index) / 5
                  width: 40; height: 40

                  Text {
                      text: index + 1
                      anchors.centerIn: parent
                  }
              }
          }
      }
  }

</pre>
<p class="centerAlign"><img src="images/layoutmirroring.png" alt="" /></p><p>Layout mirroring is useful when it is necessary to support both left-to-right and right-to-left layout versions of an application to target different language areas. The <a href="qml-qtquick-layoutmirroring.html#childrenInherit-prop">childrenInherit</a> property allows layout mirroring to be applied without manually setting layout configurations for every item in an application. Keep in mind, however, that mirroring does not affect any positioning that is defined by the <a href="qml-qtquick-item.html">Item</a> <a href="qml-qtquick-item.html#x-prop">x</a> coordinate value, so even with mirroring enabled, it will often be necessary to apply some layout fixes to support the desired layout direction. Also, it may be necessary to disable the mirroring of individual child items (by setting <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring.enabled</a> to false for such items) if mirroring is not the desired behavior, or if the child item already implements mirroring in some custom way.</p>
<p>To set the layout direction based on the <a href="qtquick-positioning-righttoleft.html#default-layout-direction">default layout direction</a> of the application, use the following code:</p>
<pre class="cpp">

  LayoutMirroring<span class="operator">.</span>enabled: <span class="type">Qt</span><span class="operator">.</span>application<span class="operator">.</span>layoutDirection <span class="operator">=</span><span class="operator">=</span><span class="operator">=</span> <span class="type">Qt</span><span class="operator">.</span>RightToLeft

</pre>
<p>See <a href="qtquick-positioning-righttoleft.html">Right-to-left User Interfaces</a> for further details on using <code>LayoutMirroring</code> and other related features to implement right-to-left support for an application.</p>
<!-- @@@LayoutMirroring -->
<h2>Property Documentation</h2>
<!-- $$$childrenInherit -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="childrenInherit-prop">
<td class="tblQmlPropNode"><p>
<a name="childrenInherit-prop"></a><span class="name">childrenInherit</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring.enabled</a> value for this item is inherited by its children.</p>
<p>The default value is false.</p>
</div></div><!-- @@@childrenInherit -->
<br/>
<!-- $$$enabled -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="enabled-prop">
<td class="tblQmlPropNode"><p>
<a name="enabled-prop"></a><span class="name">enabled</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the item's layout is mirrored horizontally. Setting this to true horizontally reverses <a href="qtquick-positioning-anchors.html">anchor</a> settings such that left anchors become right, and right anchors become left. For <a href="qtquick-positioning-layouts.html">positioner</a> types (such as <a href="qml-qtquick-row.html">Row</a> and <a href="qml-qtquick-grid.html">Grid</a>) and view types (such as <a href="qml-qtquick-gridview.html">GridView</a> and <a href="qml-qtquick-listview.html">ListView</a>) this also mirrors the horizontal layout direction of the item.</p>
<p>The default value is false.</p>
</div></div><!-- @@@enabled -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>