Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qandroideventdispatcher.h
Go to the documentation of this file.
1// Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QANDROIDEVENTDISPATCHER_H
5#define QANDROIDEVENTDISPATCHER_H
6
7#include <QtCore/QMutex>
8#include <QtCore/QSemaphore>
9#include <QtGui/private/qunixeventdispatcher_qpa_p.h>
10
12{
14public:
15 explicit QAndroidEventDispatcher(QObject *parent = nullptr);
17 void start();
18 void stop();
19
20 void goingToStop(bool stop);
21
22protected:
23 bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
24
25private:
26 QAtomicInt m_stopRequest;
27 QAtomicInt m_goingToStop;
28 QSemaphore m_semaphore;
29};
30
32{
33public:
35 static bool stopped() {return !instance()->m_started.loadRelaxed(); }
36 void startAll();
37 void stopAll();
40 void goingToStop(bool stop);
41
42private:
43 QMutex m_mutex;
44 QAtomicInt m_started = 1;
45 QList<QAndroidEventDispatcher *> m_dispatchers;
46};
47
48
49#endif // QANDROIDEVENTDISPATCHER_H
static QAndroidEventDispatcherStopper * instance()
void removeEventDispatcher(QAndroidEventDispatcher *dispatcher)
void addEventDispatcher(QAndroidEventDispatcher *dispatcher)
QAndroidEventDispatcher(QObject *parent=nullptr)
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
Processes pending events that match flags until there are no more events to process.
\inmodule QtCore
Definition qatomic.h:112
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
Definition qsemaphore.h:18
GLbitfield flags
#define Q_OBJECT