1// Copyright (C) 2016 The Qt Company Ltd.
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 QEVENTDISPATCHER_GLIB_P_H
5#define QEVENTDISPATCHER_GLIB_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the QLibrary class. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qabstracteventdispatcher.h"
19#include "qabstracteventdispatcher_p.h"
20
21typedef struct _GMainContext GMainContext;
22
23QT_BEGIN_NAMESPACE
24
25class QEventDispatcherGlibPrivate;
26
27class Q_CORE_EXPORT QEventDispatcherGlib : public QAbstractEventDispatcherV2
28{
29 Q_OBJECT
30 Q_DECLARE_PRIVATE(QEventDispatcherGlib)
31
32public:
33 explicit QEventDispatcherGlib(QObject *parent = nullptr);
34 explicit QEventDispatcherGlib(GMainContext *context, QObject *parent = nullptr);
35 ~QEventDispatcherGlib();
36
37 bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
38
39 void registerSocketNotifier(QSocketNotifier *socketNotifier) final;
40 void unregisterSocketNotifier(QSocketNotifier *socketNotifier) final;
41
42 void registerTimer(Qt::TimerId timerId, Duration interval, Qt::TimerType timerType,
43 QObject *object) override final;
44 bool unregisterTimer(Qt::TimerId timerId) override final;
45 bool unregisterTimers(QObject *object) override final;
46 QList<TimerInfoV2> timersForObject(QObject *object) const override final;
47 Duration remainingTime(Qt::TimerId timerId) const override final;
48
49 void wakeUp() final;
50 void interrupt() final;
51
52 static bool versionSupported();
53
54protected:
55 QEventDispatcherGlib(QEventDispatcherGlibPrivate &dd, QObject *parent);
56};
57
58struct GPostEventSource;
59struct GSocketNotifierSource;
60struct GTimerSource;
61struct GIdleTimerSource;
62
63class Q_CORE_EXPORT QEventDispatcherGlibPrivate : public QAbstractEventDispatcherPrivate
64{
65
66public:
67 QEventDispatcherGlibPrivate(GMainContext *context = nullptr);
68 ~QEventDispatcherGlibPrivate() override;
69
70 GMainContext *mainContext;
71 GPostEventSource *postEventSource;
72 GSocketNotifierSource *socketNotifierSource;
73 GTimerSource *timerSource;
74 GIdleTimerSource *idleTimerSource;
75 bool wakeUpCalled = true;
76
77 void runTimersOnceWithNormalPriority();
78};
79
80QT_END_NAMESPACE
81
82#endif // QEVENTDISPATCHER_GLIB_P_H
83

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtbase/src/corelib/kernel/qeventdispatcher_glib_p.h