diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-07-21 13:11:55 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-07-27 15:47:49 +0200 |
commit | 86e7c36b504f7c92229229747bdc5587b298a81c (patch) | |
tree | d94d31d184e196173b7948d2505cd7d2aefa9850 | |
parent | b03f5fd47631d234d140b5a792eff80286c91e92 (diff) |
Make it possible to use QSocketNotifier in Lighthouse plugins
The idea is that now the plugin can register the event dispatcher
in its constructor, so it can freely use QSocketNotifier or what not.
If the plugin choses not to do so, then the createFunction will be
called at a later point.
Change-Id: I75fb2ee4180d9619ac94e75fbcf1efd7a2deecbc
Reviewed-on: http://codereview.qt.nokia.com/2287
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
-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); |