com.trolltech.qt.gui
Class QProgressBar

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.gui.QWidget
                      extended by com.trolltech.qt.gui.QProgressBar
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QProgressBar
extends QWidget

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

See also:
QTimeLine, QProgressDialog, and GUI Design Handbook: Progress Indicator.


Nested Class Summary
static class QProgressBar.Direction
          Specifies the reading direction of the text for vertical progress bars.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 QSignalEmitter.Signal1 valueChanged
          This signal takes 1 generic argument(s).
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QProgressBar()
          Constructs a progress bar with the given parent.
QProgressBar(QWidget parent)
          Constructs a progress bar with the given parent.
 
Method Summary
 Qt.Alignment alignment()
          This property holds the alignment of the progress bar.
 java.lang.String format()
          This property holds the string used to generate the current text.
protected  void initStyleOption(QStyleOptionProgressBar option)
          Initialize option with the values from this QProgressBar.
 boolean invertedAppearance()
          This property holds whether or not a progress bar shows its progress inverted.
 boolean isTextVisible()
          This property holds whether the current completed percentage should be displayed.
 int maximum()
          This property holds the progress bar's maximum value.
 int minimum()
          This property holds the progress bar's minimum value.
 Qt.Orientation orientation()
          This property holds the orientation of the progress bar.
 void reset()
          Reset the progress bar.
 void setAlignment(Qt.Alignment alignment)
          This property holds the alignment of the progress bar.
 void setAlignment(Qt.AlignmentFlag[] alignment)
          This is an overloaded method provided for convenience.
 void setFormat(java.lang.String format)
          This property holds the string used to generate the current text.
 void setInvertedAppearance(boolean invert)
          This property holds whether or not a progress bar shows its progress inverted.
 void setMaximum(int maximum)
          This property holds the progress bar's maximum value.
 void setMinimum(int minimum)
          This property holds the progress bar's minimum value.
 void setOrientation(Qt.Orientation arg__1)
          This property holds the orientation of the progress bar.
 void setRange(int minimum, int maximum)
          Sets the progress bar's minimum and maximum values to minimum and maximum respectively.
 void setTextDirection(QProgressBar.Direction textDirection)
          This property holds the reading direction of the text for vertical progress bars.
 void setTextVisible(boolean visible)
          This property holds whether the current completed percentage should be displayed.
 void setValue(int value)
          This property holds the progress bar's current value.
 java.lang.String text()
          This property holds the descriptive text shown with the progress bar.
 QProgressBar.Direction textDirection()
          This property holds the reading direction of the text for vertical progress bars.
 int value()
          This property holds the progress bar's current value.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, graphicsProxyWidget, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

valueChanged

public final QSignalEmitter.Signal1 valueChanged

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: value)>:

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

Constructor Detail

QProgressBar

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


QProgressBar

public QProgressBar(QWidget parent)
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().

Method Detail

alignment

public final Qt.Alignment alignment()
This property holds the alignment of the progress bar.


format

public final java.lang.String format()
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().


invertedAppearance

public final boolean invertedAppearance()
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.

See also:
orientation, and layoutDirection.


isTextVisible

public final boolean isTextVisible()
This property holds whether the current completed percentage should be displayed.

See also:
textDirection.


maximum

public final int maximum()
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().


minimum

public final int minimum()
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().


orientation

public final Qt.Orientation orientation()
This property holds the orientation of the progress bar. The orientation must be Qt::Horizontal (the default) or Qt::Vertical .

See also:
invertedAppearance, and textDirection.


reset

public final void reset()
Reset the progress bar. The progress bar "rewinds" and shows no progress.


setAlignment

public final void setAlignment(Qt.AlignmentFlag[] alignment)
This is an overloaded method provided for convenience.


setAlignment

public final void setAlignment(Qt.Alignment alignment)
This property holds the alignment of the progress bar.


setFormat

public final void setFormat(java.lang.String format)
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().


setInvertedAppearance

public final void setInvertedAppearance(boolean invert)
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.

See also:
orientation, and layoutDirection.


setMaximum

public final void setMaximum(int maximum)
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().


setMinimum

public final void setMinimum(int minimum)
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().


setOrientation

public final void setOrientation(Qt.Orientation arg__1)
This property holds the orientation of the progress bar. The orientation must be Qt::Horizontal (the default) or Qt::Vertical .

See also:
invertedAppearance, and textDirection.


setRange

public final void setRange(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.


setTextDirection

public final void setTextDirection(QProgressBar.Direction textDirection)
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 QProgressBar::TopToBottom .

See also:
orientation, and textVisible.


setTextVisible

public final void setTextVisible(boolean visible)
This property holds whether the current completed percentage should be displayed.

See also:
textDirection.


setValue

public final void setValue(int value)
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.


textDirection

public final QProgressBar.Direction textDirection()
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 QProgressBar::TopToBottom .

See also:
orientation, and textVisible.


value

public final int value()
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.


text

public java.lang.String text()
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.


initStyleOption

protected final void initStyleOption(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.