QProgressBar#

The QProgressBar widget provides a horizontal or vertical progress bar. More

Inheritance diagram of PySide6.QtWidgets.QProgressBar

Synopsis#

Properties#

  • alignment - The alignment of the progress bar

  • format - The string used to generate the current text

  • invertedAppearance - Whether or not a progress bar shows its progress inverted

  • maximum - The progress bar’s maximum value

  • minimum - The progress bar’s minimum value

  • orientation - The orientation of the progress bar

  • text - The descriptive text shown with the progress bar

  • textDirection - The reading direction of the text for vertical progress bars

  • textVisible - Whether the current completed percentage should be displayed

  • value - The progress bar’s current value

Functions#

Virtual functions#

Slots#

Signals#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

../../_images/windows-progressbar.png

A progress bar is used to give the user an indication of the progress of an operation and to reassure them that the application is still running.

The progress bar uses the concept of steps. You set it up by specifying the minimum and maximum possible step values, and it will display the percentage of steps that have been completed when you later give it the current step value. The percentage is calculated by dividing the progress ( value() - minimum() ) divided by maximum() - minimum() .

You can specify the minimum and maximum number of steps with setMinimum() and setMaximum . The current number of steps is set with setValue() . The progress bar can be rewound to the beginning with reset() .

If minimum and maximum both are set to 0, the bar shows a busy indicator instead of a percentage of steps. This is useful, for example, when using QNetworkAccessManager to download items when they are unable to determine the size of the item being downloaded.

See also

QProgressDialog

class PySide6.QtWidgets.QProgressBar([parent=None])#
Parameters:

parentPySide6.QtWidgets.QWidget

Constructs a progress bar with the given parent.

By default, the minimum step value is set to 0, and the maximum to 100.

See also

setRange()

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtWidgets.QProgressBar.alignment: Alignment#

This property holds the alignment of the progress bar.

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.format: str#

This property holds the string used to generate the current text.

%p - is replaced by the percentage completed. %v - is replaced by the current value. %m - is replaced by the total number of steps.

The default value is “%p%”.

See also

text()

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.invertedAppearance: bool#

This property holds whether or not a progress bar shows its progress inverted.

If this property is true, the progress bar grows in the other direction (e.g. from right to left). By default, the progress bar is not inverted.

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.maximum: int#

This property holds the progress bar’s maximum value.

When setting this property, the minimum is adjusted if necessary to ensure that the range remains valid. If the current value falls outside the new range, the progress bar is reset with reset() .

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.minimum: int#

This property holds the progress bar’s minimum value.

When setting this property, the maximum is adjusted if necessary to ensure that the range remains valid. If the current value falls outside the new range, the progress bar is reset with reset() .

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.orientation: Orientation#

This property holds the orientation of the progress bar.

The orientation must be Horizontal (the default) or Vertical .

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.text: str#

This property holds the descriptive text shown with the progress bar.

The text returned is the same as the text displayed in the center (or in some styles, to the left) of the progress bar.

The progress shown in the text may be smaller than the minimum value, indicating that the progress bar is in the “reset” state before any progress is set.

In the default implementation, the text either contains a percentage value that indicates the progress so far, or it is blank because the progress bar is in the reset state.

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.textDirection: Direction#

This property holds the reading direction of the text for vertical progress bars.

This property has no impact on horizontal progress bars. By default, the reading direction is TopToBottom .

See also

orientation textVisible

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.textVisible: bool#

This property holds whether the current completed percentage should be displayed.

This property may be ignored by the style (e.g., QMacStyle never draws the text).

See also

textDirection

Access functions:
property PᅟySide6.QtWidgets.QProgressBar.value: int#

This property holds the progress bar’s current value.

Attempting to change the current value to one outside the minimum-maximum range has no effect on the current value.

Access functions:
PySide6.QtWidgets.QProgressBar.Direction#

Specifies the reading direction of the text for vertical progress bars.

Constant

Description

QProgressBar.TopToBottom

The text is rotated 90 degrees clockwise.

QProgressBar.BottomToTop

The text is rotated 90 degrees counter-clockwise.

Note that whether or not the text is drawn is dependent on the style. Currently CleanLooks and Plastique draw the text. Mac, Windows and WindowsVista style do not.

See also

textDirection

PySide6.QtWidgets.QProgressBar.alignment()#
Return type:

Alignment

See also

setAlignment()

Getter of property alignment .

PySide6.QtWidgets.QProgressBar.format()#
Return type:

str

See also

setFormat()

Getter of property format .

PySide6.QtWidgets.QProgressBar.initStyleOption(option)#
Parameters:

optionPySide6.QtWidgets.QStyleOptionProgressBar

Initialize option with the values from this QProgressBar . This method is useful for subclasses when they need a QStyleOptionProgressBar , but don’t want to fill in all the information themselves.

See also

initFrom()

PySide6.QtWidgets.QProgressBar.invertedAppearance()#
Return type:

bool

Getter of property invertedAppearance .

PySide6.QtWidgets.QProgressBar.isTextVisible()#
Return type:

bool

Getter of property textVisible .

PySide6.QtWidgets.QProgressBar.maximum()#
Return type:

int

See also

setMaximum()

Getter of property maximum .

PySide6.QtWidgets.QProgressBar.minimum()#
Return type:

int

See also

setMinimum()

Getter of property minimum .

PySide6.QtWidgets.QProgressBar.orientation()#
Return type:

Orientation

See also

setOrientation()

Getter of property orientation .

PySide6.QtWidgets.QProgressBar.reset()#

Reset the progress bar. The progress bar “rewinds” and shows no progress.

PySide6.QtWidgets.QProgressBar.resetFormat()#

Reset function of property format .

PySide6.QtWidgets.QProgressBar.setAlignment(alignment)#
Parameters:

alignmentAlignment

See also

alignment()

Setter of property alignment .

PySide6.QtWidgets.QProgressBar.setFormat(format)#
Parameters:

format – str

See also

format()

Setter of property format .

PySide6.QtWidgets.QProgressBar.setInvertedAppearance(invert)#
Parameters:

invert – bool

Setter of property invertedAppearance .

PySide6.QtWidgets.QProgressBar.setMaximum(maximum)#
Parameters:

maximum – int

See also

maximum()

Setter of property maximum .

PySide6.QtWidgets.QProgressBar.setMinimum(minimum)#
Parameters:

minimum – int

See also

minimum()

Setter of property minimum .

PySide6.QtWidgets.QProgressBar.setOrientation(arg__1)#
Parameters:

arg__1Orientation

See also

orientation()

Setter of property orientation .

PySide6.QtWidgets.QProgressBar.setRange(minimum, maximum)#
Parameters:
  • minimum – int

  • maximum – int

Sets the progress bar’s minimum and maximum values to minimum and maximum respectively.

If maximum is smaller than minimum, minimum becomes the only legal value.

If the current value falls outside the new range, the progress bar is reset with reset() .

The QProgressBar can be set to undetermined state by using setRange(0, 0).

See also

minimum maximum

PySide6.QtWidgets.QProgressBar.setTextDirection(textDirection)#
Parameters:

textDirectionDirection

See also

textDirection()

Setter of property textDirection .

PySide6.QtWidgets.QProgressBar.setTextVisible(visible)#
Parameters:

visible – bool

See also

isTextVisible()

Setter of property textVisible .

PySide6.QtWidgets.QProgressBar.setValue(value)#
Parameters:

value – int

See also

value()

Setter of property value .

PySide6.QtWidgets.QProgressBar.text()#
Return type:

str

Getter of property text .

PySide6.QtWidgets.QProgressBar.textDirection()#
Return type:

Direction

Getter of property textDirection .

PySide6.QtWidgets.QProgressBar.value()#
Return type:

int

See also

setValue()

Getter of property value .

PySide6.QtWidgets.QProgressBar.valueChanged(value)#
Parameters:

value – int

This signal is emitted when the value shown in the progress bar changes. value is the new value shown by the progress bar.

Notification signal of property value .