30 std::is_copy_constructible_v<T> || std::is_move_constructible_v<T> ||
31 std::is_same_v<T, void>,
32 "Type with copy or move constructors or type void is required");
41 other.d = QFutureInterface<T>();
44 QPromise(QFutureInterface<T> & other) : d(other) {}
56 if (d.queryState(QFutureInterfaceBase::State::NoState)) {
62 if (!d.queryState(QFutureInterfaceBase::State::Finished)) {
69 QFuture<T> future()
const
75 typename = std::enable_if_t<
76 std::is_same_v<U, T> || std::is_convertible_v<U, T>>>
77 void addResult(U && result,
int index = -1)
79 d.reportResult(std::forward<U>(result), index);
82 void setException(
const QException & e)
96 void suspendIfRequested()
98 d.suspendIfRequested();
101 bool isCanceled()
const
103 return d.isCanceled();
107 void setProgressRange(
int minimum,
int maximum)
109 d.setProgressRange(minimum, maximum);
111 void setProgressValue(
int progressValue)
113 d.setProgressValue(progressValue);
115 void setProgressValueAndText(
116 int progressValue,
const QString & progressText)
118 d.setProgressValueAndText(progressValue, progressText);
123 qSwap(this->d, other.d);
127 mutable QFutureInterface<T> d = QFutureInterface<T>();