Obsolete Members for QtFuture

The following members of class QtFuture are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

Functions

(since 6.1, deprecated in 6.6) QFuture<std::decay_t<T>> makeReadyFuture(T &&value)
(since 6.1, deprecated in 6.6) QFuture<T> makeReadyFuture(const QList<T> &values)
(since 6.1, deprecated in 6.6) QFuture<void> makeReadyFuture()

Function Documentation

[since 6.1, deprecated in 6.6] template <typename T, typename = QtPrivate::EnableForNonVoid<T>> QFuture<std::decay_t<T>> QtFuture::makeReadyFuture(T &&value)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use makeReadyValueFuture() instead.

Creates and returns a QFuture which already has a result value. The returned QFuture has a type of std::decay_t<T>, where T is not void.

auto f = QtFuture::makeReadyFuture(std::make_unique<int>(42));
...
const int result = *f.takeResult(); // result == 42

The method should be avoided because it has an inconsistent set of overloads. From Qt 6.10 onwards, using it in code will result in compiler warnings.

This function was introduced in Qt 6.1.

See also QFuture, QtFuture::makeReadyVoidFuture(), QtFuture::makeReadyValueFuture(), QtFuture::makeReadyRangeFuture(), and QtFuture::makeExceptionalFuture().

[since 6.1, deprecated in 6.6] template <typename T> QFuture<T> QtFuture::makeReadyFuture(const QList<T> &values)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use makeReadyRangeFuture() instead.

Creates and returns a QFuture which already has multiple results set from values.

const QList<int> values { 1, 2, 3 };
auto f = QtFuture::makeReadyFuture(values);
...
const int count = f.resultCount(); // count == 3
const auto results = f.results(); // results == { 1, 2, 3 }

The method should be avoided because it has an inconsistent set of overloads. From Qt 6.10 onwards, using it in code will result in compiler warnings.

This function was introduced in Qt 6.1.

See also QFuture, QtFuture::makeReadyVoidFuture(), QtFuture::makeReadyValueFuture(), QtFuture::makeReadyRangeFuture(), and QtFuture::makeExceptionalFuture().

[since 6.1, deprecated in 6.6] QFuture<void> QtFuture::makeReadyFuture()

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use makeReadyVoidFuture() instead.

Creates and returns a void QFuture. Such QFuture can't store any result. One can use it to query the state of the computation. The returned QFuture will always be in the finished state.

auto f = QtFuture::makeReadyFuture();
...
const bool started = f.isStarted(); // started == true
const bool running = f.isRunning(); // running == false
const bool finished = f.isFinished(); // finished == true

The method should be avoided because it has an inconsistent set of overloads. From Qt 6.10 onwards, using it in code will result in compiler warnings.

This function was introduced in Qt 6.1.

See also QFuture, QFuture::isStarted(), QFuture::isRunning(), QFuture::isFinished(), QtFuture::makeReadyVoidFuture(), QtFuture::makeReadyValueFuture(), QtFuture::makeReadyRangeFuture(), and QtFuture::makeExceptionalFuture().

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.