Classes - Annotated - Tree - Functions - Home - Structure

QProgressBar Class Reference

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

#include <qprogressbar.h>

Inherits QFrame.

List of all member functions.

Public Members

Public Slots

Properties

Protected Members


Detailed Description

The QProgressBar widget provides a horizontal progress bar.

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

QProgressBar only implements the basic progress display, whereas QProgressDialog provides a fuller encapsulation.

See also QProgressDialog and GUI Design Handbook: Progress Indicator.


Member Function Documentation

QProgressBar::QProgressBar ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )

Constructs a progress bar.

The total number of steps is set to 100 by default.

parent, name and f are sent to the QFrame::QFrame() constructor.

See also totalSteps.

QProgressBar::QProgressBar ( int totalSteps, QWidget * parent = 0, const char * name = 0, WFlags f = 0 )

Constructs a progress bar.

totalSteps is the total number of steps in the operation of which this progress bar shows the progress. For example, if the operation is to examine 50 files, this value would be 50. Before examining the first file, call setProgress(0); call setProgress(50) after examining the last file .

parent, name and f are sent to the QFrame::QFrame() constructor.

See also totalSteps and progress.

bool QProgressBar::centerIndicator () const

Returns where the indicator string should be displayed. See the "centerIndicator" property for details.

bool QProgressBar::indicatorFollowsStyle () const

Returns TRUE if the display of the indicator string should follow the GUI style or not; otherwise returns FALSE. See the "indicatorFollowsStyle" property for details.

bool QProgressBar::percentageVisible () const

Returns TRUE if the current progress value is displayed or not; otherwise returns FALSE. See the "percentageVisible" property for details.

int QProgressBar::progress () const

Returns the current amount of progress. See the "progress" property for details.

const QString & QProgressBar::progressString () const

Returns the current amount of progress as a string. See the "progressString" property for details.

void QProgressBar::reset () [slot]

Reset the progress bar. The progress bar "rewinds."

Examples: fileiconview/mainwindow.cpp, network/ftpclient/ftpmainwindow.cpp and progressbar/progressbar.cpp.

void QProgressBar::setCenterIndicator ( bool on )

Sets where the indicator string should be displayed to on. See the "centerIndicator" property for details.

bool QProgressBar::setIndicator ( QString & indicator, int progress, int totalSteps ) [virtual protected]

This method is called to generate the text displayed in the center of the progress bar.

The progress may be negative, indicating that the bar is in the "reset" state before any progress is set.

The default implementation is the percentage of completion or blank in the reset state. The percentage is calculated based on the progress and totalSteps. You can set the indicator text if you wish.

To allow efficient repainting of the progress bar, this method should return FALSE if the string is unchanged from the last call to the function.

void QProgressBar::setIndicatorFollowsStyle ( bool )

Sets whether the display of the indicator string should follow the GUI style or not. See the "indicatorFollowsStyle" property for details.

void QProgressBar::setPercentageVisible ( bool )

Sets whether the current progress value is displayed or not. See the "percentageVisible" property for details.

void QProgressBar::setProgress ( int progress ) [virtual slot]

Sets the current amount of progress to progress. See the "progress" property for details.

void QProgressBar::setTotalSteps ( int totalSteps ) [virtual slot]

Sets the total number of steps to totalSteps. See the "totalSteps" property for details.

int QProgressBar::totalSteps () const

Returns the total number of steps. See the "totalSteps" property for details.


Property Documentation

bool centerIndicator

This property holds where the indicator string should be displayed.

If set to TRUE, the indicator is displayed centered. Changing this property sets indicatorFollowsStyle to FALSE.

See also indicatorFollowsStyle.

Set this property's value with setCenterIndicator() and get this property's value with centerIndicator().

bool indicatorFollowsStyle

This property holds whether the display of the indicator string should follow the GUI style or not.

Set this property's value with setIndicatorFollowsStyle() and get this property's value with indicatorFollowsStyle().

See also centerIndicator.

bool percentageVisible

This property holds whether the current progress value is displayed or not.

\se centerIndicator, indicatorFollowsStyle

Set this property's value with setPercentageVisible() and get this property's value with percentageVisible().

int progress

This property holds the current amount of progress.

This property is -1 if the progress counting has not started.

Set this property's value with setProgress() and get this property's value with progress().

QString progressString

This property holds the current amount of progress as a string.

This property is QString::null is the progress counting has not started.

Get this property's value with progressString().

int totalSteps

This property holds the total number of steps.

If totalSteps is null, the progress bar will display a busy indicator.

See also totalSteps.

Set this property's value with setTotalSteps() and get this property's value with totalSteps().


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.


Copyright © 2001 TrolltechTrademarks
Qt version 3.0.0-beta2