Page QML Type
支持页眉和页脚的样式页面控件。更多
Import Statement: | import QtQuick.Controls |
Inherits: |
属性
- footer : Item
- header : Item
- implicitFooterHeight : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- implicitFooterWidth : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- implicitHeaderHeight : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- implicitHeaderWidth : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- title : string
详细说明
Page 是一个容器控件,可方便地为页面添加header 和footer 项目。
声明为页面子项的项目会
- 自动成为页面内容项目的父级。动态创建的项目需要明确地作为内容项目的父对象。
- 不会自动定位或调整大小。
下面的示例代码段说明了如何使用特定于页面的工具栏页眉和应用程序范围的标签栏页脚。
import QtQuick.Controls import QtQuick.Layouts ApplicationWindow { visible: true StackView { anchors.fill: parent initialItem: Page { header: ToolBar { // ... } ColumnLayout { anchors.fill: parent // ... } } } footer: TabBar { // ... } }
另请参阅 ApplicationWindow 、容器控件以及 Qt Quick Controls 中的焦点管理。
属性文档
footer : Item |
该属性包含页面页脚项。页脚项位于底部,并根据页面宽度调整大小。默认值为null
。
注: 将ToolBar 、TabBar 或DialogButtonBox 指定为页面页脚会自动将相应的ToolBar::position 、TabBar::position 或DialogButtonBox::position 属性设置为Footer
。
另请参阅 header 和ApplicationWindow::footer 。
header : Item |
该属性包含页眉项。页眉项位于顶部,并根据页面宽度调整大小。默认值为null
。
注: 将ToolBar 、TabBar 或DialogButtonBox 指定为页眉会自动将相应的ToolBar::position 、TabBar::position 或DialogButtonBox::position 属性设置为Header
。
另请参阅 footer 和ApplicationWindow::header 。
implicitFooterHeight : real |
该属性包含隐式页脚高度。
其值等于footer && footer.visible ? footer.implicitHeight : 0
。
该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。
implicitFooterWidth : real |
该属性保存隐式页脚宽度。
其值等于footer && footer.visible ? footer.implicitWidth : 0
。
该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。
implicitHeaderHeight : real |
该属性保存隐式页眉高度。
其值等于header && header.visible ? header.implicitHeight : 0
。
该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。
implicitHeaderWidth : real |
该属性用于保存隐式标题宽度。
其值等于header && header.visible ? header.implicitWidth : 0
。
该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。
title : string |
该属性用于保存页面标题。
标题通常显示在页面顶部,为用户提供他们正在查看的页面的上下文。
页面本身不会显示标题,而是依靠应用程序来显示。例如
ApplicationWindow { visible: true width: 400 height: 400 header: Label { text: view.currentItem.title horizontalAlignment: Text.AlignHCenter } SwipeView { id: view anchors.fill: parent Page { title: qsTr("Home") } Page { title: qsTr("Discover") } Page { title: qsTr("Activity") } } }
© 2025 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.