diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 21 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 1 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 5f96ac3493..5a31fb5df1 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -50,6 +50,7 @@ #include <QtCore/private/qcoreapplication_p.h> #include <QtCore/private/qabstracteventdispatcher_p.h> #include <QtCore/qmutex.h> +#include <QtCore/private/qthread_p.h> #include <QtDebug> #include <qpalette.h> #include <qscreen.h> @@ -313,13 +314,25 @@ void QGuiApplicationPrivate::createPlatformIntegration() void QGuiApplicationPrivate::createEventDispatcher() { - Q_Q(QGuiApplication); - if (platform_integration == 0) createPlatformIntegration(); - eventDispatcher = platform_integration->createEventDispatcher(); - eventDispatcher->setParent(q); + if (!eventDispatcher) { + QAbstractEventDispatcher *eventDispatcher = platform_integration->createEventDispatcher(); + setEventDispatcher(eventDispatcher); + } +} + +void QGuiApplicationPrivate::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher) +{ + Q_Q(QGuiApplication); + + if (!this->eventDispatcher) { + this->eventDispatcher = eventDispatcher; + this->eventDispatcher->setParent(q); + threadData->eventDispatcher = eventDispatcher; + } + } void QGuiApplicationPrivate::init() diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index a08dbca4f1..325c89e363 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -69,6 +69,7 @@ public: void createPlatformIntegration(); void createEventDispatcher(); + void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher); virtual void notifyLayoutDirectionChange(); virtual void notifyActiveWindowChange(QWindow *previous); |