Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQmlThread Class Reference

#include <qqmlthread_p.h>

Inheritance diagram for QQmlThread:
Collaboration diagram for QQmlThread:

Public Member Functions

 QQmlThread ()
virtual ~QQmlThread ()
void lock ()
void unlock ()
void wakeOne ()
void wait ()
bool isThisThread () const
bool isParentThread () const
template<typename Method, typename ... Args>
void callMethodInThread (Method &&method, Args &&...args)
template<typename Method, typename ... Args>
void callMethodInMain (Method &&method, Args &&...args)
template<typename Method, typename ... Args>
void postMethodToThread (Method &&method, Args &&...args)
template<typename Method, typename ... Args>
void postMethodToMain (Method &&method, Args &&...args)
void waitForNextMessage ()
void discardMessages ()
void startup ()
void shutdown ()

Protected Member Functions

QThreadthread () const
QObjectthreadObject () const
 And object living in the QML thread, in case you want to parent other objects to it.

Friends

class QQmlThreadPrivate

Detailed Description

Definition at line 29 of file qqmlthread_p.h.

Constructor & Destructor Documentation

◆ QQmlThread()

QQmlThread::QQmlThread ( )

Definition at line 160 of file qqmlthread_impl.cpp.

References QQmlThreadPrivate::QQmlThreadPrivate().

Here is the call graph for this function:

◆ ~QQmlThread()

QQmlThread::~QQmlThread ( )
virtual

Definition at line 165 of file qqmlthread_impl.cpp.

Member Function Documentation

◆ callMethodInMain()

template<typename Method, typename ... Args>
void QQmlThread::callMethodInMain ( Method && method,
Args &&... args )

Definition at line 116 of file qqmlthread_p.h.

◆ callMethodInThread()

template<typename Method, typename ... Args>
void QQmlThread::callMethodInThread ( Method && method,
Args &&... args )

Definition at line 123 of file qqmlthread_p.h.

◆ discardMessages()

void QQmlThread::discardMessages ( )
Note
This method must be called in the main thread
Warning
This method requires that the lock is held!

Clear all pending events, for either thread.

Definition at line 376 of file qqmlthread_impl.cpp.

References isThisThread().

Here is the call graph for this function:

◆ isParentThread()

bool QQmlThread::isParentThread ( ) const

Definition at line 227 of file qqmlthread_impl.cpp.

◆ isThisThread()

bool QQmlThread::isThisThread ( ) const

Definition at line 222 of file qqmlthread_impl.cpp.

Referenced by discardMessages(), QQmlThreadPrivate::triggerMainEvent(), QQmlThreadPrivate::triggerThreadEvent(), and waitForNextMessage().

Here is the caller graph for this function:

◆ lock()

void QQmlThread::lock ( )

Definition at line 202 of file qqmlthread_impl.cpp.

Referenced by waitForNextMessage().

Here is the caller graph for this function:

◆ postMethodToMain()

template<typename Method, typename ... Args>
void QQmlThread::postMethodToMain ( Method && method,
Args &&... args )

Definition at line 137 of file qqmlthread_p.h.

◆ postMethodToThread()

template<typename Method, typename ... Args>
void QQmlThread::postMethodToThread ( Method && method,
Args &&... args )

Definition at line 130 of file qqmlthread_p.h.

◆ shutdown()

void QQmlThread::shutdown ( )

Definition at line 181 of file qqmlthread_impl.cpp.

◆ startup()

void QQmlThread::startup ( )

Starts the actual worker thread.

Definition at line 174 of file qqmlthread_impl.cpp.

◆ thread()

QThread * QQmlThread::thread ( ) const
protected

Definition at line 233 of file qqmlthread_impl.cpp.

◆ threadObject()

QObject * QQmlThread::threadObject ( ) const
protected

And object living in the QML thread, in case you want to parent other objects to it.

Definition at line 241 of file qqmlthread_impl.cpp.

◆ unlock()

void QQmlThread::unlock ( )

Definition at line 207 of file qqmlthread_impl.cpp.

Referenced by waitForNextMessage().

Here is the caller graph for this function:

◆ wait()

void QQmlThread::wait ( )

Definition at line 217 of file qqmlthread_impl.cpp.

◆ waitForNextMessage()

void QQmlThread::waitForNextMessage ( )
Note
This method must be called in the main thread
Warning
This method requires that the lock is held!

A call to this method will either:

  • run a message requested to run synchronously on the main thread if there is one (and return afterrwards),
  • wait for the worker thread to notify it if the worker thread has pending work,
  • or simply return if neither of the conditions above hold

Definition at line 345 of file qqmlthread_impl.cpp.

References isThisThread(), lock(), unlock(), and wakeOne().

Here is the call graph for this function:

◆ wakeOne()

void QQmlThread::wakeOne ( )

Definition at line 212 of file qqmlthread_impl.cpp.

Referenced by waitForNextMessage().

Here is the caller graph for this function:

◆ QQmlThreadPrivate

friend class QQmlThreadPrivate
friend

Definition at line 72 of file qqmlthread_p.h.


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