Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QPromise< T > Class Template Reference

#include <qpromise.h>

+ Collaboration diagram for QPromise< T >:

Public Member Functions

 QPromise ()=default
 
 QPromise (QPromise< T > &&other)=default
 
 QPromise (const QFutureInterface< T > &other)
 
 QPromise (QFutureInterface< T > &&other) noexcept
 
 ~QPromise ()
 
QFuture< T > future () const
 
template<typename... Args, std::enable_if_t< std::is_constructible_v< T, Args... >, bool > = true>
bool emplaceResultAt (int index, Args &&...args)
 
template<typename... Args, std::enable_if_t< std::is_constructible_v< T, Args... >, bool > = true>
bool emplaceResult (Args &&...args)
 
template<typename U = T, typename = QtPrivate::EnableIfSameOrConvertible<U, T>>
bool addResult (U &&result, int index=-1)
 
bool addResults (const QList< T > &result)
 
void setException (const QException &e)
 
void setException (const std::exception_ptr &e)
 
void start ()
 
void finish ()
 
void suspendIfRequested ()
 
bool isCanceled () const
 
void setProgressRange (int minimum, int maximum)
 
void setProgressValue (int progressValue)
 
void setProgressValueAndText (int progressValue, const QString &progressText)
 
void swap (QPromise< T > &other) noexcept
 

Detailed Description

template<typename T>
class QPromise< T >

Definition at line 24 of file qpromise.h.

Constructor & Destructor Documentation

◆ QPromise() [1/4]

template<typename T >
QPromise< T >::QPromise ( )
default

◆ QPromise() [2/4]

template<typename T >
QPromise< T >::QPromise ( QPromise< T > &&  other)
default

◆ QPromise() [3/4]

template<typename T >
QPromise< T >::QPromise ( const QFutureInterface< T > &  other)
inline

Definition at line 33 of file qpromise.h.

◆ QPromise() [4/4]

template<typename T >
QPromise< T >::QPromise ( QFutureInterface< T > &&  other)
inlinenoexcept

Definition at line 34 of file qpromise.h.

◆ ~QPromise()

template<typename T >
QPromise< T >::~QPromise ( )
inline

Definition at line 36 of file qpromise.h.

References QFutureInterfaceBase::Finished.

Member Function Documentation

◆ addResult()

template<typename T >
template<typename U = T, typename = QtPrivate::EnableIfSameOrConvertible<U, T>>
bool QPromise< T >::addResult ( U &&  result,
int  index = -1 
)
inline

Definition at line 60 of file qpromise.h.

Referenced by aFunction(), cancel(), QtPrivate::WhenAllContext< ResultFutures >::checkForCompletion(), QtPrivate::WhenAnyContext< ResultType >::checkForCompletion(), QtPrivate::fulfillPromise(), QtPrivate::fulfillPromise(), helloWorldFunction(), increment(), and QQmlXmlListModelQueryRunnable::run().

+ Here is the caller graph for this function:

◆ addResults()

template<typename T >
bool QPromise< T >::addResults ( const QList< T > &  result)
inline

Definition at line 64 of file qpromise.h.

◆ emplaceResult()

template<typename T >
template<typename... Args, std::enable_if_t< std::is_constructible_v< T, Args... >, bool > = true>
bool QPromise< T >::emplaceResult ( Args &&...  args)
inline

Definition at line 55 of file qpromise.h.

References args.

◆ emplaceResultAt()

template<typename T >
template<typename... Args, std::enable_if_t< std::is_constructible_v< T, Args... >, bool > = true>
bool QPromise< T >::emplaceResultAt ( int  index,
Args &&...  args 
)
inline

Definition at line 50 of file qpromise.h.

References args.

◆ finish()

template<typename T >
void QPromise< T >::finish ( )
inline

Definition at line 75 of file qpromise.h.

Referenced by QtPrivate::WhenAllContext< ResultFutures >::checkForCompletion(), QtPrivate::WhenAnyContext< ResultType >::checkForCompletion(), and QQmlXmlListModelQueryRunnable::run().

+ Here is the caller graph for this function:

◆ future()

template<typename T >
QFuture< T > QPromise< T >::future ( ) const
inline

Definition at line 48 of file qpromise.h.

Referenced by QQmlXmlListModelQueryRunnable::future().

+ Here is the caller graph for this function:

◆ isCanceled()

template<typename T >
bool QPromise< T >::isCanceled ( ) const
inline

Definition at line 79 of file qpromise.h.

Referenced by aFunction(), and QQmlXmlListModelQueryRunnable::run().

+ Here is the caller graph for this function:

◆ setException() [1/2]

template<typename T >
void QPromise< T >::setException ( const QException e)
inline

Definition at line 67 of file qpromise.h.

References e.

◆ setException() [2/2]

template<typename T >
void QPromise< T >::setException ( const std::exception_ptr &  e)
inline

Definition at line 71 of file qpromise.h.

References e.

◆ setProgressRange()

template<typename T >
void QPromise< T >::setProgressRange ( int  minimum,
int  maximum 
)
inline

Definition at line 82 of file qpromise.h.

Referenced by cancel().

+ Here is the caller graph for this function:

◆ setProgressValue()

template<typename T >
void QPromise< T >::setProgressValue ( int  progressValue)
inline

Definition at line 83 of file qpromise.h.

Referenced by cancel().

+ Here is the caller graph for this function:

◆ setProgressValueAndText()

template<typename T >
void QPromise< T >::setProgressValueAndText ( int  progressValue,
const QString progressText 
)
inline

Definition at line 84 of file qpromise.h.

◆ start()

template<typename T >
void QPromise< T >::start ( )
inline

Definition at line 74 of file qpromise.h.

Referenced by QQmlXmlListModelQueryRunnable::run().

+ Here is the caller graph for this function:

◆ suspendIfRequested()

template<typename T >
void QPromise< T >::suspendIfRequested ( )
inline

Definition at line 77 of file qpromise.h.

Referenced by aFunction().

+ Here is the caller graph for this function:

◆ swap()

template<typename T >
void QPromise< T >::swap ( QPromise< T > &  other)
inlinenoexcept

Definition at line 89 of file qpromise.h.

References other().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: