summaryrefslogtreecommitdiffstats
path: root/doc/html/qprogressbar.html
blob: 344a648b4af5e1f71bd91d909441cd51d5d674c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!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/widgets/qprogressbar.cpp:50 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QProgressBar 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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>QProgressBar Class Reference</h1>

<p>The QProgressBar widget provides a horizontal progress bar.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qprogressbar-h.html">qprogressbar.h</a>&gt;</tt>
<p>Inherits <a href="qframe.html">QFrame</a>.
<p><a href="qprogressbar-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QProgressBar"><b>QProgressBar</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</li>
<li class=fn><a href="#QProgressBar-2"><b>QProgressBar</b></a> ( int&nbsp;totalSteps, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</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>const QString &amp; <a href="#progressString"><b>progressString</b></a> () const</li>
<li class=fn>void <a href="#setCenterIndicator"><b>setCenterIndicator</b></a> ( bool&nbsp;on )</li>
<li class=fn>bool <a href="#centerIndicator"><b>centerIndicator</b></a> () const</li>
<li class=fn>void <a href="#setIndicatorFollowsStyle"><b>setIndicatorFollowsStyle</b></a> ( bool )</li>
<li class=fn>bool <a href="#indicatorFollowsStyle"><b>indicatorFollowsStyle</b></a> () const</li>
<li class=fn>bool <a href="#percentageVisible"><b>percentageVisible</b></a> () const</li>
<li class=fn>void <a href="#setPercentageVisible"><b>setPercentageVisible</b></a> ( bool )</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
<li class=fn>virtual void <a href="#setTotalSteps"><b>setTotalSteps</b></a> ( int&nbsp;totalSteps )</li>
<li class=fn>virtual void <a href="#setProgress"><b>setProgress</b></a> ( int&nbsp;progress )</li>
<li class=fn>void <a href="#setProgress-2"><b>setProgress</b></a> ( int&nbsp;progress, int&nbsp;totalSteps )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#centerIndicator-prop"><b>centerIndicator</b></a>&nbsp;- whether the indicator string should be centered</li>
<li class=fn>bool <a href="#indicatorFollowsStyle-prop"><b>indicatorFollowsStyle</b></a>&nbsp;- whether the display of the indicator string should follow the GUI style</li>
<li class=fn>bool <a href="#percentageVisible-prop"><b>percentageVisible</b></a>&nbsp;- whether the current progress value is displayed</li>
<li class=fn>int <a href="#progress-prop"><b>progress</b></a>&nbsp;- the current amount of progress</li>
<li class=fn>QString <a href="#progressString-prop"><b>progressString</b></a>&nbsp;- the amount of progress as a string &nbsp;<em>(read only)</em></li>
<li class=fn>int <a href="#totalSteps-prop"><b>totalSteps</b></a>&nbsp;- the total number of steps</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual bool <a href="#setIndicator"><b>setIndicator</b></a> ( QString&nbsp;&amp;&nbsp;indicator, int&nbsp;progress, int&nbsp;totalSteps )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QProgressBar widget provides a horizontal progress bar.
<p> 

<p> 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.
<p> The progress bar uses the concept of <em>steps</em>; you give it the
total number of steps and the number of steps completed so far and
it will display the percentage of steps that have been completed.
You can specify the total number of steps in the constructor or
later with <a href="#setTotalSteps">setTotalSteps</a>(). The current number of steps is set
with <a href="#setProgress">setProgress</a>(). The progress bar can be rewound to the
beginning with <a href="#reset">reset</a>().
<p> If the total is given as 0 the progress bar shows a busy indicator
instead of a percentage of steps. This is useful, for example,
when using <a href="qftp.html">QFtp</a> or <a href="qhttp.html">QHttp</a> to download items when they are unable to
determine the size of the item being downloaded.
<p> <p>See also <a href="qprogressdialog.html">QProgressDialog</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Progress Indicator</a>, and <a href="advanced.html">Advanced Widgets</a>.

<p> <img src=qprogbar-m.png> <img src=qprogbar-w.png>
<p> <p>See also <a href="qprogressdialog.html">QProgressDialog</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Progress Indicator</a>, and <a href="advanced.html">Advanced Widgets</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QProgressBar"></a>QProgressBar::QProgressBar ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
</h3>
Constructs a progress bar.
<p> The total number of steps is set to 100 by default.
<p> The <em>parent</em>, <em>name</em> and widget flags, <em>f</em>, are passed on to
the <a href="qframe.html#QFrame">QFrame::QFrame</a>() constructor.
<p> <p>See also <a href="#totalSteps-prop">totalSteps</a>.

<h3 class=fn><a name="QProgressBar-2"></a>QProgressBar::QProgressBar ( int&nbsp;totalSteps, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
</h3>
Constructs a progress bar.
<p> The <em>totalSteps</em> is the total number of steps that need to be
completed for the operation which this progress bar represents.
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);
call setProgress(50) after examining the last file.
<p> The <em>parent</em>, <em>name</em> and widget flags, <em>f</em>, are passed to the
<a href="qframe.html#QFrame">QFrame::QFrame</a>() constructor.
<p> <p>See also <a href="#totalSteps-prop">totalSteps</a> and <a href="#progress-prop">progress</a>.

<h3 class=fn>bool <a name="centerIndicator"></a>QProgressBar::centerIndicator () const
</h3><p>Returns TRUE if the indicator string should be centered; otherwise returns FALSE.
See the <a href="qprogressbar.html#centerIndicator-prop">"centerIndicator"</a> property for details.
<h3 class=fn>bool <a name="indicatorFollowsStyle"></a>QProgressBar::indicatorFollowsStyle () const
</h3><p>Returns TRUE if the display of the indicator string should follow the GUI style; otherwise returns FALSE.
See the <a href="qprogressbar.html#indicatorFollowsStyle-prop">"indicatorFollowsStyle"</a> property for details.
<h3 class=fn>bool <a name="percentageVisible"></a>QProgressBar::percentageVisible () const
</h3><p>Returns TRUE if the current progress value is displayed; otherwise returns FALSE.
See the <a href="qprogressbar.html#percentageVisible-prop">"percentageVisible"</a> property for details.
<h3 class=fn>int <a name="progress"></a>QProgressBar::progress () const
</h3><p>Returns the current amount of progress.
See the <a href="qprogressbar.html#progress-prop">"progress"</a> property for details.
<h3 class=fn>const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; <a name="progressString"></a>QProgressBar::progressString () const
</h3><p>Returns the amount of progress as a string.
See the <a href="qprogressbar.html#progressString-prop">"progressString"</a> property for details.
<h3 class=fn>void <a name="reset"></a>QProgressBar::reset ()<tt> [slot]</tt>
</h3>
Reset the progress bar. The progress bar "rewinds" and shows no
progress.

<p>Examples: <a href="fileiconview-example.html#x890">fileiconview/mainwindow.cpp</a> and <a href="progressbar-example.html#x967">progressbar/progressbar.cpp</a>.
<h3 class=fn>void <a name="setCenterIndicator"></a>QProgressBar::setCenterIndicator ( bool&nbsp;on )
</h3><p>Sets whether the indicator string should be centered to <em>on</em>.
See the <a href="qprogressbar.html#centerIndicator-prop">"centerIndicator"</a> property for details.
<h3 class=fn>bool <a name="setIndicator"></a>QProgressBar::setIndicator ( <a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;indicator, int&nbsp;progress, int&nbsp;totalSteps )<tt> [virtual protected]</tt>
</h3>
This method is called to generate the text displayed in the center
(or in some styles, to the left) of the progress bar.
<p> The <em>progress</em> may be negative, indicating that the progress bar
is in the "reset" state before any progress is set.
<p> The default implementation is the percentage of completion or
blank in the reset state. The percentage is calculated based on
the <em>progress</em> and <em>totalSteps</em>. You can set the <em>indicator</em>
text if you wish.
<p> To allow efficient repainting of the progress bar, this method
should return FALSE if the string is unchanged from the last call
to this function.

<h3 class=fn>void <a name="setIndicatorFollowsStyle"></a>QProgressBar::setIndicatorFollowsStyle ( bool )
</h3><p>Sets whether the display of the indicator string should follow the GUI style.
See the <a href="qprogressbar.html#indicatorFollowsStyle-prop">"indicatorFollowsStyle"</a> property for details.
<h3 class=fn>void <a name="setPercentageVisible"></a>QProgressBar::setPercentageVisible ( bool )
</h3><p>Sets whether the current progress value is displayed.
See the <a href="qprogressbar.html#percentageVisible-prop">"percentageVisible"</a> property for details.
<h3 class=fn>void <a name="setProgress"></a>QProgressBar::setProgress ( int&nbsp;progress )<tt> [virtual slot]</tt>
</h3><p>Sets the current amount of progress to <em>progress</em>.
See the <a href="qprogressbar.html#progress-prop">"progress"</a> property for details.
<h3 class=fn>void <a name="setProgress-2"></a>QProgressBar::setProgress ( int&nbsp;progress, int&nbsp;totalSteps )<tt> [slot]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the 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>QProgressBar::setTotalSteps ( int&nbsp;totalSteps )<tt> [virtual slot]</tt>
</h3><p>Sets the total number of steps to <em>totalSteps</em>.
See the <a href="qprogressbar.html#totalSteps-prop">"totalSteps"</a> property for details.
<h3 class=fn>int <a name="totalSteps"></a>QProgressBar::totalSteps () const
</h3><p>Returns the total number of steps.
See the <a href="qprogressbar.html#totalSteps-prop">"totalSteps"</a> property for details.
<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="centerIndicator-prop"></a>centerIndicator</h3>
<p>This property holds whether the indicator string should be centered.
<p>Changing this property sets <a href="#indicatorFollowsStyle-prop">QProgressBar::indicatorFollowsStyle</a>
to FALSE. The default is TRUE.

<p>Set this property's value with <a href="#setCenterIndicator">setCenterIndicator</a>() and get this property's value with <a href="#centerIndicator">centerIndicator</a>().
<h3 class=fn>bool <a name="indicatorFollowsStyle-prop"></a>indicatorFollowsStyle</h3>
<p>This property holds whether the display of the indicator string should follow the GUI style.
<p>The default is TRUE.
<p> <p>See also <a href="#centerIndicator-prop">centerIndicator</a>.

<p>Set this property's value with <a href="#setIndicatorFollowsStyle">setIndicatorFollowsStyle</a>() and get this property's value with <a href="#indicatorFollowsStyle">indicatorFollowsStyle</a>().
<h3 class=fn>bool <a name="percentageVisible-prop"></a>percentageVisible</h3>
<p>This property holds whether the current progress value is displayed.
<p>The default is TRUE.
<p> <p>See also <a href="#centerIndicator-prop">centerIndicator</a> and <a href="#indicatorFollowsStyle-prop">indicatorFollowsStyle</a>.

<p>Set this property's value with <a href="#setPercentageVisible">setPercentageVisible</a>() and get this property's value with <a href="#percentageVisible">percentageVisible</a>().
<h3 class=fn>int <a name="progress-prop"></a>progress</h3>
<p>This property holds the current amount of progress.
<p>This property is -1 if progress counting has not started.

<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><a href="qstring.html">QString</a> <a name="progressString-prop"></a>progressString</h3>
<p>This property holds the amount of progress as a string.
<p>This property is <a href="qstring.html#QString-null">QString::null</a> if progress counting has not started.

<p>Get this property's value with <a href="#progressString">progressString</a>().
<h3 class=fn>int <a name="totalSteps-prop"></a>totalSteps</h3>
<p>This property holds the total number of steps.
<p>If totalSteps is 0, the progress bar will display a busy
indicator.
<p> <p>See also 
<p>Set this property's value with <a href="#setTotalSteps">setTotalSteps</a>() and get this property's value with <a href="#totalSteps">totalSteps</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 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 &copy; 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>