You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
410 lines
25 KiB
410 lines
25 KiB
14 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/dialogs/qprogressdialog.cpp:99 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QProgressDialog Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QProgressDialog Class Reference</h1>
|
||
|
|
||
|
<p>The QProgressDialog class provides feedback on the progress of a slow operation.
|
||
|
<a href="#details">More...</a>
|
||
|
<p><tt>#include <<a href="qprogressdialog-h.html">qprogressdialog.h</a>></tt>
|
||
|
<p>Inherits <a href="qdialog.html">QDialog</a>.
|
||
|
<p><a href="qprogressdialog-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#QProgressDialog"><b>QProgressDialog</b></a> ( QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )</li>
|
||
|
<li class=fn><a href="#QProgressDialog-2"><b>QProgressDialog</b></a> ( const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )</li>
|
||
|
<li class=fn><a href="#~QProgressDialog"><b>~QProgressDialog</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#setLabel"><b>setLabel</b></a> ( QLabel * label )</li>
|
||
|
<li class=fn>void <a href="#setCancelButton"><b>setCancelButton</b></a> ( QPushButton * cancelButton )</li>
|
||
|
<li class=fn>void <a href="#setBar"><b>setBar</b></a> ( QProgressBar * bar )</li>
|
||
|
<li class=fn>bool wasCancelled () const <em>(obsolete)</em></li>
|
||
|
<li class=fn>bool <a href="#wasCanceled"><b>wasCanceled</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#totalSteps"><b>totalSteps</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#progress"><b>progress</b></a> () const</li>
|
||
|
<li class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</li>
|
||
|
<li class=fn>QString <a href="#labelText"><b>labelText</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setAutoReset"><b>setAutoReset</b></a> ( bool b )</li>
|
||
|
<li class=fn>bool <a href="#autoReset"><b>autoReset</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setAutoClose"><b>setAutoClose</b></a> ( bool b )</li>
|
||
|
<li class=fn>bool <a href="#autoClose"><b>autoClose</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#minimumDuration"><b>minimumDuration</b></a> () const</li>
|
||
|
</ul>
|
||
|
<h2>Public Slots</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#cancel"><b>cancel</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#setTotalSteps"><b>setTotalSteps</b></a> ( int totalSteps )</li>
|
||
|
<li class=fn>void <a href="#setProgress"><b>setProgress</b></a> ( int progress )</li>
|
||
|
<li class=fn>void <a href="#setProgress-2"><b>setProgress</b></a> ( int progress, int totalSteps )</li>
|
||
|
<li class=fn>void <a href="#setLabelText"><b>setLabelText</b></a> ( const QString & )</li>
|
||
|
<li class=fn>void <a href="#setCancelButtonText"><b>setCancelButtonText</b></a> ( const QString & cancelButtonText )</li>
|
||
|
<li class=fn>void <a href="#setMinimumDuration"><b>setMinimumDuration</b></a> ( int ms )</li>
|
||
|
</ul>
|
||
|
<h2>Signals</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void cancelled () <em>(obsolete)</em></li>
|
||
|
<li class=fn>void <a href="#canceled"><b>canceled</b></a> ()</li>
|
||
|
</ul>
|
||
|
<h2>Properties</h2>
|
||
|
<ul>
|
||
|
<li class=fn>bool <a href="#autoClose-prop"><b>autoClose</b></a> - whether the dialog gets hidden by reset()</li>
|
||
|
<li class=fn>bool <a href="#autoReset-prop"><b>autoReset</b></a> - whether the progress dialog calls reset() as soon as progress() equals totalSteps()</li>
|
||
|
<li class=fn>QString <a href="#labelText-prop"><b>labelText</b></a> - the label's text</li>
|
||
|
<li class=fn>int <a href="#minimumDuration-prop"><b>minimumDuration</b></a> - the time that must pass before the dialog appears</li>
|
||
|
<li class=fn>int <a href="#progress-prop"><b>progress</b></a> - the current amount of progress made</li>
|
||
|
<li class=fn>int <a href="#totalSteps-prop"><b>totalSteps</b></a> - the total number of steps</li>
|
||
|
<li class=fn>bool <a href="#wasCanceled-prop"><b>wasCanceled</b></a> - whether the dialog was canceled <em>(read only)</em></li>
|
||
|
<li class=fn>bool wasCancelled - whether the dialog was canceled <em>(read only)</em> <em>(obsolete)</em></li>
|
||
|
</ul>
|
||
|
<h2>Protected Slots</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#forceShow"><b>forceShow</b></a> ()</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The QProgressDialog class provides feedback on the progress of a slow operation.
|
||
|
|
||
|
|
||
|
<p> A progress dialog is used to give the user an indication of how long
|
||
|
an operation is going to take, and to demonstrate that the
|
||
|
application has not frozen. It can also give the user an opportunity
|
||
|
to abort the operation.
|
||
|
<p> A common problem with progress dialogs is that it is difficult to know
|
||
|
when to use them; operations take different amounts of time on different
|
||
|
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 <a href="#minimumDuration">minimumDuration</a>()
|
||
|
(4 seconds by default).
|
||
|
<p> Use <a href="#setTotalSteps">setTotalSteps</a>() (or the constructor) to set the number of
|
||
|
"steps" in the operation and call <a href="#setProgress">setProgress</a>() as the operation
|
||
|
progresses. The step value can be chosen arbitrarily. It can be the
|
||
|
number of files copied, the number of bytes received, the number of
|
||
|
iterations through the main loop of your algorithm, or some other
|
||
|
suitable unit. Progress starts at 0, and the progress dialog shows
|
||
|
that the operation has finished when you call setProgress() with
|
||
|
<a href="#totalSteps">totalSteps</a>() as its argument.
|
||
|
<p> The dialog automatically resets and hides itself at the end of the
|
||
|
operation. Use <a href="#setAutoReset">setAutoReset</a>() and <a href="#setAutoClose">setAutoClose</a>() to change this
|
||
|
behavior.
|
||
|
<p> There are two ways of using QProgressDialog: modal and modeless.
|
||
|
<p> Using a modal QProgressDialog is simpler for the programmer, but you
|
||
|
must call <a href="qapplication.html#processEvents">QApplication::processEvents</a>() or
|
||
|
<a href="qeventloop.html#processEvents">QEventLoop::processEvents</a>(ExcludeUserInput) to keep the event loop
|
||
|
running to ensure that the application doesn't freeze. Do the
|
||
|
operation in a loop, call <a href="#setProgress">setProgress</a>() at intervals, and check
|
||
|
for cancellation with <a href="#wasCanceled">wasCanceled</a>(). For example:
|
||
|
<pre>
|
||
|
QProgressDialog progress( "Copying files...", "Abort Copy", numFiles,
|
||
|
this, "progress", TRUE );
|
||
|
for ( int i = 0; i < numFiles; i++ ) {
|
||
|
progress.setProgress( i );
|
||
|
qApp-><a href="qapplication.html#processEvents">processEvents</a>();
|
||
|
|
||
|
if ( progress.wasCanceled() )
|
||
|
break;
|
||
|
//... copy one file
|
||
|
}
|
||
|
progress.setProgress( numFiles );
|
||
|
</pre>
|
||
|
|
||
|
<p> A modeless 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 <a href="qtimer.html">QTimer</a> (or
|
||
|
<a href="qobject.html#timerEvent">QObject::timerEvent</a>()), <a href="qsocketnotifier.html">QSocketNotifier</a>, or <a href="qurloperator.html">QUrlOperator</a>; or performed
|
||
|
in a separate thread. A <a href="qprogressbar.html">QProgressBar</a> in the status bar of your main window
|
||
|
is often an alternative to a modeless progress dialog.
|
||
|
<p> You need to have an event loop to be running, connect the
|
||
|
<a href="#canceled">canceled</a>() signal to a slot that stops the operation, and call <a href="#setProgress">setProgress</a>() at intervals. For example:
|
||
|
<pre>
|
||
|
Operation::Operation( <a href="qobject.html">QObject</a> *parent = 0 )
|
||
|
: <a href="qobject.html">QObject</a>( parent ), steps( 0 )
|
||
|
{
|
||
|
pd = new QProgressDialog( "Operation in progress.", "Cancel", 100 );
|
||
|
<a href="qobject.html#connect">connect</a>( pd, SIGNAL(<a href="#canceled">canceled</a>()), this, SLOT(<a href="#cancel">cancel</a>()) );
|
||
|
t = new <a href="qtimer.html">QTimer</a>( this );
|
||
|
<a href="qobject.html#connect">connect</a>( t, SIGNAL(<a href="qtimer.html#timeout">timeout</a>()), this, SLOT(perform()) );
|
||
|
t-><a href="qtimer.html#start">start</a>( 0 );
|
||
|
}
|
||
|
|
||
|
void Operation::perform()
|
||
|
{
|
||
|
pd-><a href="#setProgress">setProgress</a>( steps );
|
||
|
//... perform one percent of the operation
|
||
|
steps++;
|
||
|
if ( steps > pd-><a href="#totalSteps">totalSteps</a>() )
|
||
|
t-><a href="qtimer.html#stop">stop</a>();
|
||
|
}
|
||
|
|
||
|
void Operation::cancel()
|
||
|
{
|
||
|
t-><a href="qtimer.html#stop">stop</a>();
|
||
|
//... cleanup
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p> In both modes the progress dialog may be customized by
|
||
|
replacing the child widgets with custom widgets by using <a href="#setLabel">setLabel</a>(),
|
||
|
<a href="#setBar">setBar</a>(), and <a href="#setCancelButton">setCancelButton</a>().
|
||
|
The functions <a href="#setLabelText">setLabelText</a>() and <a href="#setCancelButtonText">setCancelButtonText</a>()
|
||
|
set the texts shown.
|
||
|
<p> <img src=qprogdlg-m.png> <img src=qprogdlg-w.png>
|
||
|
<p> <p>See also <a href="qdialog.html">QDialog</a>, <a href="qprogressbar.html">QProgressBar</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Progress Indicator</a>, and <a href="dialogs.html">Dialog Classes</a>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="QProgressDialog"></a>QProgressDialog::QProgressDialog ( <a href="qwidget.html">QWidget</a> * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )
|
||
|
</h3>
|
||
|
Constructs a progress dialog.
|
||
|
<p> Default settings:
|
||
|
<ul>
|
||
|
<li> The label text is empty.
|
||
|
<li> The cancel button text is (translated) "Cancel".
|
||
|
<li> The total number of steps is 100.
|
||
|
</ul>
|
||
|
<p> The <em>creator</em> argument is the widget to use as the dialog's parent.
|
||
|
The <em>name</em>, <em>modal</em>, and the widget flags, <em>f</em>, are
|
||
|
passed to the <a href="qdialog.html#QDialog">QDialog::QDialog</a>() constructor. If <em>modal</em> is FALSE (the
|
||
|
default), you must have an event loop proceeding for any redrawing
|
||
|
of the dialog to occur. If <em>modal</em> is TRUE, the dialog ensures that
|
||
|
events are processed when needed.
|
||
|
<p> <p>See also <a href="#labelText-prop">labelText</a>, <a href="#setLabel">setLabel</a>(), <a href="#setCancelButtonText">setCancelButtonText</a>(), <a href="#setCancelButton">setCancelButton</a>(), and <a href="#totalSteps-prop">totalSteps</a>.
|
||
|
|
||
|
<h3 class=fn><a name="QProgressDialog-2"></a>QProgressDialog::QProgressDialog ( const <a href="qstring.html">QString</a> & labelText, const <a href="qstring.html">QString</a> & cancelButtonText, int totalSteps, <a href="qwidget.html">QWidget</a> * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )
|
||
|
</h3>
|
||
|
Constructs a progress dialog.
|
||
|
<p> The <em>labelText</em> is text used to remind the user what is progressing.
|
||
|
<p> The <em>cancelButtonText</em> is the text to display on the cancel button,
|
||
|
or 0 if no cancel button is to be shown.
|
||
|
<p> The <em>totalSteps</em> is the total number of steps in the operation for
|
||
|
which this progress dialog shows progress. For example, if the
|
||
|
operation is to examine 50 files, this value would be 50. Before
|
||
|
examining the first file, call <a href="#setProgress">setProgress</a>(0). As each file is
|
||
|
processed call setProgress(1), setProgress(2), etc., finally
|
||
|
calling setProgress(50) after examining the last file.
|
||
|
<p> The <em>creator</em> argument is the widget to use as the dialog's parent.
|
||
|
The <em>name</em>, <em>modal</em>, and widget flags, <em>f</em>, are passed to the
|
||
|
<a href="qdialog.html#QDialog">QDialog::QDialog</a>() constructor. If <em>modal</em> is FALSE (the default),
|
||
|
you will must have an event loop proceeding for any redrawing of
|
||
|
the dialog to occur. If <em>modal</em> is TRUE, the dialog ensures that
|
||
|
events are processed when needed.
|
||
|
<p> <p>See also <a href="#labelText-prop">labelText</a>, <a href="#setLabel">setLabel</a>(), <a href="#setCancelButtonText">setCancelButtonText</a>(), <a href="#setCancelButton">setCancelButton</a>(), and <a href="#totalSteps-prop">totalSteps</a>.
|
||
|
|
||
|
<h3 class=fn><a name="~QProgressDialog"></a>QProgressDialog::~QProgressDialog ()
|
||
|
</h3>
|
||
|
Destroys the progress dialog.
|
||
|
|
||
|
<h3 class=fn>bool <a name="autoClose"></a>QProgressDialog::autoClose () const
|
||
|
</h3><p>Returns TRUE if the dialog gets hidden by <a href="#reset">reset</a>(); otherwise returns FALSE.
|
||
|
See the <a href="qprogressdialog.html#autoClose-prop">"autoClose"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="autoReset"></a>QProgressDialog::autoReset () const
|
||
|
</h3><p>Returns TRUE if the progress dialog calls <a href="#reset">reset</a>() as soon as <a href="#progress">progress</a>() equals <a href="#totalSteps">totalSteps</a>(); otherwise returns FALSE.
|
||
|
See the <a href="qprogressdialog.html#autoReset-prop">"autoReset"</a> property for details.
|
||
|
<h3 class=fn>void <a name="cancel"></a>QProgressDialog::cancel ()<tt> [slot]</tt>
|
||
|
</h3>
|
||
|
Resets the progress dialog. <a href="#wasCanceled">wasCanceled</a>() becomes TRUE until
|
||
|
the progress dialog is reset.
|
||
|
The progress dialog becomes hidden.
|
||
|
|
||
|
<h3 class=fn>void <a name="canceled"></a>QProgressDialog::canceled ()<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when the cancel button is clicked.
|
||
|
It is connected to the <a href="#cancel">cancel</a>() slot by default.
|
||
|
<p> <p>See also <a href="#wasCanceled-prop">wasCanceled</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="cancelled"></a>QProgressDialog::cancelled ()<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
<p> Use <a href="#canceled">canceled</a>() instead.
|
||
|
|
||
|
<p>Examples: <a href="ftpclient-example.html#x768">network/ftpclient/ftpmainwindow.ui.h</a> and <a href="progress-example.html#x82">progress/progress.cpp</a>.
|
||
|
<h3 class=fn>void <a name="forceShow"></a>QProgressDialog::forceShow ()<tt> [protected slot]</tt>
|
||
|
</h3>
|
||
|
Shows the dialog if it is still hidden after the algorithm has been started
|
||
|
and minimumDuration milliseconds have passed.
|
||
|
<p> <p>See also <a href="#minimumDuration-prop">minimumDuration</a>.
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="labelText"></a>QProgressDialog::labelText () const
|
||
|
</h3><p>Returns the label's text.
|
||
|
See the <a href="qprogressdialog.html#labelText-prop">"labelText"</a> property for details.
|
||
|
<h3 class=fn>int <a name="minimumDuration"></a>QProgressDialog::minimumDuration () const
|
||
|
</h3><p>Returns the time that must pass before the dialog appears.
|
||
|
See the <a href="qprogressdialog.html#minimumDuration-prop">"minimumDuration"</a> property for details.
|
||
|
<h3 class=fn>int <a name="progress"></a>QProgressDialog::progress () const
|
||
|
</h3><p>Returns the current amount of progress made.
|
||
|
See the <a href="qprogressdialog.html#progress-prop">"progress"</a> property for details.
|
||
|
<h3 class=fn>void <a name="reset"></a>QProgressDialog::reset ()<tt> [slot]</tt>
|
||
|
</h3>
|
||
|
Resets the progress dialog.
|
||
|
The progress dialog becomes hidden if <a href="#autoClose">autoClose</a>() is TRUE.
|
||
|
<p> <p>See also <a href="#autoClose-prop">autoClose</a> and <a href="#autoReset-prop">autoReset</a>.
|
||
|
|
||
|
<p>Example: <a href="ftpclient-example.html#x769">network/ftpclient/ftpmainwindow.ui.h</a>.
|
||
|
<h3 class=fn>void <a name="setAutoClose"></a>QProgressDialog::setAutoClose ( bool b )
|
||
|
</h3><p>Sets whether the dialog gets hidden by <a href="#reset">reset</a>() to <em>b</em>.
|
||
|
See the <a href="qprogressdialog.html#autoClose-prop">"autoClose"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setAutoReset"></a>QProgressDialog::setAutoReset ( bool b )
|
||
|
</h3><p>Sets whether the progress dialog calls <a href="#reset">reset</a>() as soon as <a href="#progress">progress</a>() equals <a href="#totalSteps">totalSteps</a>() to <em>b</em>.
|
||
|
See the <a href="qprogressdialog.html#autoReset-prop">"autoReset"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setBar"></a>QProgressDialog::setBar ( <a href="qprogressbar.html">QProgressBar</a> * bar )
|
||
|
</h3>
|
||
|
Sets the progress bar widget to <em>bar</em>. The progress dialog resizes to
|
||
|
fit. The progress dialog takes ownership of the progress <em>bar</em> which
|
||
|
will be deleted when necessary, so do not use a progress bar
|
||
|
allocated on the stack.
|
||
|
|
||
|
<h3 class=fn>void <a name="setCancelButton"></a>QProgressDialog::setCancelButton ( <a href="qpushbutton.html">QPushButton</a> * cancelButton )
|
||
|
</h3>
|
||
|
Sets the cancel button to the push button, <em>cancelButton</em>. The
|
||
|
progress dialog takes ownership of this button which will be deleted
|
||
|
when necessary, so do not pass the address of an object that is on
|
||
|
the stack, i.e. use new() to create the button.
|
||
|
<p> <p>See also <a href="#setCancelButtonText">setCancelButtonText</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setCancelButtonText"></a>QProgressDialog::setCancelButtonText ( const <a href="qstring.html">QString</a> & cancelButtonText )<tt> [slot]</tt>
|
||
|
</h3>
|
||
|
Sets the cancel button's text to <em>cancelButtonText</em>.
|
||
|
<p>See also <a href="#setCancelButton">setCancelButton</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setLabel"></a>QProgressDialog::setLabel ( <a href="qlabel.html">QLabel</a> * label )
|
||
|
</h3>
|
||
|
Sets the label to <em>label</em>. 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.
|
||
|
<p> <p>See also <a href="#labelText-prop">labelText</a>.
|
||
|
|
||
|
<p>Example: <a href="progress-example.html#x83">progress/progress.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setLabelText"></a>QProgressDialog::setLabelText ( const <a href="qstring.html">QString</a> & )<tt> [slot]</tt>
|
||
|
</h3><p>Sets the label's text.
|
||
|
See the <a href="qprogressdialog.html#labelText-prop">"labelText"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setMinimumDuration"></a>QProgressDialog::setMinimumDuration ( int ms )<tt> [slot]</tt>
|
||
|
</h3><p>Sets the time that must pass before the dialog appears to <em>ms</em>.
|
||
|
See the <a href="qprogressdialog.html#minimumDuration-prop">"minimumDuration"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setProgress"></a>QProgressDialog::setProgress ( int progress )<tt> [slot]</tt>
|
||
|
</h3><p>Sets the current amount of progress made to <em>progress</em>.
|
||
|
See the <a href="qprogressdialog.html#progress-prop">"progress"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setProgress-2"></a>QProgressDialog::setProgress ( int progress, int totalSteps )<tt> [slot]</tt>
|
||
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the current amount of progress to <em>progress</em> and the total number of
|
||
|
steps to <em>totalSteps</em>.
|
||
|
<p> <p>See also <a href="#totalSteps-prop">totalSteps</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="setTotalSteps"></a>QProgressDialog::setTotalSteps ( int totalSteps )<tt> [slot]</tt>
|
||
|
</h3><p>Sets the total number of steps to <em>totalSteps</em>.
|
||
|
See the <a href="qprogressdialog.html#totalSteps-prop">"totalSteps"</a> property for details.
|
||
|
<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QProgressDialog::sizeHint () const<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Returns a size that fits the contents of the progress dialog.
|
||
|
The progress dialog resizes itself as required, so you should not
|
||
|
need to call this yourself.
|
||
|
|
||
|
<h3 class=fn>int <a name="totalSteps"></a>QProgressDialog::totalSteps () const
|
||
|
</h3><p>Returns the total number of steps.
|
||
|
See the <a href="qprogressdialog.html#totalSteps-prop">"totalSteps"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="wasCanceled"></a>QProgressDialog::wasCanceled () const
|
||
|
</h3><p>Returns TRUE if the dialog was canceled; otherwise returns FALSE.
|
||
|
See the <a href="qprogressdialog.html#wasCanceled-prop">"wasCanceled"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="wasCancelled"></a>QProgressDialog::wasCancelled () const
|
||
|
</h3><p>Returns TRUE if the dialog was canceled; otherwise returns FALSE.
|
||
|
See the <a href="qprogressdialog.html#wasCancelled-prop">"wasCancelled"</a> property for details.
|
||
|
<hr><h2>Property Documentation</h2>
|
||
|
<h3 class=fn>bool <a name="autoClose-prop"></a>autoClose</h3>
|
||
|
<p>This property holds whether the dialog gets hidden by <a href="#reset">reset</a>().
|
||
|
<p>The default is TRUE.
|
||
|
<p> <p>See also <a href="#autoReset-prop">autoReset</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setAutoClose">setAutoClose</a>() and get this property's value with <a href="#autoClose">autoClose</a>().
|
||
|
<h3 class=fn>bool <a name="autoReset-prop"></a>autoReset</h3>
|
||
|
<p>This property holds whether the progress dialog calls <a href="#reset">reset</a>() as soon as <a href="#progress">progress</a>() equals <a href="#totalSteps">totalSteps</a>().
|
||
|
<p>The default is TRUE.
|
||
|
<p> <p>See also <a href="#autoClose-prop">autoClose</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setAutoReset">setAutoReset</a>() and get this property's value with <a href="#autoReset">autoReset</a>().
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="labelText-prop"></a>labelText</h3>
|
||
|
<p>This property holds the label's text.
|
||
|
<p>The default text is <a href="qstring.html#QString-null">QString::null</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setLabelText">setLabelText</a>() and get this property's value with <a href="#labelText">labelText</a>().
|
||
|
<h3 class=fn>int <a name="minimumDuration-prop"></a>minimumDuration</h3>
|
||
|
<p>This property holds the time that must pass before the dialog appears.
|
||
|
<p>If the expected duration of the task is less than the
|
||
|
minimumDuration, the dialog will not appear at all. This prevents
|
||
|
the dialog popping up for tasks that are quickly over. For tasks
|
||
|
that are expected to exceed the minimumDuration, the dialog will
|
||
|
pop up after the minimumDuration time or as soon as any progress
|
||
|
is set.
|
||
|
<p> If set to 0, the dialog is always shown as soon as any progress is
|
||
|
set. The default is 4000 milliseconds.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setMinimumDuration">setMinimumDuration</a>() and get this property's value with <a href="#minimumDuration">minimumDuration</a>().
|
||
|
<h3 class=fn>int <a name="progress-prop"></a>progress</h3>
|
||
|
<p>This property holds the current amount of progress made.
|
||
|
<p>For the progress dialog to work as expected, you should initially set
|
||
|
this property to 0 and finally set it to
|
||
|
<a href="#totalSteps">QProgressDialog::totalSteps</a>(); you can call <a href="#setProgress">setProgress</a>() any number of times
|
||
|
in-between.
|
||
|
<p> <b>Warning:</b> If the progress dialog is modal
|
||
|
(see <a href="#QProgressDialog">QProgressDialog::QProgressDialog</a>()),
|
||
|
this function calls <a href="qapplication.html#processEvents">QApplication::processEvents</a>(), so take care that
|
||
|
this does not cause undesirable re-entrancy in your code. For example,
|
||
|
don't use a QProgressDialog inside a <a href="qwidget.html#paintEvent">paintEvent</a>()!
|
||
|
<p> <p>See also <a href="#totalSteps-prop">totalSteps</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setProgress">setProgress</a>() and get this property's value with <a href="#progress">progress</a>().
|
||
|
<h3 class=fn>int <a name="totalSteps-prop"></a>totalSteps</h3>
|
||
|
<p>This property holds the total number of steps.
|
||
|
<p>The default is 0.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setTotalSteps">setTotalSteps</a>() and get this property's value with <a href="#totalSteps">totalSteps</a>().
|
||
|
<h3 class=fn>bool <a name="wasCanceled-prop"></a>wasCanceled</h3>
|
||
|
<p>This property holds whether the dialog was canceled.
|
||
|
<p>Get this property's value with <a href="#wasCanceled">wasCanceled</a>().
|
||
|
<p><p>See also <a href="#progress-prop">progress</a>.
|
||
|
|
||
|
<h3 class=fn>bool <a name="wasCancelled-prop"></a>wasCancelled</h3>
|
||
|
<p>This property holds whether the dialog was canceled.
|
||
|
<p><b>This property is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
<p> Use <a href="#wasCanceled-prop">wasCanceled</a> instead.
|
||
|
|
||
|
<p>Get this property's value with <a href="#wasCancelled">wasCancelled</a>().
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">Qt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|