Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.core
Class QFutureWatcher

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.core.QFutureWatcherBase
                          com.trolltech.qt.core.QFutureWatcher

All Implemented Interfaces:
  QtJambiInterface

    public class QFutureWatcher

extends QFutureWatcherBase

The QFutureWatcher class allows monitoring a `QFuture` using signals and slots. QFutureWatcher provides information and notifications about a `QFuture`. Use the `setFuture()` function to start watching a particular `QFuture`. The `future()` function returns the future set with `setFuture()`.

For convenience, several of `QFuture`'s functions are also available in QFutureWatcher: progressValue(), progressMinimum(), progressMaximum(), progressText(), isStarted(), isFinished(), isRunning(), isCanceled(), isPaused(), waitForFinished(), `result()`, and `resultAt()`. The cancel(), setPaused(), pause(), resume(), and togglePaused() functions are slots in QFutureWatcher.

Status changes are reported via the started(), finished(), canceled(), paused(), resumed(), resultReadyAt(), and resultsReadyAt() signals. Progress information is provided from the progressRangeChanged(), void progressValueChanged(), and progressTextChanged() signals.

Throttling control is provided by the setPendingResultsLimit() function. When the number of pending resultReadyAt() or resultsReadyAt() 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.

Example: Starting a computation and getting a slot callback when it's finished:

        // Instantiate the objects and connect to the finished signal.
        MyClass myObject = new MyClass();
        QFutureWatcher<Integer> watcher = new QFutureWatcher<Integer>();
        watcher.finished.connect(myObject, "handleFinished()");

        // Start the computation.
        QFuture<Integer> future = QtConcurrent.run(this, method, arg1, arg2);
        watcher.setFuture(future);

Be aware that not all asynchronous computations can be canceled or paused. For example, the future returned by QtConcurrent::run() cannot be canceled; but the future returned by QtConcurrent::mappedReduced() can.

QFutureWatcher<void> is specialized to not contain any of the result fetching functions. Any `QFuture`<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.

See also:
  `QFuture`, and Qt Concurrent.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.core.QFutureWatcherBase
`canceled, finished, paused, progressRangeChanged, progressTextChanged, progressValueChanged, resultReadyAt, resultsReadyAt, resumed, started`

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QFutureWatcher()` Constructs a new QFutureWatcher with the given `parent`.
`QFutureWatcher(QObject _parent)` Constructs a new QFutureWatcher with the given `parent`.

Method Summary
`QFuture` | `future()` Returns the watched future.
`java.lang.Object` | `result()` Returns the first result in the `future()`.
`java.lang.Object` | `resultAt(int index)` Returns the result at `index` in the `future()`.
`void` | `setFuture(QFuture future)` Starts watching the given `future`.

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QFutureWatcher

    public QFutureWatcher()

  Constructs a new QFutureWatcher with the given `parent`.

### QFutureWatcher

    public QFutureWatcher(QObject _parent)

  Constructs a new QFutureWatcher with the given `parent`.

Method Detail

### result

    public final java.lang.Object result()

  Returns the first result in the `future()`. 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).

See also:
  `resultAt()`.

### resultAt

    public final java.lang.Object resultAt(int index)

  Returns the result at `index` in the `future()`. If the result is not immediately available, this function will block and wait for the result to become available.

See also:
  `result()`.

### setFuture

    public final void setFuture(QFuture future)

  Starts watching the given `future`.

See also:
  `future()`.

### future

    public final QFuture future()

  Returns the watched future.

See also:
  `setFuture()`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD