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()
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
这是一个重载函数。
请使用makeReadyVoidFuture() 代替。
创建并返回 voidQFuture 。这样的QFuture 不能存储任何结果。我们可以用它来查询计算的状态。返回的QFuture 将始终处于完成状态。
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
应避免使用该方法,因为它有一组不一致的重载。从 Qt 6.10 开始,在代码中使用该方法将导致编译器警告。
该函数在 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)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
这是一个重载函数。
请使用makeReadyValueFuture() 代替。
创建并返回一个已有结果value 的QFuture 。返回的QFuture 类型为 std::decoration_t<T>,其中 T 不是 void。
auto f = QtFuture::makeReadyFuture(std::make_unique<int>(42)); ... const int result = *f.takeResult(); // result == 42
应避免使用该方法,因为它有一组不一致的重载。从 Qt 6.10 开始,在代码中使用该方法将导致编译器警告。
该函数在 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)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
这是一个重载函数。
请使用makeReadyRangeFuture() 代替。
创建并返回一个QFuture ,该 已包含来自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 }
应避免使用该方法,因为它有一组不一致的重载。从 Qt 6.10 开始,在代码中使用该函数将导致编译器警告。
该函数在 Qt 6.1 中引入。
另请参阅 QFuture,QtFuture::makeReadyVoidFuture(),QtFuture::makeReadyValueFuture(),QtFuture::makeReadyRangeFuture() 和QtFuture::makeExceptionalFuture().
© 2025 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.