PageIndicator QML Type
显示当前活动页面。更多...
Import Statement: | import QtQuick.Controls |
Inherits: |
属性
- count : int
- currentIndex : int
- delegate : Component
- interactive : bool
详细说明
PageIndicator 用于显示多个页面容器中的当前活动页面。PageIndicator 由显示页面的委托项组成。
Column { StackLayout { id: stackLayout Page { // ... } Page { // ... } Page { // ... } } PageIndicator { currentIndex: stackLayout.currentIndex count: stackLayout.count } }
另请参阅 SwipeView 、自定义 PageIndicator 和指示器控件。
属性文档
count : int |
该属性显示页数。
currentIndex : int |
该属性包含当前页面的索引。
delegate : Component |
该属性包含显示页面的委托项。
以下属性在每个委托的上下文中可用:
索引:int | 项目的索引 |
pressed: bool | 项目是否按下 |
interactive : bool |
该属性表示控件是否是交互式的。交互式页面指示器会对按压做出反应,并自动适当更改current index 。
SwipeView { id: view currentIndex: pageIndicator.currentIndex anchors.fill: parent Page { title: qsTr("Home") } Page { title: qsTr("Discover") } Page { title: qsTr("Activity") } } PageIndicator { id: pageIndicator interactive: true count: view.count currentIndex: view.currentIndex anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter }
注意: 页面指示器通常很小(以避免分散用户对用户界面实际内容的注意力)。它们可能很难点击,而且用户可能不容易识别出它们是交互式的。因此,它们最好用来补充主要导航方法(如SwipeView ),而不是取而代之。
默认值为false
。
© 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.