本页内容

Qt Quick Layouts

Qt Quick Layouts 是一组用于在用户界面中排列项的 QML 类型。与定位器不同,Qt Quick Layouts 还可以调整其子项的大小。这使得它们非常适合用于可调整大小的用户界面。

请访问“Qt Quick Layouts 概述”页面开始入门。

使用该模块

可通过 `QtQuick.Layouts ` 导入语句使用该模块的 QML 类型。要使用这些类型,请在您的 .qml 文件中添加以下导入语句:

import QtQuick.Layouts

布局

ColumnLayout

与 GridLayout 完全相同,但仅有一列

FlexboxLayout

该 QML 构造为快速项目提供了一种弹性布局

GridLayout

提供了一种在网格中动态排列项的方法

Layout

为推入 GridLayout、RowLayout 或 ColumnLayout 中的项提供附加属性

LayoutItemProxy

布局中 QQuickItem 的占位符

RowLayout

与 GridLayout 完全相同,但仅有一行

StackLayout

项目堆栈,每次仅显示一个项目

文章与指南

示例

参考

许可证

Qt Quick Layouts 可通过The Qt Company 获取商业许可。此外,它还提供自由软件许可。自 Qt 5.4 起,这些自由软件许可包括GNU 缩减通用公共许可证第 3 版或 GNU 通用公共许可证第 2 版。更多详情请参阅Qt 许可。

© 2026 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.