Obsolete Members for QtFuture

以下成員源於類 QtFuture 被棄用。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

函數

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

[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 > & values )

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

該函數在 Qt 6.1 引入。

另請參閱 QFuture , QtFuture::makeReadyVoidFuture (), QtFuture::makeReadyValueFuture (), QtFuture::makeReadyRangeFuture (),和 QtFuture::makeExceptionalFuture ().