PySide6.QtWidgets.QProgressBar¶
- class QProgressBar¶
The
QProgressBar
widget provides a horizontal or vertical progress bar. More…Synopsis¶
Properties¶
alignmentᅟ
- The alignment of the progress barformatᅟ
- The string used to generate the current textinvertedAppearanceᅟ
- Whether or not a progress bar shows its progress invertedmaximumᅟ
- The progress bar’s maximum valueminimumᅟ
- The progress bar’s minimum valueorientationᅟ
- The orientation of the progress bartextᅟ
- The descriptive text shown with the progress bartextDirectionᅟ
- The reading direction of the text for vertical progress barstextVisibleᅟ
- Whether the current completed percentage should be displayedvalueᅟ
- The progress bar’s current value
Methods¶
def
__init__()
def
alignment()
def
format()
def
isTextVisible()
def
maximum()
def
minimum()
def
orientation()
def
resetFormat()
def
setAlignment()
def
setFormat()
def
setTextVisible()
def
textDirection()
def
value()
Virtual methods¶
def
text()
Slots¶
def
reset()
def
setMaximum()
def
setMinimum()
def
setOrientation()
def
setRange()
def
setValue()
Signals¶
def
valueChanged()
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¶
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 bymaximum()
-minimum()
.You can specify the minimum and maximum number of steps with
setMinimum()
andsetMaximum
. The current number of steps is set withsetValue()
. The progress bar can be rewound to the beginning withreset()
.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
- class 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
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property alignmentᅟ: Combination of Qt.AlignmentFlag¶
This property holds the alignment of the progress bar.
- Access functions:
- property 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
- Access functions:
- property 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.See also
- Access functions:
- property 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 withreset()
.- Access functions:
- property 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 withreset()
.- Access functions:
- property orientationᅟ: Qt.Orientation¶
This property holds the orientation of the progress bar.
The orientation must be Qt::Horizontal (the default) or Qt::Vertical.
See also
- Access functions:
- property 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 textDirectionᅟ: QProgressBar.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 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
- Access functions:
- property 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:
Signal
valueChanged()
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
- alignment()¶
- Return type:
Combination of
AlignmentFlag
See also
Getter of property
alignmentᅟ
.- format()¶
- Return type:
str
See also
Getter of property
formatᅟ
.- initStyleOption(option)¶
- Parameters:
option –
QStyleOptionProgressBar
Initialize
option
with the values from thisQProgressBar
. This method is useful for subclasses when they need aQStyleOptionProgressBar
, but don’t want to fill in all the information themselves.See also
- invertedAppearance()¶
- Return type:
bool
See also
Getter of property
invertedAppearanceᅟ
.- isTextVisible()¶
- Return type:
bool
Getter of property
textVisibleᅟ
.- maximum()¶
- Return type:
int
See also
Getter of property
maximumᅟ
.- minimum()¶
- Return type:
int
See also
Getter of property
minimumᅟ
.- orientation()¶
- Return type:
See also
Getter of property
orientationᅟ
.- reset()¶
Reset the progress bar. The progress bar “rewinds” and shows no progress.
- resetFormat()¶
Reset function of property
formatᅟ
.- setAlignment(alignment)¶
- Parameters:
alignment – Combination of
AlignmentFlag
See also
Setter of property
alignmentᅟ
.Setter of property
formatᅟ
.- setInvertedAppearance(invert)¶
- Parameters:
invert – bool
See also
Setter of property
invertedAppearanceᅟ
.Setter of property
maximumᅟ
.Setter of property
minimumᅟ
.- setOrientation(arg__1)¶
- Parameters:
arg__1 –
Orientation
See also
Setter of property
orientationᅟ
.- setRange(minimum, maximum)¶
- Parameters:
minimum – int
maximum – int
Sets the progress bar’s minimum and maximum values to
minimum
andmaximum
respectively.If
maximum
is smaller thanminimum
,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).Setter of property
textDirectionᅟ
.- setTextVisible(visible)¶
- Parameters:
visible – bool
See also
Setter of property
textVisibleᅟ
.Setter of property
valueᅟ
.- text()¶
- Return type:
str
Getter of property
textᅟ
.- textDirection()¶
- Return type:
See also
Getter of property
textDirectionᅟ
.- value()¶
- Return type:
int
See also
Getter of property
valueᅟ
.- 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ᅟ
.