From db9b79f71519f5fb85732b5c759795750509f727 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 29 Jul 2011 09:47:19 +0200 Subject: Fix compilation of Minimalplugin, add documentation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3b40eed781905610cc3062d25dcccf5f760de1f0 Reviewed-on: http://codereview.qt.nokia.com/2382 Reviewed-by: Qt Sanity Bot Reviewed-by: Jørgen Lind --- src/gui/kernel/qplatformintegration_qpa.cpp | 12 ++++++++---- .../platforms/minimal/qminimalintegration.cpp | 20 +++++++++++++------- src/plugins/platforms/minimal/qminimalintegration.h | 4 +++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index ec12ef12a5..04f1bd392a 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -171,11 +171,15 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const */ /*! - \fn QAbstractEventDispatcher *createEventDispatcher() const - Factory function for the event dispatcher. The platform plugin - must create and and return a QAbstractEventDispatcher subclass when - this function is called. + \fn QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0 + + Accessor function for the event dispatcher. The platform plugin should create + an instance of the QAbstractEventDispatcher in its constructor and set it + on the application using QGuiApplicationPrivate::instance()->setEventDispatcher(). + The event dispatcher is owned by QGuiApplication, the accessor should return + a flat pointer. + \sa QGuiApplicationPrivate */ bool QPlatformIntegration::hasCapability(Capability cap) const diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index 8d8e5e7f06..2f2da6967a 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -48,10 +48,19 @@ #endif #include +#include #include -QMinimalIntegration::QMinimalIntegration() +QT_BEGIN_NAMESPACE + +QMinimalIntegration::QMinimalIntegration() : +#ifdef Q_OS_WIN + m_eventDispatcher(new QEventDispatcherWin32()) +#else + m_eventDispatcher(createUnixEventDispatcher()) +#endif { + QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); @@ -80,12 +89,9 @@ QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow * return new QMinimalBackingStore(window); } -QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const +QAbstractEventDispatcher *QMinimalIntegration::guiThreadEventDispatcher() const { -#ifndef Q_OS_WIN - return createUnixEventDispatcher(); -#else - return new QEventDispatcherWin32(); -#endif + return m_eventDispatcher; } +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index d64932c5e6..0835c39ab6 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -73,8 +73,10 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; - QAbstractEventDispatcher *createEventDispatcher() const; +private: + QAbstractEventDispatcher *m_eventDispatcher; }; QT_END_NAMESPACE -- cgit v1.2.3