<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qfuturewatcher.cpp --> <title>Qt 4.8: QFutureWatcher Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qtcore.html">QtCore</a></li> <li>QFutureWatcher</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#public-slots">Public Slots</a></li> <li class="level1"><a href="#signals">Signals</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QFutureWatcher Class Reference</h1> <!-- $$$QFutureWatcher-brief --> <p>The QFutureWatcher class allows monitoring a <a href="qfuture.html">QFuture</a> using signals and slots. <a href="#details">More...</a></p> <!-- @@@QFutureWatcher --> <pre class="cpp"> <span class="preprocessor">#include <QFutureWatcher></span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p> <p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p> <p>This class was introduced in Qt 4.4.</p> <ul> <li><a href="qfuturewatcher-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#QFutureWatcher">QFutureWatcher</a></b> ( QObject * <i>parent</i> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#dtor.QFutureWatcher">~QFutureWatcher</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFuture<T> </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#future">future</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#isCanceled">isCanceled</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#isFinished">isFinished</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#isPaused">isPaused</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#isRunning">isRunning</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#isStarted">isStarted</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#progressMaximum">progressMaximum</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#progressMinimum">progressMinimum</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#progressText">progressText</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#progressValue">progressValue</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#result">result</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#resultAt">resultAt</a></b> ( int <i>index</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#setFuture">setFuture</a></b> ( const QFuture<T> & <i>future</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#setPendingResultsLimit">setPendingResultsLimit</a></b> ( int <i>limit</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#waitForFinished">waitForFinished</a></b> ()</td></tr> </table> <ul> <li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> </ul> <a name="public-slots"></a> <h2>Public Slots</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#cancel">cancel</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#pause">pause</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#resume">resume</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#setPaused">setPaused</a></b> ( bool <i>paused</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#togglePaused">togglePaused</a></b> ()</td></tr> </table> <ul> <li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li> </ul> <a name="signals"></a> <h2>Signals</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#canceled">canceled</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#finished">finished</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#paused">paused</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#progressRangeChanged">progressRangeChanged</a></b> ( int <i>minimum</i>, int <i>maximum</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#progressTextChanged">progressTextChanged</a></b> ( const QString & <i>progressText</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#progressValueChanged">progressValueChanged</a></b> ( int <i>progressValue</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#resultReadyAt">resultReadyAt</a></b> ( int <i>index</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#resultsReadyAt">resultsReadyAt</a></b> ( int <i>beginIndex</i>, int <i>endIndex</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#resumed">resumed</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturewatcher.html#started">started</a></b> ()</td></tr> </table> <ul> <li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li> <li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li> <li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> </ul> <a name="details"></a> <!-- $$$QFutureWatcher-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QFutureWatcher class allows monitoring a <a href="qfuture.html">QFuture</a> using signals and slots.</p> <p>QFutureWatcher provides information and notifications about a <a href="qfuture.html">QFuture</a>. Use the <a href="qfuturewatcher.html#setFuture">setFuture</a>() function to start watching a particular <a href="qfuture.html">QFuture</a>. The <a href="qfuturewatcher.html#future">future</a>() function returns the future set with <a href="qfuturewatcher.html#setFuture">setFuture</a>().</p> <p>For convenience, several of <a href="qfuture.html">QFuture</a>'s functions are also available in QFutureWatcher: <a href="qfuturewatcher.html#progressValue">progressValue</a>(), <a href="qfuturewatcher.html#progressMinimum">progressMinimum</a>(), <a href="qfuturewatcher.html#progressMaximum">progressMaximum</a>(), <a href="qfuturewatcher.html#progressText">progressText</a>(), <a href="qfuturewatcher.html#isStarted">isStarted</a>(), <a href="qfuturewatcher.html#isFinished">isFinished</a>(), <a href="qfuturewatcher.html#isRunning">isRunning</a>(), <a href="qfuturewatcher.html#isCanceled">isCanceled</a>(), <a href="qfuturewatcher.html#isPaused">isPaused</a>(), <a href="qfuturewatcher.html#waitForFinished">waitForFinished</a>(), <a href="qfuturewatcher.html#result">result</a>(), and <a href="qfuturewatcher.html#resultAt">resultAt</a>(). The <a href="qfuturewatcher.html#cancel">cancel</a>(), <a href="qfuturewatcher.html#setPaused">setPaused</a>(), <a href="qfuturewatcher.html#pause">pause</a>(), <a href="qfuturewatcher.html#resume">resume</a>(), and <a href="qfuturewatcher.html#togglePaused">togglePaused</a>() functions are slots in QFutureWatcher.</p> <p>Status changes are reported via the <a href="qfuturewatcher.html#started">started</a>(), <a href="qfuturewatcher.html#finished">finished</a>(), <a href="qfuturewatcher.html#canceled">canceled</a>(), <a href="qfuturewatcher.html#paused">paused</a>(), <a href="qfuturewatcher.html#resumed">resumed</a>(), <a href="qfuturewatcher.html#resultReadyAt">resultReadyAt</a>(), and <a href="qfuturewatcher.html#resultsReadyAt">resultsReadyAt</a>() signals. Progress information is provided from the <a href="qfuturewatcher.html#progressRangeChanged">progressRangeChanged</a>(), void <a href="qfuturewatcher.html#progressValueChanged">progressValueChanged</a>(), and <a href="qfuturewatcher.html#progressTextChanged">progressTextChanged</a>() signals.</p> <p>Throttling control is provided by the <a href="qfuturewatcher.html#setPendingResultsLimit">setPendingResultsLimit</a>() function. When the number of pending <a href="qfuturewatcher.html#resultReadyAt">resultReadyAt</a>() or <a href="qfuturewatcher.html#resultsReadyAt">resultsReadyAt</a>() signals exceeds the limit, the computation represented by the future will be throttled automatically. The computation will resume once the number of pending signals drops below the limit.</p> <p>Example: Starting a computation and getting a slot callback when it's finished:</p> <pre class="cpp"> <span class="comment">// Instantiate the objects and connect to the finished signal.</span> MyClass myObject; <span class="type">QFutureWatcher</span><span class="operator"><</span><span class="type">int</span><span class="operator">></span> watcher; <a href="qobject.html#connect">connect</a>(<span class="operator">&</span>watcher<span class="operator">,</span> SIGNAL(finished())<span class="operator">,</span> <span class="operator">&</span>myObject<span class="operator">,</span> SLOT(handleFinished())); <span class="comment">// Start the computation.</span> <span class="type"><a href="qfuture.html">QFuture</a></span><span class="operator"><</span><span class="type">int</span><span class="operator">></span> future <span class="operator">=</span> <span class="type"><a href="qtconcurrent.html">QtConcurrent</a></span><span class="operator">::</span>run(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>); watcher<span class="operator">.</span><a href="qfuturewatcher.html#setFuture">setFuture</a>(future);</pre> <p>Be aware that not all asynchronous computations can be canceled or paused. For example, the future returned by <a href="qtconcurrentrun.html#run">QtConcurrent::run</a>() cannot be canceled; but the future returned by <a href="qtconcurrentmap.html#mappedReduced">QtConcurrent::mappedReduced</a>() can.</p> <p>QFutureWatcher<void> is specialized to not contain any of the result fetching functions. Any <a href="qfuture.html">QFuture</a><T> can be watched by a QFutureWatcher<void> as well. This is useful if only status or progress information is needed; not the actual result data.</p> </div> <p><b>See also </b><a href="qfuture.html">QFuture</a> and <a href="threads-qtconcurrent.html">Qt Concurrent</a>.</p> <!-- @@@QFutureWatcher --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QFutureWatcher[overload1]$$$QFutureWatcherQObject* --> <h3 class="fn"><a name="QFutureWatcher"></a>QFutureWatcher::<span class="name">QFutureWatcher</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3> <p>Constructs a new <a href="qfuturewatcher.html">QFutureWatcher</a> with the given <i>parent</i>.</p> <!-- @@@QFutureWatcher --> <!-- $$$~QFutureWatcher[overload1]$$$~QFutureWatcher --> <h3 class="fn"><a name="dtor.QFutureWatcher"></a>QFutureWatcher::<span class="name">~QFutureWatcher</span> ()</h3> <p>Destroys the <a href="qfuturewatcher.html">QFutureWatcher</a>.</p> <!-- @@@~QFutureWatcher --> <!-- $$$cancel[overload1]$$$cancel --> <h3 class="fn"><a name="cancel"></a><span class="type">void</span> QFutureWatcher::<span class="name">cancel</span> ()<tt> [slot]</tt></h3> <p>Cancels the asynchronous computation represented by the <a href="qfuturewatcher.html#future">future</a>(). Note that the cancelation is asynchronous. Use <a href="qfuturewatcher.html#waitForFinished">waitForFinished</a>() after calling cancel() when you need synchronous cancelation.</p> <p>Currently available results may still be accessed on a canceled <a href="qfuture.html">QFuture</a>, but new results will <i>not</i> become available after calling this function. Also, this <a href="qfuturewatcher.html">QFutureWatcher</a> will not deliver progress and result ready signals once canceled. This includes the <a href="qfuturewatcher.html#progressValueChanged">progressValueChanged</a>(), <a href="qfuturewatcher.html#progressRangeChanged">progressRangeChanged</a>(), <a href="qfuturewatcher.html#progressTextChanged">progressTextChanged</a>(), <a href="qfuturewatcher.html#resultReadyAt">resultReadyAt</a>(), and <a href="qfuturewatcher.html#resultsReadyAt">resultsReadyAt</a>() signals.</p> <p>Be aware that not all asynchronous computations can be canceled. For example, the <a href="qfuture.html">QFuture</a> returned by <a href="qtconcurrentrun.html#run">QtConcurrent::run</a>() cannot be canceled; but the <a href="qfuture.html">QFuture</a> returned by <a href="qtconcurrentmap.html#mappedReduced">QtConcurrent::mappedReduced</a>() can.</p> <!-- @@@cancel --> <!-- $$$canceled[overload1]$$$canceled --> <h3 class="fn"><a name="canceled"></a><span class="type">void</span> QFutureWatcher::<span class="name">canceled</span> ()<tt> [signal]</tt></h3> <p>This signal is emitted if the watched future is canceled.</p> <!-- @@@canceled --> <!-- $$$finished[overload1]$$$finished --> <h3 class="fn"><a name="finished"></a><span class="type">void</span> QFutureWatcher::<span class="name">finished</span> ()<tt> [signal]</tt></h3> <p>This signal is emitted when the watched future finishes.</p> <!-- @@@finished --> <!-- $$$future[overload1]$$$future --> <h3 class="fn"><a name="future"></a><span class="type"><a href="qfuture.html">QFuture</a></span><<span class="type">T</span>> QFutureWatcher::<span class="name">future</span> () const</h3> <p>Returns the watched future.</p> <p><b>See also </b><a href="qfuturewatcher.html#setFuture">setFuture</a>().</p> <!-- @@@future --> <!-- $$$isCanceled[overload1]$$$isCanceled --> <h3 class="fn"><a name="isCanceled"></a><span class="type">bool</span> QFutureWatcher::<span class="name">isCanceled</span> () const</h3> <p>Returns true if the asynchronous computation has been canceled with the <a href="qfuturewatcher.html#cancel">cancel</a>() function; otherwise returns false.</p> <p>Be aware that the computation may still be running even though this function returns true. See <a href="qfuturewatcher.html#cancel">cancel</a>() for more details.</p> <!-- @@@isCanceled --> <!-- $$$isFinished[overload1]$$$isFinished --> <h3 class="fn"><a name="isFinished"></a><span class="type">bool</span> QFutureWatcher::<span class="name">isFinished</span> () const</h3> <p>Returns true if the asynchronous computation represented by the <a href="qfuturewatcher.html#future">future</a>() has finished; otherwise returns false.</p> <!-- @@@isFinished --> <!-- $$$isPaused[overload1]$$$isPaused --> <h3 class="fn"><a name="isPaused"></a><span class="type">bool</span> QFutureWatcher::<span class="name">isPaused</span> () const</h3> <p>Returns true if the asynchronous computation has been paused with the <a href="qfuturewatcher.html#pause">pause</a>() function; otherwise returns false.</p> <p>Be aware that the computation may still be running even though this function returns true. See <a href="qfuturewatcher.html#setPaused">setPaused</a>() for more details.</p> <p><b>See also </b><a href="qfuturewatcher.html#setPaused">setPaused</a>() and <a href="qfuturewatcher.html#togglePaused">togglePaused</a>().</p> <!-- @@@isPaused --> <!-- $$$isRunning[overload1]$$$isRunning --> <h3 class="fn"><a name="isRunning"></a><span class="type">bool</span> QFutureWatcher::<span class="name">isRunning</span> () const</h3> <p>Returns true if the asynchronous computation represented by the <a href="qfuturewatcher.html#future">future</a>() is currently running; otherwise returns false.</p> <!-- @@@isRunning --> <!-- $$$isStarted[overload1]$$$isStarted --> <h3 class="fn"><a name="isStarted"></a><span class="type">bool</span> QFutureWatcher::<span class="name">isStarted</span> () const</h3> <p>Returns true if the asynchronous computation represented by the <a href="qfuturewatcher.html#future">future</a>() has been started; otherwise returns false.</p> <!-- @@@isStarted --> <!-- $$$pause[overload1]$$$pause --> <h3 class="fn"><a name="pause"></a><span class="type">void</span> QFutureWatcher::<span class="name">pause</span> ()<tt> [slot]</tt></h3> <p>Pauses the asynchronous computation represented by the <a href="qfuturewatcher.html#future">future</a>(). This is a convenience method that simply calls setPaused(true).</p> <p><b>See also </b><a href="qfuturewatcher.html#resume">resume</a>().</p> <!-- @@@pause --> <!-- $$$paused[overload1]$$$paused --> <h3 class="fn"><a name="paused"></a><span class="type">void</span> QFutureWatcher::<span class="name">paused</span> ()<tt> [signal]</tt></h3> <p>This signal is emitted when the watched future is paused.</p> <p><b>See also </b><a href="qfuturewatcher.html#setPaused">setPaused</a>().</p> <!-- @@@paused --> <!-- $$$progressMaximum[overload1]$$$progressMaximum --> <h3 class="fn"><a name="progressMaximum"></a><span class="type">int</span> QFutureWatcher::<span class="name">progressMaximum</span> () const</h3> <p>Returns the maximum <a href="qfuturewatcher.html#progressValue">progressValue</a>().</p> <p><b>See also </b><a href="qfuturewatcher.html#progressValue">progressValue</a>() and <a href="qfuturewatcher.html#progressMinimum">progressMinimum</a>().</p> <!-- @@@progressMaximum --> <!-- $$$progressMinimum[overload1]$$$progressMinimum --> <h3 class="fn"><a name="progressMinimum"></a><span class="type">int</span> QFutureWatcher::<span class="name">progressMinimum</span> () const</h3> <p>Returns the minimum <a href="qfuturewatcher.html#progressValue">progressValue</a>().</p> <p><b>See also </b><a href="qfuturewatcher.html#progressValue">progressValue</a>() and <a href="qfuturewatcher.html#progressMaximum">progressMaximum</a>().</p> <!-- @@@progressMinimum --> <!-- $$$progressRangeChanged[overload1]$$$progressRangeChangedintint --> <h3 class="fn"><a name="progressRangeChanged"></a><span class="type">void</span> QFutureWatcher::<span class="name">progressRangeChanged</span> ( <span class="type">int</span> <i>minimum</i>, <span class="type">int</span> <i>maximum</i> )<tt> [signal]</tt></h3> <p>The progress range for the watched future has changed to <i>minimum</i> and <i>maximum</i></p> <!-- @@@progressRangeChanged --> <!-- $$$progressText[overload1]$$$progressText --> <h3 class="fn"><a name="progressText"></a><span class="type"><a href="qstring.html">QString</a></span> QFutureWatcher::<span class="name">progressText</span> () const</h3> <p>Returns the (optional) textual representation of the progress as reported by the asynchronous computation.</p> <p>Be aware that not all computations provide a textual representation of the progress, and as such, this function may return an empty string.</p> <!-- @@@progressText --> <!-- $$$progressTextChanged[overload1]$$$progressTextChangedconstQString& --> <h3 class="fn"><a name="progressTextChanged"></a><span class="type">void</span> QFutureWatcher::<span class="name">progressTextChanged</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>progressText</i> )<tt> [signal]</tt></h3> <p>This signal is emitted when the watched future reports textual progress information, <i>progressText</i>.</p> <!-- @@@progressTextChanged --> <!-- $$$progressValue[overload1]$$$progressValue --> <h3 class="fn"><a name="progressValue"></a><span class="type">int</span> QFutureWatcher::<span class="name">progressValue</span> () const</h3> <p>Returns the current progress value, which is between the <a href="qfuturewatcher.html#progressMinimum">progressMinimum</a>() and <a href="qfuturewatcher.html#progressMaximum">progressMaximum</a>().</p> <p><b>See also </b><a href="qfuturewatcher.html#progressMinimum">progressMinimum</a>() and <a href="qfuturewatcher.html#progressMaximum">progressMaximum</a>().</p> <!-- @@@progressValue --> <!-- $$$progressValueChanged[overload1]$$$progressValueChangedint --> <h3 class="fn"><a name="progressValueChanged"></a><span class="type">void</span> QFutureWatcher::<span class="name">progressValueChanged</span> ( <span class="type">int</span> <i>progressValue</i> )<tt> [signal]</tt></h3> <p>This signal is emitted when the watched future reports progress, <i>progressValue</i> gives the current progress. In order to avoid overloading the GUI event loop, <a href="qfuturewatcher.html">QFutureWatcher</a> limits the progress signal emission rate. This means that listeners connected to this slot might not get all progress reports the future makes. The last progress update (where <i>progressValue</i> equals the maximum value) will always be delivered.</p> <!-- @@@progressValueChanged --> <!-- $$$result[overload1]$$$result --> <h3 class="fn"><a name="result"></a><span class="type">T</span> QFutureWatcher::<span class="name">result</span> () const</h3> <p>Returns the first result in the <a href="qfuturewatcher.html#future">future</a>(). If the result is not immediately available, this function will block and wait for the result to become available. This is a convenience method for calling resultAt(0).</p> <p><b>See also </b><a href="qfuturewatcher.html#resultAt">resultAt</a>().</p> <!-- @@@result --> <!-- $$$resultAt[overload1]$$$resultAtint --> <h3 class="fn"><a name="resultAt"></a><span class="type">T</span> QFutureWatcher::<span class="name">resultAt</span> ( <span class="type">int</span> <i>index</i> ) const</h3> <p>Returns the result at <i>index</i> in the <a href="qfuturewatcher.html#future">future</a>(). If the result is not immediately available, this function will block and wait for the result to become available.</p> <p><b>See also </b><a href="qfuturewatcher.html#result">result</a>().</p> <!-- @@@resultAt --> <!-- $$$resultReadyAt[overload1]$$$resultReadyAtint --> <h3 class="fn"><a name="resultReadyAt"></a><span class="type">void</span> QFutureWatcher::<span class="name">resultReadyAt</span> ( <span class="type">int</span> <i>index</i> )<tt> [signal]</tt></h3> <p>This signal is emitted when the watched future reports a ready result at <i>index</i>. If the future reports multiple results, the index will indicate which one it is. Results can be reported out-of-order. To get the result, call <a href="qfuturewatcher.html#future">future</a>().result(index);</p> <!-- @@@resultReadyAt --> <!-- $$$resultsReadyAt[overload1]$$$resultsReadyAtintint --> <h3 class="fn"><a name="resultsReadyAt"></a><span class="type">void</span> QFutureWatcher::<span class="name">resultsReadyAt</span> ( <span class="type">int</span> <i>beginIndex</i>, <span class="type">int</span> <i>endIndex</i> )<tt> [signal]</tt></h3> <p>This signal is emitted when the watched future reports ready results. The results are indexed from <i>beginIndex</i> to <i>endIndex</i>.</p> <!-- @@@resultsReadyAt --> <!-- $$$resume[overload1]$$$resume --> <h3 class="fn"><a name="resume"></a><span class="type">void</span> QFutureWatcher::<span class="name">resume</span> ()<tt> [slot]</tt></h3> <p>Resumes the asynchronous computation represented by the <a href="qfuturewatcher.html#future">future</a>(). This is a convenience method that simply calls setPaused(false).</p> <p><b>See also </b><a href="qfuturewatcher.html#pause">pause</a>().</p> <!-- @@@resume --> <!-- $$$resumed[overload1]$$$resumed --> <h3 class="fn"><a name="resumed"></a><span class="type">void</span> QFutureWatcher::<span class="name">resumed</span> ()<tt> [signal]</tt></h3> <p>This signal is emitted when the watched future is resumed.</p> <!-- @@@resumed --> <!-- $$$setFuture[overload1]$$$setFutureconstQFuture<T>& --> <h3 class="fn"><a name="setFuture"></a><span class="type">void</span> QFutureWatcher::<span class="name">setFuture</span> ( const <span class="type"><a href="qfuture.html">QFuture</a></span><<span class="type">T</span>> & <i>future</i> )</h3> <p>Starts watching the given <i>future</i>.</p> <p>One of the signals might be emitted for the current state of the <i>future</i>. For example, if the future is already stopped, the finished signal will be emitted.</p> <p>To avoid a race condition, it is important to call this function <i>after</i> doing the connections.</p> <p><b>See also </b><a href="qfuturewatcher.html#future">future</a>().</p> <!-- @@@setFuture --> <!-- $$$setPaused[overload1]$$$setPausedbool --> <h3 class="fn"><a name="setPaused"></a><span class="type">void</span> QFutureWatcher::<span class="name">setPaused</span> ( <span class="type">bool</span> <i>paused</i> )<tt> [slot]</tt></h3> <p>If <i>paused</i> is true, this function pauses the asynchronous computation represented by the <a href="qfuturewatcher.html#future">future</a>(). If the computation is already paused, this function does nothing. This <a href="qfuturewatcher.html">QFutureWatcher</a> will stop delivering progress and result ready signals while the future is paused. Signal delivery will continue once the computation is resumed.</p> <p>If <i>paused</i> is false, this function resumes the asynchronous computation. If the computation was not previously paused, this function does nothing.</p> <p>Be aware that not all computations can be paused. For example, the <a href="qfuture.html">QFuture</a> returned by <a href="qtconcurrentrun.html#run">QtConcurrent::run</a>() cannot be paused; but the <a href="qfuture.html">QFuture</a> returned by <a href="qtconcurrentmap.html#mappedReduced">QtConcurrent::mappedReduced</a>() can.</p> <p><b>See also </b><a href="qfuturewatcher.html#paused">paused</a>(), <a href="qfuturewatcher.html#pause">pause</a>(), <a href="qfuturewatcher.html#resume">resume</a>(), and <a href="qfuturewatcher.html#togglePaused">togglePaused</a>().</p> <!-- @@@setPaused --> <!-- $$$setPendingResultsLimit[overload1]$$$setPendingResultsLimitint --> <h3 class="fn"><a name="setPendingResultsLimit"></a><span class="type">void</span> QFutureWatcher::<span class="name">setPendingResultsLimit</span> ( <span class="type">int</span> <i>limit</i> )</h3> <p>The setPendingResultsLimit() provides throttling control. When the number of pending <a href="qfuturewatcher.html#resultReadyAt">resultReadyAt</a>() or <a href="qfuturewatcher.html#resultsReadyAt">resultsReadyAt</a>() signals exceeds the <i>limit</i>, the computation represented by the future will be throttled automatically. The computation will resume once the number of pending signals drops below the <i>limit</i>.</p> <!-- @@@setPendingResultsLimit --> <!-- $$$started[overload1]$$$started --> <h3 class="fn"><a name="started"></a><span class="type">void</span> QFutureWatcher::<span class="name">started</span> ()<tt> [signal]</tt></h3> <p>This signal is emitted when this <a href="qfuturewatcher.html">QFutureWatcher</a> starts watching the future set with <a href="qfuturewatcher.html#setFuture">setFuture</a>().</p> <!-- @@@started --> <!-- $$$togglePaused[overload1]$$$togglePaused --> <h3 class="fn"><a name="togglePaused"></a><span class="type">void</span> QFutureWatcher::<span class="name">togglePaused</span> ()<tt> [slot]</tt></h3> <p>Toggles the paused state of the asynchronous computation. In other words, if the computation is currently paused, calling this function resumes it; if the computation is running, it becomes paused. This is a convenience method for calling setPaused(!<a href="qfuturewatcher.html#isPaused">isPaused</a>()).</p> <p><b>See also </b><a href="qfuturewatcher.html#setPaused">setPaused</a>(), <a href="qfuturewatcher.html#pause">pause</a>(), and <a href="qfuturewatcher.html#resume">resume</a>().</p> <!-- @@@togglePaused --> <!-- $$$waitForFinished[overload1]$$$waitForFinished --> <h3 class="fn"><a name="waitForFinished"></a><span class="type">void</span> QFutureWatcher::<span class="name">waitForFinished</span> ()</h3> <p>Waits for the asynchronous computation to finish (including <a href="qfuturewatcher.html#cancel">cancel</a>()ed computations).</p> <!-- @@@waitForFinished --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>