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.
225 lines
14 KiB
225 lines
14 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/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 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>QProgressBar Class Reference</h1>
|
||
|
|
||
|
<p>The QProgressBar widget provides a horizontal progress bar.
|
||
|
<a href="#details">More...</a>
|
||
|
<p><tt>#include <<a href="qprogressbar-h.html">qprogressbar.h</a>></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 * parent = 0, const char * name = 0, WFlags f = 0 )</li>
|
||
|
<li class=fn><a href="#QProgressBar-2"><b>QProgressBar</b></a> ( int totalSteps, QWidget * parent = 0, const char * name = 0, WFlags 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 & <a href="#progressString"><b>progressString</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setCenterIndicator"><b>setCenterIndicator</b></a> ( bool 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 totalSteps )</li>
|
||
|
<li class=fn>virtual 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>
|
||
|
</ul>
|
||
|
<h2>Properties</h2>
|
||
|
<ul>
|
||
|
<li class=fn>bool <a href="#centerIndicator-prop"><b>centerIndicator</b></a> - whether the indicator string should be centered</li>
|
||
|
<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>
|
||
|
<li class=fn>bool <a href="#percentageVisible-prop"><b>percentageVisible</b></a> - whether the current progress value is displayed</li>
|
||
|
<li class=fn>int <a href="#progress-prop"><b>progress</b></a> - the current amount of progress</li>
|
||
|
<li class=fn>QString <a href="#progressString-prop"><b>progressString</b></a> - the amount of progress as a string <em>(read only)</em></li>
|
||
|
<li class=fn>int <a href="#totalSteps-prop"><b>totalSteps</b></a> - 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 & indicator, int progress, int 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> * parent = 0, const char * name = 0, WFlags 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 totalSteps, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags 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 <a href="qstring.html">QString</a> & <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 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> & indicator, int progress, int 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 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 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 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 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 © 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>
|