Mirroring is enabled for an item by setting the enabled property to true. By default, this only affects the item itself; setting the childrenInherit property to true propagates the mirroring behavior to all child items as well. If the LayoutMirroring attached property has not been defined for an item, mirroring is not enabled.

Note: Since Qt 5.8, LayoutMirroring can be attached to a Window. In practice, it is the same as attaching LayoutMirroring to the window's contentItem.

The following example shows mirroring in action. The Row 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 Row 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:

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 childrenInherit 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 Itemx 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 LayoutMirroring.enabled to false for such items) if mirroring is not the desired behavior, or if the child item already implements mirroring in some custom way.

Property Documentation

This property holds whether the item's layout is mirrored horizontally. Setting this to true horizontally reverses anchor settings such that left anchors become right, and right anchors become left. For positioner types (such as Row and Grid) and view types (such as GridView and ListView) this also mirrors the horizontal layout direction of the item.