本页内容

ProgressBar QML Type

显示操作的进度。更多...

Import Statement: import QtQuick.Controls
Inherits:

Control

属性

详细说明

ProgressBar 用于指示操作的进度。其值应定期更新。范围由from 和to 定义,这两个属性均可包含任意值。

ProgressBar {
    value: 0.5
}

ProgressBar 还支持一种特殊的“indeterminate ”模式,例如当无法确定正在下载的项目的大小,或者因网络断开导致下载进度中断时,此模式非常有用。

ProgressBar {
    indeterminate: true
}

不确定模式与BusyIndicator 类似。两者均可用于指示后台活动。 主要区别在于视觉呈现,而且进度条(ProgressBar)还能显示具体的进度数值(当该值可确定时)。由于视觉上的差异,不确定进度条和忙碌指示符在用户界面中适用的位置各不相同。不确定进度条的典型位置:

  • 位于ToolBar
  • 在xml-ph-0000@deepl.internal内容中的内联位置Page
  • 位于ItemDelegate 中,用于显示特定项目的进度

另请参阅 《自定义 ProgressBar、BusyIndicator和指示器控件》。

属性文档

from : real

该属性存储进度条的起始值。默认值为0.0 。

另请参阅 to 和value 。

indeterminate : bool

该属性用于指示进度条是否处于不确定模式。处于不确定模式的进度条仅显示操作正在进行中,但不会显示已完成的比例。

position : real [read-only]

该属性保存进度条的逻辑位置。

该位置以值的百分比形式表示,取值范围为0.0 - 1.0 。若需可视化进度,应改用支持从右向左布局的visualPosition 。

另请参阅 value 和visualPosition 。

to : real

该属性用于存储进度条的结束值。默认值为1.0 。

另请参阅 from 和value 。

value : real

该属性存储进度值。默认值为0.0 。

另请参阅 from 、to 以及position 。

visualPosition : real [read-only]

该属性用于存储进度条的视觉位置。

该位置以值的分数形式表示,取值范围为0.0 - 1.0 。当控件为mirrored 时,visuaPosition 等于1.0 - position 。这使得visualPosition 适合用于进度可视化,同时兼顾了从右向左的显示支持。

另请参阅 position 和value 。

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