Obsolete Members for QtFuture

以下成员源于类 QtFuture 被弃用。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

函数

(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> & )
(since 6.1, deprecated in 6.6) QFuture<void> makeReadyFuture ()

函数文档编制

[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.

这是重载函数。

使用 makeReadyValueFuture () 代替。

创建并返回 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.

该函数在 Qt 6.1 引入。

另请参阅 QFuture , QtFuture::makeReadyVoidFuture (), QtFuture::makeReadyValueFuture (), QtFuture::makeReadyRangeFuture (),和 QtFuture::makeExceptionalFuture ().

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

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

这是重载函数。

使用 makeReadyRangeFuture () 代替。

创建并返回 QFuture which already has multiple results set from .

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.

该函数在 Qt 6.1 引入。

另请参阅 QFuture , QtFuture::makeReadyVoidFuture (), QtFuture::makeReadyValueFuture (), QtFuture::makeReadyRangeFuture (),和 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.

这是重载函数。

使用 makeReadyVoidFuture () 代替。

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.

该函数在 Qt 6.1 引入。

另请参阅 QFuture , QFuture::isStarted (), QFuture::isRunning (), QFuture::isFinished (), QtFuture::makeReadyVoidFuture (), QtFuture::makeReadyValueFuture (), QtFuture::makeReadyRangeFuture (),和 QtFuture::makeExceptionalFuture ().