QProgressBar

Inheritance diagram of QProgressBar

Synopsis

Functions

Virtual functions

Slots

Signals

Detailed Description

The PySide.QtGui.QProgressBar widget provides a horizontal or vertical progress bar.

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 ( PySide.QtGui.QProgressBar.value() - PySide.QtGui.QProgressBar.minimum() ) divided by PySide.QtGui.QProgressBar.maximum() - PySide.QtGui.QProgressBar.minimum() .

You can specify the minimum and maximum number of steps with PySide.QtGui.QProgressBar.setMinimum() and setMaximum. The current number of steps is set with PySide.QtGui.QProgressBar.setValue() . The progress bar can be rewound to the beginning with PySide.QtGui.QProgressBar.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 PySide.QtNetwork.QFtp or PySide.QtNetwork.QNetworkAccessManager to download items when they are unable to determine the size of the item being downloaded.

../../_images/macintosh-progressbar.png A progress bar shown in the Macintosh widget style.
../../_images/windowsxp-progressbar.png A progress bar shown in the Windows XP widget style.
../../_images/plastique-progressbar.png A progress bar shown in the Plastique widget style.

See also

PySide.QtGui.QProgressDialog GUI Design Handbook: Progress Indicator

class PySide.QtGui.QProgressBar([parent=None])
Parameters:parentPySide.QtGui.QWidget

Constructs a progress bar with the given parent .

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

PySide.QtGui.QProgressBar.Direction

Specifies the reading direction of the PySide.QtGui.QProgressBar.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 CDE, CleanLooks, Motif, and Plastique draw the text. Mac, Windows and WindowsXP style do not.

PySide.QtGui.QProgressBar.alignment()
Return type:PySide.QtCore.Qt.Alignment

This property holds the alignment of the progress bar.

PySide.QtGui.QProgressBar.format()
Return type:unicode

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%”.

PySide.QtGui.QProgressBar.initStyleOption(option)
Parameters:optionPySide.QtGui.QStyleOptionProgressBar

Initialize option with the values from this PySide.QtGui.QProgressBar . This method is useful for subclasses when they need a PySide.QtGui.QStyleOptionProgressBar or PySide.QtGui.QStyleOptionProgressBarV2 , but don’t want to fill in all the information themselves. This function will check the version of the PySide.QtGui.QStyleOptionProgressBar and fill in the additional values for a PySide.QtGui.QStyleOptionProgressBarV2 .

PySide.QtGui.QProgressBar.invertedAppearance()
Return type:PySide.QtCore.bool

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

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

PySide.QtGui.QProgressBar.isTextVisible()
Return type:PySide.QtCore.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).

PySide.QtGui.QProgressBar.maximum()
Return type:PySide.QtCore.int

This property holds the progress bar’s maximum value.

When setting this property, the PySide.QtGui.QProgressBar.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 PySide.QtGui.QProgressBar.reset() .

PySide.QtGui.QProgressBar.minimum()
Return type:PySide.QtCore.int

This property holds the progress bar’s minimum value.

When setting this property, the PySide.QtGui.QProgressBar.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 PySide.QtGui.QProgressBar.reset() .

PySide.QtGui.QProgressBar.orientation()
Return type:PySide.QtCore.Qt.Orientation

This property holds the orientation of the progress bar.

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

PySide.QtGui.QProgressBar.reset()

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

PySide.QtGui.QProgressBar.setAlignment(alignment)
Parameters:alignmentPySide.QtCore.Qt.Alignment

This property holds the alignment of the progress bar.

PySide.QtGui.QProgressBar.setFormat(format)
Parameters:format – unicode

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%”.

PySide.QtGui.QProgressBar.setInvertedAppearance(invert)
Parameters:invertPySide.QtCore.bool

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

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

PySide.QtGui.QProgressBar.setMaximum(maximum)
Parameters:maximumPySide.QtCore.int

This property holds the progress bar’s maximum value.

When setting this property, the PySide.QtGui.QProgressBar.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 PySide.QtGui.QProgressBar.reset() .

PySide.QtGui.QProgressBar.setMinimum(minimum)
Parameters:minimumPySide.QtCore.int

This property holds the progress bar’s minimum value.

When setting this property, the PySide.QtGui.QProgressBar.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 PySide.QtGui.QProgressBar.reset() .

PySide.QtGui.QProgressBar.setOrientation(arg__1)
Parameters:arg__1PySide.QtCore.Qt.Orientation

This property holds the orientation of the progress bar.

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

PySide.QtGui.QProgressBar.setRange(minimum, maximum)
Parameters:
  • minimumPySide.QtCore.int
  • maximumPySide.QtCore.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 PySide.QtGui.QProgressBar.reset() .

PySide.QtGui.QProgressBar.setTextDirection(textDirection)
Parameters:textDirectionPySide.QtGui.QProgressBar.Direction

This property holds the reading direction of the PySide.QtGui.QProgressBar.text() for vertical progress bars.

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

PySide.QtGui.QProgressBar.setTextVisible(visible)
Parameters:visiblePySide.QtCore.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).

PySide.QtGui.QProgressBar.setValue(value)
Parameters:valuePySide.QtCore.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.

PySide.QtGui.QProgressBar.text()
Return type:unicode

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.

PySide.QtGui.QProgressBar.textDirection()
Return type:PySide.QtGui.QProgressBar.Direction

This property holds the reading direction of the PySide.QtGui.QProgressBar.text() for vertical progress bars.

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

PySide.QtGui.QProgressBar.value()
Return type:PySide.QtCore.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.

PySide.QtGui.QProgressBar.valueChanged(value)
Parameters:valuePySide.QtCore.int