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/widgets/qprogressbar.cpp:50 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QProgressBar 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>QProgressBar Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QProgressBar widget provides a horizontal progress bar.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qprogressbar-h.html">qprogressbar.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qframe.html">QFrame</a>.
|
---|
38 | <p><a href="qprogressbar-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <li class=fn><a href="#QProgressBar"><b>QProgressBar</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
|
---|
42 | <li class=fn><a href="#QProgressBar-2"><b>QProgressBar</b></a> ( int totalSteps, QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
|
---|
43 | <li class=fn>int <a href="#totalSteps"><b>totalSteps</b></a> () const</li>
|
---|
44 | <li class=fn>int <a href="#progress"><b>progress</b></a> () const</li>
|
---|
45 | <li class=fn>const QString & <a href="#progressString"><b>progressString</b></a> () const</li>
|
---|
46 | <li class=fn>void <a href="#setCenterIndicator"><b>setCenterIndicator</b></a> ( bool on )</li>
|
---|
47 | <li class=fn>bool <a href="#centerIndicator"><b>centerIndicator</b></a> () const</li>
|
---|
48 | <li class=fn>void <a href="#setIndicatorFollowsStyle"><b>setIndicatorFollowsStyle</b></a> ( bool )</li>
|
---|
49 | <li class=fn>bool <a href="#indicatorFollowsStyle"><b>indicatorFollowsStyle</b></a> () const</li>
|
---|
50 | <li class=fn>bool <a href="#percentageVisible"><b>percentageVisible</b></a> () const</li>
|
---|
51 | <li class=fn>void <a href="#setPercentageVisible"><b>setPercentageVisible</b></a> ( bool )</li>
|
---|
52 | </ul>
|
---|
53 | <h2>Public Slots</h2>
|
---|
54 | <ul>
|
---|
55 | <li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
|
---|
56 | <li class=fn>virtual void <a href="#setTotalSteps"><b>setTotalSteps</b></a> ( int totalSteps )</li>
|
---|
57 | <li class=fn>virtual void <a href="#setProgress"><b>setProgress</b></a> ( int progress )</li>
|
---|
58 | <li class=fn>void <a href="#setProgress-2"><b>setProgress</b></a> ( int progress, int totalSteps )</li>
|
---|
59 | </ul>
|
---|
60 | <h2>Properties</h2>
|
---|
61 | <ul>
|
---|
62 | <li class=fn>bool <a href="#centerIndicator-prop"><b>centerIndicator</b></a> - whether the indicator string should be centered</li>
|
---|
63 | <li class=fn>bool <a href="#indicatorFollowsStyle-prop"><b>indicatorFollowsStyle</b></a> - whether the display of the indicator string should follow the GUI style</li>
|
---|
64 | <li class=fn>bool <a href="#percentageVisible-prop"><b>percentageVisible</b></a> - whether the current progress value is displayed</li>
|
---|
65 | <li class=fn>int <a href="#progress-prop"><b>progress</b></a> - the current amount of progress</li>
|
---|
66 | <li class=fn>QString <a href="#progressString-prop"><b>progressString</b></a> - the amount of progress as a string <em>(read only)</em></li>
|
---|
67 | <li class=fn>int <a href="#totalSteps-prop"><b>totalSteps</b></a> - the total number of steps</li>
|
---|
68 | </ul>
|
---|
69 | <h2>Protected Members</h2>
|
---|
70 | <ul>
|
---|
71 | <li class=fn>virtual bool <a href="#setIndicator"><b>setIndicator</b></a> ( QString & indicator, int progress, int totalSteps )</li>
|
---|
72 | </ul>
|
---|
73 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
74 |
|
---|
75 |
|
---|
76 | The QProgressBar widget provides a horizontal progress bar.
|
---|
77 | <p>
|
---|
78 |
|
---|
79 | <p> A progress bar is used to give the user an indication of the
|
---|
80 | progress of an operation and to reassure them that the application
|
---|
81 | is still running.
|
---|
82 | <p> The progress bar uses the concept of <em>steps</em>; you give it the
|
---|
83 | total number of steps and the number of steps completed so far and
|
---|
84 | it will display the percentage of steps that have been completed.
|
---|
85 | You can specify the total number of steps in the constructor or
|
---|
86 | later with <a href="#setTotalSteps">setTotalSteps</a>(). The current number of steps is set
|
---|
87 | with <a href="#setProgress">setProgress</a>(). The progress bar can be rewound to the
|
---|
88 | beginning with <a href="#reset">reset</a>().
|
---|
89 | <p> If the total is given as 0 the progress bar shows a busy indicator
|
---|
90 | instead of a percentage of steps. This is useful, for example,
|
---|
91 | when using <a href="qftp.html">QFtp</a> or <a href="qhttp.html">QHttp</a> to download items when they are unable to
|
---|
92 | determine the size of the item being downloaded.
|
---|
93 | <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>.
|
---|
94 |
|
---|
95 | <p> <img src=qprogbar-m.png> <img src=qprogbar-w.png>
|
---|
96 | <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>.
|
---|
97 |
|
---|
98 | <hr><h2>Member Function Documentation</h2>
|
---|
99 | <h3 class=fn><a name="QProgressBar"></a>QProgressBar::QProgressBar ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
|
---|
100 | </h3>
|
---|
101 | Constructs a progress bar.
|
---|
102 | <p> The total number of steps is set to 100 by default.
|
---|
103 | <p> The <em>parent</em>, <em>name</em> and widget flags, <em>f</em>, are passed on to
|
---|
104 | the <a href="qframe.html#QFrame">QFrame::QFrame</a>() constructor.
|
---|
105 | <p> <p>See also <a href="#totalSteps-prop">totalSteps</a>.
|
---|
106 |
|
---|
107 | <h3 class=fn><a name="QProgressBar-2"></a>QProgressBar::QProgressBar ( int totalSteps, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
|
---|
108 | </h3>
|
---|
109 | Constructs a progress bar.
|
---|
110 | <p> The <em>totalSteps</em> is the total number of steps that need to be
|
---|
111 | completed for the operation which this progress bar represents.
|
---|
112 | For example, if the operation is to examine 50 files, this value
|
---|
113 | would be 50. Before examining the first file, call <a href="#setProgress">setProgress</a>(0);
|
---|
114 | call setProgress(50) after examining the last file.
|
---|
115 | <p> The <em>parent</em>, <em>name</em> and widget flags, <em>f</em>, are passed to the
|
---|
116 | <a href="qframe.html#QFrame">QFrame::QFrame</a>() constructor.
|
---|
117 | <p> <p>See also <a href="#totalSteps-prop">totalSteps</a> and <a href="#progress-prop">progress</a>.
|
---|
118 |
|
---|
119 | <h3 class=fn>bool <a name="centerIndicator"></a>QProgressBar::centerIndicator () const
|
---|
120 | </h3><p>Returns TRUE if the indicator string should be centered; otherwise returns FALSE.
|
---|
121 | See the <a href="qprogressbar.html#centerIndicator-prop">"centerIndicator"</a> property for details.
|
---|
122 | <h3 class=fn>bool <a name="indicatorFollowsStyle"></a>QProgressBar::indicatorFollowsStyle () const
|
---|
123 | </h3><p>Returns TRUE if the display of the indicator string should follow the GUI style; otherwise returns FALSE.
|
---|
124 | See the <a href="qprogressbar.html#indicatorFollowsStyle-prop">"indicatorFollowsStyle"</a> property for details.
|
---|
125 | <h3 class=fn>bool <a name="percentageVisible"></a>QProgressBar::percentageVisible () const
|
---|
126 | </h3><p>Returns TRUE if the current progress value is displayed; otherwise returns FALSE.
|
---|
127 | See the <a href="qprogressbar.html#percentageVisible-prop">"percentageVisible"</a> property for details.
|
---|
128 | <h3 class=fn>int <a name="progress"></a>QProgressBar::progress () const
|
---|
129 | </h3><p>Returns the current amount of progress.
|
---|
130 | See the <a href="qprogressbar.html#progress-prop">"progress"</a> property for details.
|
---|
131 | <h3 class=fn>const <a href="qstring.html">QString</a> & <a name="progressString"></a>QProgressBar::progressString () const
|
---|
132 | </h3><p>Returns the amount of progress as a string.
|
---|
133 | See the <a href="qprogressbar.html#progressString-prop">"progressString"</a> property for details.
|
---|
134 | <h3 class=fn>void <a name="reset"></a>QProgressBar::reset ()<tt> [slot]</tt>
|
---|
135 | </h3>
|
---|
136 | Reset the progress bar. The progress bar "rewinds" and shows no
|
---|
137 | progress.
|
---|
138 |
|
---|
139 | <p>Examples: <a href="fileiconview-example.html#x890">fileiconview/mainwindow.cpp</a> and <a href="progressbar-example.html#x967">progressbar/progressbar.cpp</a>.
|
---|
140 | <h3 class=fn>void <a name="setCenterIndicator"></a>QProgressBar::setCenterIndicator ( bool on )
|
---|
141 | </h3><p>Sets whether the indicator string should be centered to <em>on</em>.
|
---|
142 | See the <a href="qprogressbar.html#centerIndicator-prop">"centerIndicator"</a> property for details.
|
---|
143 | <h3 class=fn>bool <a name="setIndicator"></a>QProgressBar::setIndicator ( <a href="qstring.html">QString</a> & indicator, int progress, int totalSteps )<tt> [virtual protected]</tt>
|
---|
144 | </h3>
|
---|
145 | This method is called to generate the text displayed in the center
|
---|
146 | (or in some styles, to the left) of the progress bar.
|
---|
147 | <p> The <em>progress</em> may be negative, indicating that the progress bar
|
---|
148 | is in the "reset" state before any progress is set.
|
---|
149 | <p> The default implementation is the percentage of completion or
|
---|
150 | blank in the reset state. The percentage is calculated based on
|
---|
151 | the <em>progress</em> and <em>totalSteps</em>. You can set the <em>indicator</em>
|
---|
152 | text if you wish.
|
---|
153 | <p> To allow efficient repainting of the progress bar, this method
|
---|
154 | should return FALSE if the string is unchanged from the last call
|
---|
155 | to this function.
|
---|
156 |
|
---|
157 | <h3 class=fn>void <a name="setIndicatorFollowsStyle"></a>QProgressBar::setIndicatorFollowsStyle ( bool )
|
---|
158 | </h3><p>Sets whether the display of the indicator string should follow the GUI style.
|
---|
159 | See the <a href="qprogressbar.html#indicatorFollowsStyle-prop">"indicatorFollowsStyle"</a> property for details.
|
---|
160 | <h3 class=fn>void <a name="setPercentageVisible"></a>QProgressBar::setPercentageVisible ( bool )
|
---|
161 | </h3><p>Sets whether the current progress value is displayed.
|
---|
162 | See the <a href="qprogressbar.html#percentageVisible-prop">"percentageVisible"</a> property for details.
|
---|
163 | <h3 class=fn>void <a name="setProgress"></a>QProgressBar::setProgress ( int progress )<tt> [virtual slot]</tt>
|
---|
164 | </h3><p>Sets the current amount of progress to <em>progress</em>.
|
---|
165 | See the <a href="qprogressbar.html#progress-prop">"progress"</a> property for details.
|
---|
166 | <h3 class=fn>void <a name="setProgress-2"></a>QProgressBar::setProgress ( int progress, int totalSteps )<tt> [slot]</tt>
|
---|
167 | </h3>
|
---|
168 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
169 | <p> Sets the amount of progress to <em>progress</em> and the total number of
|
---|
170 | steps to <em>totalSteps</em>.
|
---|
171 | <p> <p>See also <a href="#totalSteps-prop">totalSteps</a>.
|
---|
172 |
|
---|
173 | <h3 class=fn>void <a name="setTotalSteps"></a>QProgressBar::setTotalSteps ( int totalSteps )<tt> [virtual slot]</tt>
|
---|
174 | </h3><p>Sets the total number of steps to <em>totalSteps</em>.
|
---|
175 | See the <a href="qprogressbar.html#totalSteps-prop">"totalSteps"</a> property for details.
|
---|
176 | <h3 class=fn>int <a name="totalSteps"></a>QProgressBar::totalSteps () const
|
---|
177 | </h3><p>Returns the total number of steps.
|
---|
178 | See the <a href="qprogressbar.html#totalSteps-prop">"totalSteps"</a> property for details.
|
---|
179 | <hr><h2>Property Documentation</h2>
|
---|
180 | <h3 class=fn>bool <a name="centerIndicator-prop"></a>centerIndicator</h3>
|
---|
181 | <p>This property holds whether the indicator string should be centered.
|
---|
182 | <p>Changing this property sets <a href="#indicatorFollowsStyle-prop">QProgressBar::indicatorFollowsStyle</a>
|
---|
183 | to FALSE. The default is TRUE.
|
---|
184 |
|
---|
185 | <p>Set this property's value with <a href="#setCenterIndicator">setCenterIndicator</a>() and get this property's value with <a href="#centerIndicator">centerIndicator</a>().
|
---|
186 | <h3 class=fn>bool <a name="indicatorFollowsStyle-prop"></a>indicatorFollowsStyle</h3>
|
---|
187 | <p>This property holds whether the display of the indicator string should follow the GUI style.
|
---|
188 | <p>The default is TRUE.
|
---|
189 | <p> <p>See also <a href="#centerIndicator-prop">centerIndicator</a>.
|
---|
190 |
|
---|
191 | <p>Set this property's value with <a href="#setIndicatorFollowsStyle">setIndicatorFollowsStyle</a>() and get this property's value with <a href="#indicatorFollowsStyle">indicatorFollowsStyle</a>().
|
---|
192 | <h3 class=fn>bool <a name="percentageVisible-prop"></a>percentageVisible</h3>
|
---|
193 | <p>This property holds whether the current progress value is displayed.
|
---|
194 | <p>The default is TRUE.
|
---|
195 | <p> <p>See also <a href="#centerIndicator-prop">centerIndicator</a> and <a href="#indicatorFollowsStyle-prop">indicatorFollowsStyle</a>.
|
---|
196 |
|
---|
197 | <p>Set this property's value with <a href="#setPercentageVisible">setPercentageVisible</a>() and get this property's value with <a href="#percentageVisible">percentageVisible</a>().
|
---|
198 | <h3 class=fn>int <a name="progress-prop"></a>progress</h3>
|
---|
199 | <p>This property holds the current amount of progress.
|
---|
200 | <p>This property is -1 if progress counting has not started.
|
---|
201 |
|
---|
202 | <p>Set this property's value with <a href="#setProgress">setProgress</a>() and get this property's value with <a href="#progress">progress</a>().
|
---|
203 | <h3 class=fn><a href="qstring.html">QString</a> <a name="progressString-prop"></a>progressString</h3>
|
---|
204 | <p>This property holds the amount of progress as a string.
|
---|
205 | <p>This property is <a href="qstring.html#QString-null">QString::null</a> if progress counting has not started.
|
---|
206 |
|
---|
207 | <p>Get this property's value with <a href="#progressString">progressString</a>().
|
---|
208 | <h3 class=fn>int <a name="totalSteps-prop"></a>totalSteps</h3>
|
---|
209 | <p>This property holds the total number of steps.
|
---|
210 | <p>If totalSteps is 0, the progress bar will display a busy
|
---|
211 | indicator.
|
---|
212 | <p> <p>See also
|
---|
213 | <p>Set this property's value with <a href="#setTotalSteps">setTotalSteps</a>() and get this property's value with <a href="#totalSteps">totalSteps</a>().
|
---|
214 | <!-- eof -->
|
---|
215 | <hr><p>
|
---|
216 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
217 | Copyright © 1995-2007
|
---|
218 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
219 | <table width=100% cellspacing=0 border=0><tr>
|
---|
220 | <td>Copyright © 2007
|
---|
221 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
222 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
223 | </table></div></address></body>
|
---|
224 | </html>
|
---|