在本页

Page QML Type

支持页眉和页脚的样式页面控件。更多

Import Statement: import QtQuick.Controls
Inherits:

Pane

属性

详细说明

Page 是一个容器控件,可方便地为页面添加headerfooter 项目。

显示页眉、内容区域和页脚的页面布局

声明为页面子项的项目会

  • 自动成为页面内容项目的父级。动态创建的项目需要明确地作为内容项目的父对象。
  • 不会自动定位或调整大小。

下面的示例代码段说明了如何使用特定于页面的工具栏页眉和应用程序范围的标签栏页脚。

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 控件中的焦点管理

属性文档

该属性用于保存页面页脚项。页脚项目位于底部,并根据页面宽度调整大小。默认值为null

注: ToolBarTabBarDialogButtonBox 指定为页面页脚会自动将相应的ToolBar::positionTabBar::positionDialogButtonBox::position 属性设置为Footer

另请参阅 headerApplicationWindow::footer

header : Item

该属性用于保存页面页眉项。页眉项目位于顶部,并根据页面宽度调整大小。默认值为null

注: ToolBarTabBarDialogButtonBox 指定为页眉会自动将相应的ToolBar::positionTabBar::positionDialogButtonBox::position 属性设置为Header

另请参阅 footerApplicationWindow::header

implicitFooterHeight : real [read-only, since QtQuick.Controls 2.5 (Qt 5.12)]

该属性包含隐式页脚高度。

其值等于footer && footer.visible ? footer.implicitHeight : 0

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 implicitFooterWidthimplicitHeaderHeight

implicitFooterWidth : real [read-only, since QtQuick.Controls 2.5 (Qt 5.12)]

该属性包含隐式页脚宽度。

其值等于footer && footer.visible ? footer.implicitWidth : 0

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 implicitFooterHeightimplicitHeaderWidth

implicitHeaderHeight : real [read-only, since QtQuick.Controls 2.5 (Qt 5.12)]

该属性包含隐式标题高度。

其值等于header && header.visible ? header.implicitHeight : 0

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 implicitHeaderWidthimplicitFooterHeight

implicitHeaderWidth : real [read-only, since QtQuick.Controls 2.5 (Qt 5.12)]

该属性用于保存隐式标题宽度。

其值等于header && header.visible ? header.implicitWidth : 0

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 implicitHeaderHeightimplicitFooterWidth

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")
        }
    }
}

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