qprogressdialog man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



QProgressDialog(3qt)			     QProgressDialog(3qt)

NAME
       QProgressDialog - Provides feedback on the progress of a
       slow operation

       #include <qprogressdialog.h>

       Inherits QSemiModal.

   Public Members
       QProgressDialog ( QWidget * parent=0, const char * name=0,
	   bool modal=FALSE, WFlags f=0 )
       QProgressDialog ( const QString & labelText, const QString
	   & cancelButtonText, int totalSteps, QWidget *
	   parent=0, const char * name=0, bool modal=FALSE,
	   WFlags f=0 )
       ~QProgressDialog ()
       void setLabel ( QLabel * )
       void setCancelButton ( QPushButton * )
       void setBar ( QProgressBar * )
       bool wasCancelled () const
       int totalSteps () const
       int progress () const
       virtual QSize sizeHint () const
       QString labelText () const
       void setAutoReset ( bool b )
       bool autoReset () const
       void setAutoClose ( bool b )
       bool autoClose () const
       int minimumDuration () const

   Public Slots
       void cancel ()
       void reset ()
       void setTotalSteps ( int totalSteps )
       void setProgress ( int progress )
       void setLabelText ( const QString & )
       void setCancelButtonText ( const QString & )
       void setMinimumDuration ( int ms )

   Signals
       void cancelled ()

   Protected Slots
       void forceShow ()

   Properties
       Type	 Name		READ	       WRITE	       Options
       ----------------------------------------------------------------
       bool	 wasCancelled	wasCancelled
       int	 totalSteps	totalSteps     setTotalSteps
       int	 progress	progress       setProgress
       bool	 autoReset	autoReset      setAutoReset

Trolltech AS		   13 June 2001				1

QProgressDialog(3qt)			     QProgressDialog(3qt)

       bool	 autoClose	autoClose      setAutoClose
       QString	 labelText	labelText      setLabelText

DESCRIPTION
       Provides feedback on the progress of a slow operation.

       A progress dialog is used to give the user an indication
       of how long an operation is going to take to perform, and
       to reassure them that the application has not frozen. It
       also gives the user an opportunity to abort the operation.

       A potential problem with progress dialogs is that it is
       difficult to know when to use them, as operations take
       different amounts of time on different computer hardware.
       QProgressDialog offers a solution to this problem: it
       estimates the time the operation will take (based on time
       for steps), and only shows itself if that estimate is
       beyond minimumDuration() (4 seconds by default).

       Use setTotalSteps() (or the constructor) to set the number
       of" steps" in the operation and call setProgress() as the
       operation progresses. The step value can be chosen
       arbitrarily. It can be eg. the number of files copied, the
       number of bytes received, or the number of iterations
       through the main loop of your algorithm. You must call
       setProgress() with parameter 0 initially, and with
       parameter totalSteps() at the end.

       The dialog will automatically be reset and hidden at the
       end of the operation, Use setAutoReset() and
       setAutoClose() to change this behavior.

       There are two ways of using QProgressDialog, modal and
       non-modal.

       Using a modal QProgressDialog is simpler for the
       programmer, but you have to call qApp->processEvents() to
       keep the event loop running and prevent the application
       from freezing. Do the operation in a loop, calling
       setProgress() at intervals, and checking for cancellation
       with wasCancelled().

       Example:

	   QProgressDialog progress( "Copying files...", "Abort Copy", numFiles,
				       this, "progress", TRUE );
	   for (int i=0; i<numFiles; i++) {
	       progress.setProgress( i );
	       qApp->processEvents();
	       if ( progress.wasCancelled() )
		   break;
	       ... // copy one file
	   }

Trolltech AS		   13 June 2001				2

QProgressDialog(3qt)			     QProgressDialog(3qt)

	   progress.setProgress( numFiles );

       A non-modal progress dialog is suitable for operations
       that take place in the background, where the user is able
       to interact with the application. Such operations are
       typically based on QTimer (or QObject::timerEvent()),
       QSocketNotifier, or QUrlOperator; or performed in a
       separate thread. A QProgressBar in the status bar of your
       main window is often an alternative to a non-modal
       progress dialog.

       You need an event loop to be running. Connect the
       cancelled() signal to a slot that stops the operation, and
       call setProgress() at intervals.

       Example:

	 Operation::Operation( QObject *parent = 0 )
	     : QObject( parent ), steps(0)
	 {
	     pd = new QProgressDialog( "Operation in progress.", "Cancel", 100 );
	     connect( pd, SIGNAL(cancelled()), this, SLOT(cancel()) );
	     t = new QTimer( this );
	     connect( t, SIGNAL(timeout()), this, SLOT(perform()) );
	     t->start(0);
	 }
	 void Operation::perform()
	 {
	     pd->setProgress( steps );
	     ...       //perform one percent of the operation
	     steps++;
	     if ( steps > pd->totalSteps() )
		       t->stop();
	 }
	 void Operation::cancel()
	 {
	     t->stop();
	     ...       //cleanup
	 }

       In both modes, the progress dialog may be customized by
       replacing the child widgets with custom widgets, using
       setLabel(), setBar() and setCancelButton(). The functions
       setLabelText() and setCancelButtonText() sets the texts
       shown.

			    [Image Omitted]

			    [Image Omitted]

       See also QDialog, QProgressBar and GUI Design Handbook:
       Progress Indicator

Trolltech AS		   13 June 2001				3

QProgressDialog(3qt)			     QProgressDialog(3qt)

       Examples: progress/progress.cpp

MEMBER FUNCTION DOCUMENTATION
QProgressDialog::QProgressDialog ( QWidget * creator=0, const
       char * name=0, bool modal=FALSE, WFlags f=0 )
       Constructs a progress dialog.

       Default settings:

       The label text is empty.

       The cancel button text is "Cancel".

       The total number of steps is 100.

       parent, name, modal, and f are sent to the
       QSemiModal::QSemiModal() constructor. Note that if modal
       is FALSE (the default), you will need to have an event
       loop proceeding for any redrawing of the dialog to occur.
       If it is TRUE, the dialog ensures events are processed
       when needed.

       See also setLabelText(), setLabel(),
       setCancelButtonText(), setCancelButton() and
       setTotalSteps().

QProgressDialog::QProgressDialog ( const QString & labelText,
       const QString & cancelButtonText, int totalSteps, QWidget
       * creator=0, const char * name=0, bool modal=FALSE, WFlags
       f=0 )
       Constructs a progress dialog.

       labelText is text telling the user what is progressing.

       cancelButtonText is the text on the cancel button, or 0 if
       no cancel button is to be shown.

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

       name, modal, and f are sent to the
       QSemiModal::QSemiModal() constructor. Note that if modal
       is FALSE (the default), you will need to have an event
       loop proceeding for any redrawing of the dialog to occur.
       If it is TRUE, the dialog ensures events are processed
       when needed.

       See also setLabelText(), setLabel(),
       setCancelButtonText(), setCancelButton() and
       setTotalSteps().

Trolltech AS		   13 June 2001				4

QProgressDialog(3qt)			     QProgressDialog(3qt)

QProgressDialog::~QProgressDialog ()
       Destructs the progress dialog.

bool QProgressDialog::autoClose () const
       Returns if the dialog gets hidden by reset().

       See also setAutoClose().

bool QProgressDialog::autoReset () const
       Returns if the dialog resets itself when progress() equals
       totalSteps().

       See also setAutoReset().

void QProgressDialog::cancel () [slot]
       Reset the progress dialog. wasCancelled() becomes TRUE
       until the progress dialog is reset. The progress dialog
       becomes hidden.

void QProgressDialog::cancelled () [signal]
       This signal is emitted when the cancel button is clicked.
       It is connected to the cancel() slot by default.

       See also wasCancelled().

void QProgressDialog::closeEvent ( QCloseEvent * e ) [virtual
       protected]
       Reimplemented for internal reasons; the API is not
       affected.

       Reimplemented from QWidget.

void QProgressDialog::forceShow () [protected slot]
       Shows the dialog if it is still hidden after the algorithm
       has been started and the minimumDuration is over.

       See also setMinimumDuration().

QString QProgressDialog::labelText () const
       Returns the labels text.

       See also setLabelText.

int QProgressDialog::minimumDuration () const
       Returns the currently set minimum duration for the
       QProgressDialog

       See also setMinimumDuration().

int QProgressDialog::progress () const
       Returns the current amount of progress, or -1 if the
       progress counting has not started.

       See also setProgress().

Trolltech AS		   13 June 2001				5

QProgressDialog(3qt)			     QProgressDialog(3qt)

void QProgressDialog::reset () [slot]
       Reset the progress dialog. The progress dialog becomes
       hidden if autoClose() is TRUE.

       See also setAutoClose() and setAutoReset().

void QProgressDialog::resizeEvent ( QResizeEvent * ) [virtual
       protected]
       Reimplemented for internal reasons; the API is not
       affected.

       Reimplemented from QWidget.

void QProgressDialog::setAutoClose ( bool b )
       If you set b to TRUE, the dialog gets closed (hidden) if
       reset() is called, else this does not happen.

       See also autoClose() and setAutoReset().

void QProgressDialog::setAutoReset ( bool b )
       If you set b to TRUE, the progress dialog calls reset() if
       progress() equals totalSteps(), if you set it to FALSE,
       this does not happen.

       See also autoReset() and setAutoClose().

void QProgressDialog::setBar ( QProgressBar * bar )
       Sets the progress bar widget. The progress dialog resizes
       to fit. The progress bar becomes owned by the progress
       dialog and will be deleted when necessary.

void QProgressDialog::setCancelButton ( QPushButton *
       cancelButton )
       Sets the cancellation button. The button becomes owned by
       the progress dialog and will be deleted when necessary, so
       do not pass the address of an object on the stack.

       See also setCancelButtonText().

void QProgressDialog::setCancelButtonText ( const QString &
       cancelButtonText ) [slot]
       Sets the cancellation button text.

       See also setCancelButton().

void QProgressDialog::setLabel ( QLabel * label )
       Sets the label. The progress dialog resizes to fit. The
       label becomes owned by the progress dialog and will be
       deleted when necessary, so do not pass the address of an
       object on the stack.

       See also setLabelText().

       Examples: progress/progress.cpp

Trolltech AS		   13 June 2001				6

QProgressDialog(3qt)			     QProgressDialog(3qt)

void QProgressDialog::setLabelText ( const QString & text )
       [slot]
       Sets the label text. The progress dialog resizes to fit.

       See also setLabel().

void QProgressDialog::setMinimumDuration ( int ms ) [slot]
       Sets the minimum duration to ms milliseconds. The dialog
       will not appear if the anticipated duration of the
       progressing task is less than the minimum duration.

       If ms is 0 the dialog is always shown as soon as any
       progress is set.

       See also minimumDuration().

       Examples: progress/progress.cpp

void QProgressDialog::setProgress ( int progress ) [slot]
       Sets the current amount of progress made to prog units of
       the total number of steps. For the progress dialog to work
       correctly, you must at least call this with the parameter
       0 initially, then later with
       QProgressDialog::totalSteps(), and you may call it any
       number of times in between.

       Warning: If the progress dialog is modal (see
       QProgressDialog::QProgressDialog()), this function calls
       QApplication::processEvents(), so take care that this does
       not cause undesirable re-entrancy to your code. For
       example, don't use a QProgressDialog inside a
       paintEvent()!

       See also progress().

       Examples: progress/progress.cpp

void QProgressDialog::setTotalSteps ( int totalSteps ) [slot]
       Sets the total number of steps.

       See also totalSteps() and QProgressBar::setTotalSteps().

void QProgressDialog::showEvent ( QShowEvent * e ) [virtual
       protected]
       Reimplemented for internal reasons; the API is not
       affected.

       Reimplemented from QWidget.

QSize QProgressDialog::sizeHint () const [virtual]
       Returns a size which fits the contents of the progress
       dialog. The progress dialog resizes itself as required, so
       this should not be needed in user code.

Trolltech AS		   13 June 2001				7

QProgressDialog(3qt)			     QProgressDialog(3qt)

       Reimplemented from QWidget.

void QProgressDialog::styleChange ( QStyle & s ) [virtual
       protected]
       Reimplemented for internal reasons; the API is not
       affected.

       Reimplemented from QWidget.

int QProgressDialog::totalSteps () const
       Returns the total number of steps.

       See also setTotalSteps() and QProgressBar::totalSteps().

       Examples: progress/progress.cpp

bool QProgressDialog::wasCancelled () const
       Returns the TRUE if the dialog was cancelled, otherwise
       FALSE.

       See also setProgress(), cancel() and cancelled().

       Examples: progress/progress.cpp

SEE ALSO
       http://doc.trolltech.com/qprogressdialog.html
       http://www.trolltech.com/faq/tech.html

COPYRIGHT
       Copyright 1992-2001 Trolltech AS,
       http://www.trolltech.com.  See the license file included
       in the distribution for a complete license statement.

AUTHOR
       Generated automatically from the source code.

BUGS
       If you find a bug in Qt, please report it as described in
       http://doc.trolltech.com/bughowto.html.	Good bug reports
       make our job much simpler. Thank you.

       In case of content or formattting problems with this
       manual page, please report them to qt-bugs@trolltech.com.
       Please include the name of the manual page
       (qprogressdialog.3qt) and the Qt version (2.3.1).

Trolltech AS		   13 June 2001				8

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net