1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/dialogs/qprogressdialog.cpp:99 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QProgressDialog Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <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>
|
---|
33 |
|
---|
34 | <p>The QProgressDialog class provides feedback on the progress of a slow operation.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qprogressdialog-h.html">qprogressdialog.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qdialog.html">QDialog</a>.
|
---|
38 | <p><a href="qprogressdialog-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <li class=fn><a href="#QProgressDialog"><b>QProgressDialog</b></a> ( QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )</li>
|
---|
42 | <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>
|
---|
43 | <li class=fn><a href="#~QProgressDialog"><b>~QProgressDialog</b></a> ()</li>
|
---|
44 | <li class=fn>void <a href="#setLabel"><b>setLabel</b></a> ( QLabel * label )</li>
|
---|
45 | <li class=fn>void <a href="#setCancelButton"><b>setCancelButton</b></a> ( QPushButton * cancelButton )</li>
|
---|
46 | <li class=fn>void <a href="#setBar"><b>setBar</b></a> ( QProgressBar * bar )</li>
|
---|
47 | <li class=fn>bool wasCancelled () const <em>(obsolete)</em></li>
|
---|
48 | <li class=fn>bool <a href="#wasCanceled"><b>wasCanceled</b></a> () const</li>
|
---|
49 | <li class=fn>int <a href="#totalSteps"><b>totalSteps</b></a> () const</li>
|
---|
50 | <li class=fn>int <a href="#progress"><b>progress</b></a> () const</li>
|
---|
51 | <li class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</li>
|
---|
52 | <li class=fn>QString <a href="#labelText"><b>labelText</b></a> () const</li>
|
---|
53 | <li class=fn>void <a href="#setAutoReset"><b>setAutoReset</b></a> ( bool b )</li>
|
---|
54 | <li class=fn>bool <a href="#autoReset"><b>autoReset</b></a> () const</li>
|
---|
55 | <li class=fn>void <a href="#setAutoClose"><b>setAutoClose</b></a> ( bool b )</li>
|
---|
56 | <li class=fn>bool <a href="#autoClose"><b>autoClose</b></a> () const</li>
|
---|
57 | <li class=fn>int <a href="#minimumDuration"><b>minimumDuration</b></a> () const</li>
|
---|
58 | </ul>
|
---|
59 | <h2>Public Slots</h2>
|
---|
60 | <ul>
|
---|
61 | <li class=fn>void <a href="#cancel"><b>cancel</b></a> ()</li>
|
---|
62 | <li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
|
---|
63 | <li class=fn>void <a href="#setTotalSteps"><b>setTotalSteps</b></a> ( int totalSteps )</li>
|
---|
64 | <li class=fn>void <a href="#setProgress"><b>setProgress</b></a> ( int progress )</li>
|
---|
65 | <li class=fn>void <a href="#setProgress-2"><b>setProgress</b></a> ( int progress, int totalSteps )</li>
|
---|
66 | <li class=fn>void <a href="#setLabelText"><b>setLabelText</b></a> ( const QString & )</li>
|
---|
67 | <li class=fn>void <a href="#setCancelButtonText"><b>setCancelButtonText</b></a> ( const QString & cancelButtonText )</li>
|
---|
68 | <li class=fn>void <a href="#setMinimumDuration"><b>setMinimumDuration</b></a> ( int ms )</li>
|
---|
69 | </ul>
|
---|
70 | <h2>Signals</h2>
|
---|
71 | <ul>
|
---|
72 | <li class=fn>void cancelled () <em>(obsolete)</em></li>
|
---|
73 | <li class=fn>void <a href="#canceled"><b>canceled</b></a> ()</li>
|
---|
74 | </ul>
|
---|
75 | <h2>Properties</h2>
|
---|
76 | <ul>
|
---|
77 | <li class=fn>bool <a href="#autoClose-prop"><b>autoClose</b></a> - whether the dialog gets hidden by reset()</li>
|
---|
78 | <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>
|
---|
79 | <li class=fn>QString <a href="#labelText-prop"><b>labelText</b></a> - the label's text</li>
|
---|
80 | <li class=fn>int <a href="#minimumDuration-prop"><b>minimumDuration</b></a> - the time that must pass before the dialog appears</li>
|
---|
81 | <li class=fn>int <a href="#progress-prop"><b>progress</b></a> - the current amount of progress made</li>
|
---|
82 | <li class=fn>int <a href="#totalSteps-prop"><b>totalSteps</b></a> - the total number of steps</li>
|
---|
83 | <li class=fn>bool <a href="#wasCanceled-prop"><b>wasCanceled</b></a> - whether the dialog was canceled <em>(read only)</em></li>
|
---|
84 | <li class=fn>bool wasCancelled - whether the dialog was canceled <em>(read only)</em> <em>(obsolete)</em></li>
|
---|
85 | </ul>
|
---|
86 | <h2>Protected Slots</h2>
|
---|
87 | <ul>
|
---|
88 | <li class=fn>void <a href="#forceShow"><b>forceShow</b></a> ()</li>
|
---|
89 | </ul>
|
---|
90 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
91 |
|
---|
92 |
|
---|
93 | The QProgressDialog class provides feedback on the progress of a slow operation.
|
---|
94 |
|
---|
95 |
|
---|
96 | <p> A progress dialog is used to give the user an indication of how long
|
---|
97 | an operation is going to take, and to demonstrate that the
|
---|
98 | application has not frozen. It can also give the user an opportunity
|
---|
99 | to abort the operation.
|
---|
100 | <p> A common problem with progress dialogs is that it is difficult to know
|
---|
101 | when to use them; operations take different amounts of time on different
|
---|
102 | hardware. QProgressDialog offers a solution to this problem:
|
---|
103 | it estimates the time the operation will take (based on time for
|
---|
104 | steps), and only shows itself if that estimate is beyond <a href="#minimumDuration">minimumDuration</a>()
|
---|
105 | (4 seconds by default).
|
---|
106 | <p> Use <a href="#setTotalSteps">setTotalSteps</a>() (or the constructor) to set the number of
|
---|
107 | "steps" in the operation and call <a href="#setProgress">setProgress</a>() as the operation
|
---|
108 | progresses. The step value can be chosen arbitrarily. It can be the
|
---|
109 | number of files copied, the number of bytes received, the number of
|
---|
110 | iterations through the main loop of your algorithm, or some other
|
---|
111 | suitable unit. Progress starts at 0, and the progress dialog shows
|
---|
112 | that the operation has finished when you call setProgress() with
|
---|
113 | <a href="#totalSteps">totalSteps</a>() as its argument.
|
---|
114 | <p> The dialog automatically resets and hides itself at the end of the
|
---|
115 | operation. Use <a href="#setAutoReset">setAutoReset</a>() and <a href="#setAutoClose">setAutoClose</a>() to change this
|
---|
116 | behavior.
|
---|
117 | <p> There are two ways of using QProgressDialog: modal and modeless.
|
---|
118 | <p> Using a modal QProgressDialog is simpler for the programmer, but you
|
---|
119 | must call <a href="qapplication.html#processEvents">QApplication::processEvents</a>() or
|
---|
120 | <a href="qeventloop.html#processEvents">QEventLoop::processEvents</a>(ExcludeUserInput) to keep the event loop
|
---|
121 | running to ensure that the application doesn't freeze. Do the
|
---|
122 | operation in a loop, call <a href="#setProgress">setProgress</a>() at intervals, and check
|
---|
123 | for cancellation with <a href="#wasCanceled">wasCanceled</a>(). For example:
|
---|
124 | <pre>
|
---|
125 | QProgressDialog progress( "Copying files...", "Abort Copy", numFiles,
|
---|
126 | this, "progress", TRUE );
|
---|
127 | for ( int i = 0; i < numFiles; i++ ) {
|
---|
128 | progress.setProgress( i );
|
---|
129 | qApp-><a href="qapplication.html#processEvents">processEvents</a>();
|
---|
130 |
|
---|
131 | if ( progress.wasCanceled() )
|
---|
132 | break;
|
---|
133 | //... copy one file
|
---|
134 | }
|
---|
135 | progress.setProgress( numFiles );
|
---|
136 | </pre>
|
---|
137 |
|
---|
138 | <p> A modeless progress dialog is suitable for operations that take
|
---|
139 | place in the background, where the user is able to interact with the
|
---|
140 | application. Such operations are typically based on <a href="qtimer.html">QTimer</a> (or
|
---|
141 | <a href="qobject.html#timerEvent">QObject::timerEvent</a>()), <a href="qsocketnotifier.html">QSocketNotifier</a>, or <a href="qurloperator.html">QUrlOperator</a>; or performed
|
---|
142 | in a separate thread. A <a href="qprogressbar.html">QProgressBar</a> in the status bar of your main window
|
---|
143 | is often an alternative to a modeless progress dialog.
|
---|
144 | <p> You need to have an event loop to be running, connect the
|
---|
145 | <a href="#canceled">canceled</a>() signal to a slot that stops the operation, and call <a href="#setProgress">setProgress</a>() at intervals. For example:
|
---|
146 | <pre>
|
---|
147 | Operation::Operation( <a href="qobject.html">QObject</a> *parent = 0 )
|
---|
148 | : <a href="qobject.html">QObject</a>( parent ), steps( 0 )
|
---|
149 | {
|
---|
150 | pd = new QProgressDialog( "Operation in progress.", "Cancel", 100 );
|
---|
151 | <a href="qobject.html#connect">connect</a>( pd, SIGNAL(<a href="#canceled">canceled</a>()), this, SLOT(<a href="#cancel">cancel</a>()) );
|
---|
152 | t = new <a href="qtimer.html">QTimer</a>( this );
|
---|
153 | <a href="qobject.html#connect">connect</a>( t, SIGNAL(<a href="qtimer.html#timeout">timeout</a>()), this, SLOT(perform()) );
|
---|
154 | t-><a href="qtimer.html#start">start</a>( 0 );
|
---|
155 | }
|
---|
156 |
|
---|
157 | void Operation::perform()
|
---|
158 | {
|
---|
159 | pd-><a href="#setProgress">setProgress</a>( steps );
|
---|
160 | //... perform one percent of the operation
|
---|
161 | steps++;
|
---|
162 | if ( steps > pd-><a href="#totalSteps">totalSteps</a>() )
|
---|
163 | t-><a href="qtimer.html#stop">stop</a>();
|
---|
164 | }
|
---|
165 |
|
---|
166 | void Operation::cancel()
|
---|
167 | {
|
---|
168 | t-><a href="qtimer.html#stop">stop</a>();
|
---|
169 | //... cleanup
|
---|
170 | }
|
---|
171 | </pre>
|
---|
172 |
|
---|
173 | <p> In both modes the progress dialog may be customized by
|
---|
174 | replacing the child widgets with custom widgets by using <a href="#setLabel">setLabel</a>(),
|
---|
175 | <a href="#setBar">setBar</a>(), and <a href="#setCancelButton">setCancelButton</a>().
|
---|
176 | The functions <a href="#setLabelText">setLabelText</a>() and <a href="#setCancelButtonText">setCancelButtonText</a>()
|
---|
177 | set the texts shown.
|
---|
178 | <p> <img src=qprogdlg-m.png> <img src=qprogdlg-w.png>
|
---|
179 | <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>.
|
---|
180 |
|
---|
181 | <hr><h2>Member Function Documentation</h2>
|
---|
182 | <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 )
|
---|
183 | </h3>
|
---|
184 | Constructs a progress dialog.
|
---|
185 | <p> Default settings:
|
---|
186 | <ul>
|
---|
187 | <li> The label text is empty.
|
---|
188 | <li> The cancel button text is (translated) "Cancel".
|
---|
189 | <li> The total number of steps is 100.
|
---|
190 | </ul>
|
---|
191 | <p> The <em>creator</em> argument is the widget to use as the dialog's parent.
|
---|
192 | The <em>name</em>, <em>modal</em>, and the widget flags, <em>f</em>, are
|
---|
193 | passed to the <a href="qdialog.html#QDialog">QDialog::QDialog</a>() constructor. If <em>modal</em> is FALSE (the
|
---|
194 | default), you must have an event loop proceeding for any redrawing
|
---|
195 | of the dialog to occur. If <em>modal</em> is TRUE, the dialog ensures that
|
---|
196 | events are processed when needed.
|
---|
197 | <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>.
|
---|
198 |
|
---|
199 | <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 )
|
---|
200 | </h3>
|
---|
201 | Constructs a progress dialog.
|
---|
202 | <p> The <em>labelText</em> is text used to remind the user what is progressing.
|
---|
203 | <p> The <em>cancelButtonText</em> is the text to display on the cancel button,
|
---|
204 | or 0 if no cancel button is to be shown.
|
---|
205 | <p> The <em>totalSteps</em> is the total number of steps in the operation for
|
---|
206 | which this progress dialog shows progress. For example, if the
|
---|
207 | operation is to examine 50 files, this value would be 50. Before
|
---|
208 | examining the first file, call <a href="#setProgress">setProgress</a>(0). As each file is
|
---|
209 | processed call setProgress(1), setProgress(2), etc., finally
|
---|
210 | calling setProgress(50) after examining the last file.
|
---|
211 | <p> The <em>creator</em> argument is the widget to use as the dialog's parent.
|
---|
212 | The <em>name</em>, <em>modal</em>, and widget flags, <em>f</em>, are passed to the
|
---|
213 | <a href="qdialog.html#QDialog">QDialog::QDialog</a>() constructor. If <em>modal</em> is FALSE (the default),
|
---|
214 | you will must have an event loop proceeding for any redrawing of
|
---|
215 | the dialog to occur. If <em>modal</em> is TRUE, the dialog ensures that
|
---|
216 | events are processed when needed.
|
---|
217 | <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>.
|
---|
218 |
|
---|
219 | <h3 class=fn><a name="~QProgressDialog"></a>QProgressDialog::~QProgressDialog ()
|
---|
220 | </h3>
|
---|
221 | Destroys the progress dialog.
|
---|
222 |
|
---|
223 | <h3 class=fn>bool <a name="autoClose"></a>QProgressDialog::autoClose () const
|
---|
224 | </h3><p>Returns TRUE if the dialog gets hidden by <a href="#reset">reset</a>(); otherwise returns FALSE.
|
---|
225 | See the <a href="qprogressdialog.html#autoClose-prop">"autoClose"</a> property for details.
|
---|
226 | <h3 class=fn>bool <a name="autoReset"></a>QProgressDialog::autoReset () const
|
---|
227 | </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.
|
---|
228 | See the <a href="qprogressdialog.html#autoReset-prop">"autoReset"</a> property for details.
|
---|
229 | <h3 class=fn>void <a name="cancel"></a>QProgressDialog::cancel ()<tt> [slot]</tt>
|
---|
230 | </h3>
|
---|
231 | Resets the progress dialog. <a href="#wasCanceled">wasCanceled</a>() becomes TRUE until
|
---|
232 | the progress dialog is reset.
|
---|
233 | The progress dialog becomes hidden.
|
---|
234 |
|
---|
235 | <h3 class=fn>void <a name="canceled"></a>QProgressDialog::canceled ()<tt> [signal]</tt>
|
---|
236 | </h3>
|
---|
237 |
|
---|
238 | <p> This signal is emitted when the cancel button is clicked.
|
---|
239 | It is connected to the <a href="#cancel">cancel</a>() slot by default.
|
---|
240 | <p> <p>See also <a href="#wasCanceled-prop">wasCanceled</a>.
|
---|
241 |
|
---|
242 | <h3 class=fn>void <a name="cancelled"></a>QProgressDialog::cancelled ()<tt> [signal]</tt>
|
---|
243 | </h3>
|
---|
244 |
|
---|
245 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
246 | <p> Use <a href="#canceled">canceled</a>() instead.
|
---|
247 |
|
---|
248 | <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>.
|
---|
249 | <h3 class=fn>void <a name="forceShow"></a>QProgressDialog::forceShow ()<tt> [protected slot]</tt>
|
---|
250 | </h3>
|
---|
251 | Shows the dialog if it is still hidden after the algorithm has been started
|
---|
252 | and minimumDuration milliseconds have passed.
|
---|
253 | <p> <p>See also <a href="#minimumDuration-prop">minimumDuration</a>.
|
---|
254 |
|
---|
255 | <h3 class=fn><a href="qstring.html">QString</a> <a name="labelText"></a>QProgressDialog::labelText () const
|
---|
256 | </h3><p>Returns the label's text.
|
---|
257 | See the <a href="qprogressdialog.html#labelText-prop">"labelText"</a> property for details.
|
---|
258 | <h3 class=fn>int <a name="minimumDuration"></a>QProgressDialog::minimumDuration () const
|
---|
259 | </h3><p>Returns the time that must pass before the dialog appears.
|
---|
260 | See the <a href="qprogressdialog.html#minimumDuration-prop">"minimumDuration"</a> property for details.
|
---|
261 | <h3 class=fn>int <a name="progress"></a>QProgressDialog::progress () const
|
---|
262 | </h3><p>Returns the current amount of progress made.
|
---|
263 | See the <a href="qprogressdialog.html#progress-prop">"progress"</a> property for details.
|
---|
264 | <h3 class=fn>void <a name="reset"></a>QProgressDialog::reset ()<tt> [slot]</tt>
|
---|
265 | </h3>
|
---|
266 | Resets the progress dialog.
|
---|
267 | The progress dialog becomes hidden if <a href="#autoClose">autoClose</a>() is TRUE.
|
---|
268 | <p> <p>See also <a href="#autoClose-prop">autoClose</a> and <a href="#autoReset-prop">autoReset</a>.
|
---|
269 |
|
---|
270 | <p>Example: <a href="ftpclient-example.html#x769">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
271 | <h3 class=fn>void <a name="setAutoClose"></a>QProgressDialog::setAutoClose ( bool b )
|
---|
272 | </h3><p>Sets whether the dialog gets hidden by <a href="#reset">reset</a>() to <em>b</em>.
|
---|
273 | See the <a href="qprogressdialog.html#autoClose-prop">"autoClose"</a> property for details.
|
---|
274 | <h3 class=fn>void <a name="setAutoReset"></a>QProgressDialog::setAutoReset ( bool b )
|
---|
275 | </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>.
|
---|
276 | See the <a href="qprogressdialog.html#autoReset-prop">"autoReset"</a> property for details.
|
---|
277 | <h3 class=fn>void <a name="setBar"></a>QProgressDialog::setBar ( <a href="qprogressbar.html">QProgressBar</a> * bar )
|
---|
278 | </h3>
|
---|
279 | Sets the progress bar widget to <em>bar</em>. The progress dialog resizes to
|
---|
280 | fit. The progress dialog takes ownership of the progress <em>bar</em> which
|
---|
281 | will be deleted when necessary, so do not use a progress bar
|
---|
282 | allocated on the stack.
|
---|
283 |
|
---|
284 | <h3 class=fn>void <a name="setCancelButton"></a>QProgressDialog::setCancelButton ( <a href="qpushbutton.html">QPushButton</a> * cancelButton )
|
---|
285 | </h3>
|
---|
286 | Sets the cancel button to the push button, <em>cancelButton</em>. The
|
---|
287 | progress dialog takes ownership of this button which will be deleted
|
---|
288 | when necessary, so do not pass the address of an object that is on
|
---|
289 | the stack, i.e. use new() to create the button.
|
---|
290 | <p> <p>See also <a href="#setCancelButtonText">setCancelButtonText</a>().
|
---|
291 |
|
---|
292 | <h3 class=fn>void <a name="setCancelButtonText"></a>QProgressDialog::setCancelButtonText ( const <a href="qstring.html">QString</a> & cancelButtonText )<tt> [slot]</tt>
|
---|
293 | </h3>
|
---|
294 | Sets the cancel button's text to <em>cancelButtonText</em>.
|
---|
295 | <p>See also <a href="#setCancelButton">setCancelButton</a>().
|
---|
296 |
|
---|
297 | <h3 class=fn>void <a name="setLabel"></a>QProgressDialog::setLabel ( <a href="qlabel.html">QLabel</a> * label )
|
---|
298 | </h3>
|
---|
299 | Sets the label to <em>label</em>. The progress dialog resizes to fit. The
|
---|
300 | label becomes owned by the progress dialog and will be deleted when
|
---|
301 | necessary, so do not pass the address of an object on the stack.
|
---|
302 | <p> <p>See also <a href="#labelText-prop">labelText</a>.
|
---|
303 |
|
---|
304 | <p>Example: <a href="progress-example.html#x83">progress/progress.cpp</a>.
|
---|
305 | <h3 class=fn>void <a name="setLabelText"></a>QProgressDialog::setLabelText ( const <a href="qstring.html">QString</a> & )<tt> [slot]</tt>
|
---|
306 | </h3><p>Sets the label's text.
|
---|
307 | See the <a href="qprogressdialog.html#labelText-prop">"labelText"</a> property for details.
|
---|
308 | <h3 class=fn>void <a name="setMinimumDuration"></a>QProgressDialog::setMinimumDuration ( int ms )<tt> [slot]</tt>
|
---|
309 | </h3><p>Sets the time that must pass before the dialog appears to <em>ms</em>.
|
---|
310 | See the <a href="qprogressdialog.html#minimumDuration-prop">"minimumDuration"</a> property for details.
|
---|
311 | <h3 class=fn>void <a name="setProgress"></a>QProgressDialog::setProgress ( int progress )<tt> [slot]</tt>
|
---|
312 | </h3><p>Sets the current amount of progress made to <em>progress</em>.
|
---|
313 | See the <a href="qprogressdialog.html#progress-prop">"progress"</a> property for details.
|
---|
314 | <h3 class=fn>void <a name="setProgress-2"></a>QProgressDialog::setProgress ( int progress, int totalSteps )<tt> [slot]</tt>
|
---|
315 | </h3>
|
---|
316 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
317 | <p> Sets the current amount of progress to <em>progress</em> and the total number of
|
---|
318 | steps to <em>totalSteps</em>.
|
---|
319 | <p> <p>See also <a href="#totalSteps-prop">totalSteps</a>.
|
---|
320 |
|
---|
321 | <h3 class=fn>void <a name="setTotalSteps"></a>QProgressDialog::setTotalSteps ( int totalSteps )<tt> [slot]</tt>
|
---|
322 | </h3><p>Sets the total number of steps to <em>totalSteps</em>.
|
---|
323 | See the <a href="qprogressdialog.html#totalSteps-prop">"totalSteps"</a> property for details.
|
---|
324 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QProgressDialog::sizeHint () const<tt> [virtual]</tt>
|
---|
325 | </h3>
|
---|
326 | Returns a size that fits the contents of the progress dialog.
|
---|
327 | The progress dialog resizes itself as required, so you should not
|
---|
328 | need to call this yourself.
|
---|
329 |
|
---|
330 | <h3 class=fn>int <a name="totalSteps"></a>QProgressDialog::totalSteps () const
|
---|
331 | </h3><p>Returns the total number of steps.
|
---|
332 | See the <a href="qprogressdialog.html#totalSteps-prop">"totalSteps"</a> property for details.
|
---|
333 | <h3 class=fn>bool <a name="wasCanceled"></a>QProgressDialog::wasCanceled () const
|
---|
334 | </h3><p>Returns TRUE if the dialog was canceled; otherwise returns FALSE.
|
---|
335 | See the <a href="qprogressdialog.html#wasCanceled-prop">"wasCanceled"</a> property for details.
|
---|
336 | <h3 class=fn>bool <a name="wasCancelled"></a>QProgressDialog::wasCancelled () const
|
---|
337 | </h3><p>Returns TRUE if the dialog was canceled; otherwise returns FALSE.
|
---|
338 | See the <a href="qprogressdialog.html#wasCancelled-prop">"wasCancelled"</a> property for details.
|
---|
339 | <hr><h2>Property Documentation</h2>
|
---|
340 | <h3 class=fn>bool <a name="autoClose-prop"></a>autoClose</h3>
|
---|
341 | <p>This property holds whether the dialog gets hidden by <a href="#reset">reset</a>().
|
---|
342 | <p>The default is TRUE.
|
---|
343 | <p> <p>See also <a href="#autoReset-prop">autoReset</a>.
|
---|
344 |
|
---|
345 | <p>Set this property's value with <a href="#setAutoClose">setAutoClose</a>() and get this property's value with <a href="#autoClose">autoClose</a>().
|
---|
346 | <h3 class=fn>bool <a name="autoReset-prop"></a>autoReset</h3>
|
---|
347 | <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>().
|
---|
348 | <p>The default is TRUE.
|
---|
349 | <p> <p>See also <a href="#autoClose-prop">autoClose</a>.
|
---|
350 |
|
---|
351 | <p>Set this property's value with <a href="#setAutoReset">setAutoReset</a>() and get this property's value with <a href="#autoReset">autoReset</a>().
|
---|
352 | <h3 class=fn><a href="qstring.html">QString</a> <a name="labelText-prop"></a>labelText</h3>
|
---|
353 | <p>This property holds the label's text.
|
---|
354 | <p>The default text is <a href="qstring.html#QString-null">QString::null</a>.
|
---|
355 |
|
---|
356 | <p>Set this property's value with <a href="#setLabelText">setLabelText</a>() and get this property's value with <a href="#labelText">labelText</a>().
|
---|
357 | <h3 class=fn>int <a name="minimumDuration-prop"></a>minimumDuration</h3>
|
---|
358 | <p>This property holds the time that must pass before the dialog appears.
|
---|
359 | <p>If the expected duration of the task is less than the
|
---|
360 | minimumDuration, the dialog will not appear at all. This prevents
|
---|
361 | the dialog popping up for tasks that are quickly over. For tasks
|
---|
362 | that are expected to exceed the minimumDuration, the dialog will
|
---|
363 | pop up after the minimumDuration time or as soon as any progress
|
---|
364 | is set.
|
---|
365 | <p> If set to 0, the dialog is always shown as soon as any progress is
|
---|
366 | set. The default is 4000 milliseconds.
|
---|
367 |
|
---|
368 | <p>Set this property's value with <a href="#setMinimumDuration">setMinimumDuration</a>() and get this property's value with <a href="#minimumDuration">minimumDuration</a>().
|
---|
369 | <h3 class=fn>int <a name="progress-prop"></a>progress</h3>
|
---|
370 | <p>This property holds the current amount of progress made.
|
---|
371 | <p>For the progress dialog to work as expected, you should initially set
|
---|
372 | this property to 0 and finally set it to
|
---|
373 | <a href="#totalSteps">QProgressDialog::totalSteps</a>(); you can call <a href="#setProgress">setProgress</a>() any number of times
|
---|
374 | in-between.
|
---|
375 | <p> <b>Warning:</b> If the progress dialog is modal
|
---|
376 | (see <a href="#QProgressDialog">QProgressDialog::QProgressDialog</a>()),
|
---|
377 | this function calls <a href="qapplication.html#processEvents">QApplication::processEvents</a>(), so take care that
|
---|
378 | this does not cause undesirable re-entrancy in your code. For example,
|
---|
379 | don't use a QProgressDialog inside a <a href="qwidget.html#paintEvent">paintEvent</a>()!
|
---|
380 | <p> <p>See also <a href="#totalSteps-prop">totalSteps</a>.
|
---|
381 |
|
---|
382 | <p>Set this property's value with <a href="#setProgress">setProgress</a>() and get this property's value with <a href="#progress">progress</a>().
|
---|
383 | <h3 class=fn>int <a name="totalSteps-prop"></a>totalSteps</h3>
|
---|
384 | <p>This property holds the total number of steps.
|
---|
385 | <p>The default is 0.
|
---|
386 |
|
---|
387 | <p>Set this property's value with <a href="#setTotalSteps">setTotalSteps</a>() and get this property's value with <a href="#totalSteps">totalSteps</a>().
|
---|
388 | <h3 class=fn>bool <a name="wasCanceled-prop"></a>wasCanceled</h3>
|
---|
389 | <p>This property holds whether the dialog was canceled.
|
---|
390 | <p>Get this property's value with <a href="#wasCanceled">wasCanceled</a>().
|
---|
391 | <p><p>See also <a href="#progress-prop">progress</a>.
|
---|
392 |
|
---|
393 | <h3 class=fn>bool <a name="wasCancelled-prop"></a>wasCancelled</h3>
|
---|
394 | <p>This property holds whether the dialog was canceled.
|
---|
395 | <p><b>This property is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
396 | <p> Use <a href="#wasCanceled-prop">wasCanceled</a> instead.
|
---|
397 |
|
---|
398 | <p>Get this property's value with <a href="#wasCancelled">wasCancelled</a>().
|
---|
399 | <!-- eof -->
|
---|
400 | <hr><p>
|
---|
401 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
402 | Copyright © 1995-2007
|
---|
403 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
404 | <table width=100% cellspacing=0 border=0><tr>
|
---|
405 | <td>Copyright © 2007
|
---|
406 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
407 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
408 | </table></div></address></body>
|
---|
409 | </html>
|
---|