ProgressBar QML Type
指示操作的进度。更多
| Import Statement: | import QtQuick.Controls |
| Inherits: |
属性
- from : real
- indeterminate : bool
- position : real
- to : real
- value : real
- visualPosition : real
详细说明
ProgressBar 显示操作的进度。该值应定期更新。其范围由from 和to 定义,两者均可包含任何值。
ProgressBar { value: 0.5 }
ProgressBar 还支持一种特殊的indeterminate 模式,例如,在无法确定正在下载的项目的大小时,或在下载进度因网络断开而中断时,这种模式非常有用。
ProgressBar { indeterminate: true }
不确定模式类似于BusyIndicator 。两者都可以用来指示后台活动。两者的主要区别在于视觉上的不同,ProgressBar 也可以显示具体的进度(在可以确定的情况下)。由于视觉上的差异,不确定进度条和繁忙指示符在用户界面中的位置不同。不确定进度条的典型位置:
- 页面底部ToolBar
- 内嵌在Page
- 在ItemDelegate 中显示特定项目的进度
另请参阅 自定义进度条、BusyIndicator 和指示器控件。
属性文档
from : real
该属性用于保存进度的起始值。默认值为0.0 。
indeterminate : bool
该属性表示进度条是否处于不确定模式。处于不确定模式的进度条会显示操作正在进行中,但不会显示进度有多少。
position : real [read-only]
该属性表示进度的逻辑位置。
位置用数值的分数表示,范围是0.0 - 1.0 。为使进度可视化,应使用从右到左的visualPosition 。
另请参阅 value 和visualPosition 。
to : real
该属性用于保存进度的结束值。默认值为1.0 。
value : real
该属性保存进度值。默认值为0.0 。
visualPosition : real [read-only]
该属性表示进度的可视位置。
位置以数值的分数表示,范围为0.0 - 1.0 。当控件为mirrored 时,visuaPosition 等于1.0 - position 。因此,考虑到从右到左的支持,visualPosition 适合用于进度的可视化。
© 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.