GridLayout QML Type
Provides a way of dynamically arranging items in a grid. More...
|Import Statement:||import QtQuick.Layouts|
- columnSpacing : real
- columns : int
- flow : enumeration
- layoutDirection : enumeration
- rowSpacing : real
- rows : int
To be able to use this type more efficiently, it is recommended that you understand the general mechanism of the Qt Quick Layouts module. Refer to Qt Quick Layouts Overview for more information.
If the GridLayout is resized, all items in the layout will be rearranged. It is similar to the widget-based QGridLayout. All visible children of the GridLayout element will belong to the layout. If you want a layout with just one row or one column, you can use the RowLayout or ColumnLayout. These offer a bit more convenient API, and improve readability.
If the columns property is specified, it will be treated as a maximum limit of how many columns the layout can have, before the auto-positioning wraps back to the beginning of the next row. The columns property is only used when flow is
You can specify which cell you want an item to occupy by setting the Layout.row and Layout.column properties. You can also specify the row span or column span by setting the Layout.rowSpan or Layout.columnSpan properties.
Items in a GridLayout support these attached properties:
Read more about attached properties here.
columnSpacing : real
This property holds the spacing between each column. The default value is
columns : int
This property holds the column limit for items positioned if flow is
GridLayout.LeftToRight. The default value is that there is no limit.
flow : enumeration
This property holds the flow direction of items that does not have an explicit cell position set. It is used together with the columns or rows property, where they specify when flow is reset to the next row or column respectively.
Possible values are:
|(default) Items are positioned next to each other, then wrapped to the next line.|
|Items are positioned next to each other from top to bottom, then wrapped to the next column.|
[since QtQuick.Layouts 1.1] layoutDirection : enumeration
This property holds the layout direction of the grid layout - it controls whether items are laid out from left to right or right to left. If
Qt.RightToLeft is specified, left-aligned items will be right-aligned and right-aligned items will be left-aligned.
|(default) Items are laid out from left to right.|
|Items are laid out from right to left.|
This property was introduced in QtQuick.Layouts 1.1.
rowSpacing : real
This property holds the spacing between each row. The default value is
rows : int
This property holds the row limit for items positioned if flow is
GridLayout.TopToBottom. The default value is that there is no limit.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.