Row QML Type

Positions its children in a row. 更多...

import 语句: import QtQuick 2.2
继承: Item

特性

信号

方法

详细描述

Row is a type that positions its child items along a single row. It can be used as a convenient way to horizontally position a series of items without using anchors .

Below is a Row that contains three rectangles of various sizes:

import QtQuick 2.0
Row {
    spacing: 2
    Rectangle { color: "red"; width: 50; height: 50 }
    Rectangle { color: "green"; width: 20; height: 50 }
    Rectangle { color: "blue"; width: 50; height: 20 }
}
					

The Row automatically positions these items in a horizontal formation, like this:

If an item within a Row is not visible , or if it has a width or height of 0, the item will not be laid out and it will not be visible within the row. Also, since a Row automatically positions its children horizontally, a child item within a Row should not set its x position or horizontally anchor itself using the left , right , anchors.horizontalCenter , fill or centerIn anchors. If you need to perform these actions, consider positioning the items without the use of a Row.

Note that items in a Row can use the Positioner attached property to access more information about its position within the Row.

For more information on using Row and other related positioner-types, see Item Positioners .

另请参阅 Column , Grid , Flow , Positioner , RowLayout ,和 Qt Quick 范例 - 定位器 .

特性文档编制

[since 5.6] bottomPadding : real
[since 5.6] leftPadding : real
[since 5.6] padding : real
[since 5.6] rightPadding : real
[since 5.6] topPadding : real

These properties hold the padding around the content.

该 QML 特性在 Qt 5.6 引入。

add : Transition

This property holds the transition to be run for items that are added to this positioner. For a positioner, this applies to:

  • Items that are created or reparented as a child of the positioner after the positioner has been created
  • Child items that change their Item::visible property from false to true, and thus are now visible

The transition can use the ViewTransition property to access more details about the item that is being added. See the ViewTransition documentation for more details and examples on using these transitions.

注意: This transition is not applied to the items that are already part of the positioner at the time of its creation. In this case, the populate transition is applied instead.

另请参阅 populate , ViewTransition ,和 Qt Quick 范例 - 定位器 .

effectiveLayoutDirection : enumeration

This property holds the effective layout direction of the row.

When using the attached property LayoutMirroring::enabled for locale layouts, the visual layout direction of the row positioner will be mirrored. However, the property layoutDirection will remain unchanged.

另请参阅 Row::layoutDirection and LayoutMirroring .

layoutDirection : enumeration

This property holds the layoutDirection of the row.

可能的值:

  • Qt.LeftToRight (default) - Items are laid out from left to right. If the width of the row is explicitly set, the left anchor remains to the left of the row.
  • Qt.RightToLeft - Items are laid out from right to left. If the width of the row is explicitly set, the right anchor remains to the right of the row.

另请参阅 Grid::layoutDirection , Flow::layoutDirection ,和 Qt Quick Examples - Right to Left .

move : Transition

This property holds the transition to run for items that have moved within the positioner. For a positioner, this applies to:

  • Child items that move when they are displaced due to the addition, removal or rearrangement of other items in the positioner
  • Child items that are repositioned due to the resizing of other items in the positioner

The transition can use the ViewTransition property to access more details about the item that is being moved. Note, however, that for this move transition, the ViewTransition .targetIndexes and ViewTransition .targetItems lists are only set when this transition is triggered by the addition of other items in the positioner; in other cases, these lists will be empty. See the ViewTransition documentation for more details and examples on using these transitions.

另请参阅 add , populate , ViewTransition ,和 Qt Quick 范例 - 定位器 .

populate : Transition

This property holds the transition to be run for items that are part of this positioner at the time of its creation. The transition is run when the positioner is first created.

The transition can use the ViewTransition property to access more details about the item that is being added. See the ViewTransition documentation for more details and examples on using these transitions.

另请参阅 add , ViewTransition ,和 Qt Quick 范例 - 定位器 .

spacing : real

The spacing is the amount in pixels left empty between adjacent items. The default spacing is 0.

另请参阅 Grid::spacing .


信号文档编制

[since 5.9] positioningComplete ()

This signal is emitted when positioning has been completed.

注意: 相应处理程序是 onPositioningComplete .

This signal was introduced in Qt 5.9.


方法文档编制

[since 5.9] forceLayout ()

Row typically positions its children once per frame. This means that inside script blocks it is possible for the underlying children to have changed, but the Row to have not yet been updated accordingly.

This method forces the Row to immediately respond to any outstanding changes in its children.

注意 : methods in general should only be called after the Component has completed.

This method was introduced in Qt 5.9.