QFutureSynchronizer< T > Class Template Reference

QFutureSynchronizer< T > Class Template Reference

#include <qfuturesynchronizer.h>

Class Description

template<typename T>
class QFutureSynchronizer< T >

Definition at line 55 of file qfuturesynchronizer.h.

Public Member Functions

 QFutureSynchronizer ()
 
 QFutureSynchronizer (const QFuture< T > &future)
 
 ~QFutureSynchronizer ()
 
void setFuture (const QFuture< T > &future)
 
void addFuture (const QFuture< T > &future)
 
void waitForFinished ()
 
void clearFutures ()
 
QList< QFuture< T > > futures () const
 
void setCancelOnWait (bool enabled)
 
bool cancelOnWait () const
 

Protected Attributes

QList< QFuture< T > > m_futures
 
bool m_cancelOnWait
 

Constructor & Destructor Documentation

QFutureSynchronizer ( )
inline

Definition at line 60 of file qfuturesynchronizer.h.

60 : m_cancelOnWait(false) { }
QFutureSynchronizer ( const QFuture< T > &  future)
inlineexplicit

Definition at line 61 of file qfuturesynchronizer.h.

62  : m_cancelOnWait(false)
63  { addFuture(future); }
void addFuture(const QFuture< T > &future)
~QFutureSynchronizer ( )
inline

Definition at line 64 of file qfuturesynchronizer.h.

Member Function Documentation

void setFuture ( const QFuture< T > &  future)
inline

Definition at line 66 of file qfuturesynchronizer.h.

67  {
69  m_futures.clear();
70  addFuture(future);
71  }
void clear()
Definition: qlist.h:764
void addFuture(const QFuture< T > &future)
QList< QFuture< T > > m_futures
void addFuture ( const QFuture< T > &  future)
inline

Definition at line 73 of file qfuturesynchronizer.h.

74  {
75  m_futures.append(future);
76  }
void append(const T &t)
Definition: qlist.h:507
QList< QFuture< T > > m_futures
void waitForFinished ( )
inline

Definition at line 78 of file qfuturesynchronizer.h.

79  {
80  if (m_cancelOnWait) {
81  for (int i = 0; i < m_futures.count(); ++i) {
82  m_futures[i].cancel();
83  }
84  }
85 
86  for (int i = 0; i < m_futures.count(); ++i) {
87  m_futures[i].waitForFinished();
88  }
89  }
int count(const T &t) const
Definition: qlist.h:891
QList< QFuture< T > > m_futures
void clearFutures ( )
inline

Definition at line 91 of file qfuturesynchronizer.h.

92  {
93  m_futures.clear();
94  }
void clear()
Definition: qlist.h:764
QList< QFuture< T > > m_futures
QList<QFuture<T> > futures ( ) const
inline

Definition at line 96 of file qfuturesynchronizer.h.

97  {
98  return m_futures;
99  }
QList< QFuture< T > > m_futures
void setCancelOnWait ( bool  enabled)
inline

Definition at line 101 of file qfuturesynchronizer.h.

102  {
103  m_cancelOnWait = enabled;
104  }
bool cancelOnWait ( ) const
inline

Definition at line 106 of file qfuturesynchronizer.h.

107  {
108  return m_cancelOnWait;
109  }

Member Data Documentation

QList<QFuture<T> > m_futures
protected

Definition at line 112 of file qfuturesynchronizer.h.

bool m_cancelOnWait
protected

Definition at line 113 of file qfuturesynchronizer.h.


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