|  | Home · All Classes · Modules

# QProgressBar Class Reference
[QtGui module]

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

Inherits QWidget.

### Types

- enum Direction { TopToBottom, BottomToTop }

### Methods

- __init__ (self, QWidget parent = None)
- Qt.Alignment alignment (self)
- bool event (self, QEvent e)
- QString format (self)
- initStyleOption (self, QStyleOptionProgressBar option)
- bool invertedAppearance (self)
- bool isTextVisible (self)
- int maximum (self)
- int minimum (self)
- QSize minimumSizeHint (self)
- Qt.Orientation orientation (self)
- paintEvent (self, QPaintEvent)
- reset (self)
- setAlignment (self, Qt.Alignment alignment)
- setFormat (self, QString format)
- setInvertedAppearance (self, bool invert)
- setMaximum (self, int maximum)
- setMinimum (self, int minimum)
- setOrientation (self, Qt.Orientation)
- setRange (self, int minimum, int maximum)
- setTextDirection (self, Direction textDirection)
- setTextVisible (self, bool visible)
- setValue (self, int value)
- QSize sizeHint (self)
- QString text (self)
- Direction textDirection (self)
- int value (self)

### Qt Signals

- void valueChanged (int)

## Detailed Description

The 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 (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 QFtp or QNetworkAccessManager to download items when they are unable to determine the size of the item being downloaded.

| A progress bar shown in the Macintosh widget style.
| A progress bar shown in the Windows XP widget style.
| A progress bar shown in the Plastique widget style.

## Type Documentation

### QProgressBar.Direction

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

Constant | Value | Description
--- | --- | ---
`QProgressBar.TopToBottom` | `0` | The text is rotated 90 degrees clockwise.
`QProgressBar.BottomToTop` | `1` | 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.

This enum was introduced or modified in Qt 4.1.

See also textDirection.

## Method Documentation

### QProgressBar.__init__ (self, QWidget parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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().

### Qt.Alignment QProgressBar.alignment (self)

### bool QProgressBar.event (self, QEvent e)

Reimplemented from QObject.event().

### QString QProgressBar.format (self)

### QProgressBar.initStyleOption (self, QStyleOptionProgressBar option)

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

See also QStyleOption.initFrom().

### bool QProgressBar.invertedAppearance (self)

### bool QProgressBar.isTextVisible (self)

### int QProgressBar.maximum (self)

### int QProgressBar.minimum (self)

### QSize QProgressBar.minimumSizeHint (self)

Reimplemented from QWidget.minimumSizeHint().

### Qt.Orientation QProgressBar.orientation (self)

### QProgressBar.paintEvent (self, QPaintEvent)

Reimplemented from QWidget.paintEvent().

### QProgressBar.reset (self)

This method is also a Qt slot with the C++ signature `void reset()`.

Reset the progress bar. The progress bar "rewinds" and shows no progress.

### QProgressBar.setAlignment (self, Qt.Alignment alignment)

### QProgressBar.setFormat (self, QString format)

### QProgressBar.setInvertedAppearance (self, bool invert)

### QProgressBar.setMaximum (self, int maximum)

This method is also a Qt slot with the C++ signature `void setMaximum(int)`.

### QProgressBar.setMinimum (self, int minimum)

This method is also a Qt slot with the C++ signature `void setMinimum(int)`.

### QProgressBar.setOrientation (self, Qt.Orientation)

This method is also a Qt slot with the C++ signature `void setOrientation(Qt::Orientation)`.

### QProgressBar.setRange (self, int minimum, int maximum)

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().

See also minimum and maximum.

### QProgressBar.setTextDirection (self, Direction textDirection)

### QProgressBar.setTextVisible (self, bool visible)

### QProgressBar.setValue (self, int value)

This method is also a Qt slot with the C++ signature `void setValue(int)`.

### QSize QProgressBar.sizeHint (self)

Reimplemented from QWidget.sizeHint().

### QString QProgressBar.text (self)

### Direction QProgressBar.textDirection (self)

### int QProgressBar.value (self)

## Qt Signal Documentation

### void valueChanged (int)

This is the default overload of this signal.

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