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
qohoseventdispatcher.h
Go to the documentation of this file.
1
2// Copyright (C) 2025 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QOHOSEVENTDISPATCHER_H
6#define QOHOSEVENTDISPATCHER_H
7
8#include <QtCore/QMutex>
9#include <QtCore/QSemaphore>
10#include <QtGui/private/qunixeventdispatcher_qpa_p.h>
11
13{
15public:
16 explicit QOhosEventDispatcher(QObject *parent = 0);
18 void start();
19 void stop();
20
21 void goingToStop(bool stop);
22
23protected:
24 bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
25
26private:
27 QAtomicInt m_stopRequest;
28 QAtomicInteger<bool> m_goingToStop;
29 QSemaphore m_semaphore;
30};
31
33{
34public:
36 static bool stopped() {return !instance()->m_started.loadRelaxed(); }
37 void startAll();
38 void stopAll();
41 void goingToStop(bool stop);
42
43private:
44 QMutex m_mutex;
45 QAtomicInt m_started = 1;
46 QVector<QOhosEventDispatcher *> m_dispatchers;
47};
48
49
50#endif // QOHOSEVENTDISPATCHER_H
static QOhosEventDispatcherStopper * instance()
void addEventDispatcher(QOhosEventDispatcher *dispatcher)
void removeEventDispatcher(QOhosEventDispatcher *dispatcher)
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
Processes pending events that match flags until there are no more events to process.
bool blockEventLoopsWhenSuspended()