diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-03-16 10:01:29 +0100 |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2012-03-16 10:01:29 +0100 |
commit | 440f452aa3a5609e5f6006a03ac36d41462d5908 (patch) | |
tree | 598d682291945055e4f6feb08a228212648482c1 /src/gui/kernel | |
parent | cd1e62ffc121cc68c5a133a8095d431f04d966ce (diff) | |
parent | d4959fa6376255ab4adf8adaeb2ee47ae6b679d2 (diff) |
Merge master into api_changes
Conflicts:
src/corelib/kernel/qmetatype.cpp
src/gui/kernel/qplatformsurface_qpa.cpp
tests/auto/corelib/tools/qtimeline/qtimeline.pro
Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 36 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration_qpa.cpp | 15 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration_qpa.h | 5 | ||||
-rw-r--r-- | src/gui/kernel/qplatformnativeinterface_qpa.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qplatformnativeinterface_qpa.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatformsurface_qpa.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qstylehints.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qsurface.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qsurfaceformat.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 6 |
15 files changed, 90 insertions, 16 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index adf5f66679..3e3db64d6f 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1146,12 +1146,13 @@ QMoveEvent::~QMoveEvent() /*! \class QExposeEvent + \since 5.0 \brief The QExposeEvent class contains event parameters for expose events. \ingroup events - Expose events are sent to widgets when an area of the widget is invalidated - and needs to be flushed from the backing store. + Expose events are sent to windows when an area of the window is invalidated + or window visibility in the windowing system changes. The event handler QWindow::exposeEvent() receives expose events. */ @@ -1761,9 +1762,11 @@ void QInputMethodEvent::setTentativeCommitString(const QString &tentativeCommitS \sa setTentativeCommitString() */ -/*! \class QInputMethodQueryEvent +/*! + \class QInputMethodQueryEvent + \since 5.0 - This event is sent by the input context to input objects. + \brief This event is sent by the input context to input objects. It is used by the input method to query a set of properties of the object to be @@ -3375,9 +3378,10 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent() gestures. Whenever such a decision is made (the gesture is recognized), the clients will be notified with a QEvent::TouchCancel event so they can update their state accordingly. - The touchPoints() function returns a list of all touch points contained in the event. - Information about each touch point can be retrieved using the QTouchEvent::TouchPoint class. - The Qt::TouchPointState enum describes the different states that a touch point may have. + The touchPoints() function returns a list of all touch points contained in the event. Note that + this list may be empty, for example in case of a QEvent::TouchCancel event. Information about + each touch point can be retrieved using the QTouchEvent::TouchPoint class. The + Qt::TouchPointState enum describes the different states that a touch point may have. \section1 Event Delivery and Propagation diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 26690c78cf..d72647091d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -110,6 +110,7 @@ enum ApplicationResourceFlags static unsigned applicationResourceFlags = 0; +QString *QGuiApplicationPrivate::platform_name = 0; bool QGuiApplicationPrivate::app_do_modal = false; QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette @@ -194,6 +195,7 @@ static inline void clearFontUnlocked() flow and main settings. \inmodule QtGui + \since 5.0 QGuiApplication contains the main event loop, where all events from the window system and other sources are processed and dispatched. It also handles the @@ -361,6 +363,9 @@ QGuiApplication::~QGuiApplication() #ifndef QT_NO_CURSOR d->cursor_list.clear(); #endif + + delete QGuiApplicationPrivate::platform_name; + QGuiApplicationPrivate::platform_name = 0; } QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags) @@ -470,6 +475,17 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) return 0; } +/*! + \property QGuiApplication::platformName + \brief The name of the underlying platform plugin. + \since 5.0 +*/ + +QString QGuiApplication::platformName() +{ + return QGuiApplicationPrivate::platform_name ? + *QGuiApplicationPrivate::platform_name : QString(); +} static void init_platform(const QString &pluginArgument, const QString &platformPluginPath) { @@ -509,7 +525,9 @@ static void init_platform(const QString &pluginArgument, const QString &platform // Create the platform integration. QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath); - if (!QGuiApplicationPrivate::platform_integration) { + if (QGuiApplicationPrivate::platform_integration) { + QGuiApplicationPrivate::platform_name = new QString(name); + } else { QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); QString fatalMessage = QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); @@ -521,13 +539,22 @@ static void init_platform(const QString &pluginArgument, const QString &platform } // Create the platform theme: - // 1) Ask the platform integration to create a platform theme - QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->platformTheme(); + // 1) Ask the platform integration for a list of names. + const QStringList themeNames = QGuiApplicationPrivate::platform_integration->themeNames(); + foreach (const QString &themeName, themeNames) { + QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath); + if (QGuiApplicationPrivate::platform_theme) + break; + } // 2) If none found, look for a theme plugin. Theme plugins are located in the // same directory as platform plugins. if (!QGuiApplicationPrivate::platform_theme) { - QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(name, platformPluginPath); + foreach (const QString &themeName, themeNames) { + QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName); + if (QGuiApplicationPrivate::platform_theme) + break; + } // No error message; not having a theme plugin is allowed. } @@ -731,6 +758,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() qt_cleanupFontDatabase(); + delete platform_theme; delete platform_integration; platform_integration = 0; } diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 6fdbb000fe..cc7dea422f 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -75,7 +75,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication { Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection) - + Q_PROPERTY(QString platformName READ platformName STORED false) Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed) public: @@ -86,6 +86,8 @@ public: static QWindowList topLevelWindows(); static QWindow *topLevelAt(const QPoint &pos); + static QString platformName(); + #ifdef QT_DEPRECATED static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); } #endif diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index d9477a3e9e..f30a2bb5a0 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -146,6 +146,7 @@ public: static QGuiApplicationPrivate *instance() { return self; } + static QString *platform_name; static bool app_do_modal; static Qt::MouseButtons buttons; diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index f9ebf8820c..eaff417f15 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -76,6 +76,7 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex; /*! \class QOpenGLContext + \since 5.0 \brief The QOpenGLContext represents a native OpenGL context, enabling OpenGL rendering on a QSurface. @@ -621,6 +622,7 @@ void QOpenGLContext::deleteQGLContext() /*! \class QOpenGLContextGroup + \since 5.0 \brief The QOpenGLContextGroup represents a group of contexts sharing OpenGL resources. diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index e8721edce7..786e915a19 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -44,6 +44,7 @@ #include <QtGui/QPlatformFontDatabase> #include <QtGui/QPlatformClipboard> #include <QtGui/QPlatformAccessibility> +#include <QtGui/QPlatformTheme> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qpixmap_raster_p.h> #include <QtGui/private/qplatformscreen_qpa_p.h> @@ -259,6 +260,8 @@ QPlatformInputContext *QPlatformIntegration::inputContext() const return 0; } +#ifndef QT_NO_ACCESSIBILITY + /*! Returns the platforms accessibility. @@ -269,6 +272,8 @@ QPlatformAccessibility *QPlatformIntegration::accessibility() const return 0; } +#endif + QVariant QPlatformIntegration::styleHint(StyleHint hint) const { switch (hint) { @@ -315,9 +320,15 @@ void QPlatformIntegration::screenAdded(QPlatformScreen *ps) emit qGuiApp->screenAdded(screen); } -class QPlatformTheme *QPlatformIntegration::platformTheme() const +QStringList QPlatformIntegration::themeNames() const { - return 0; + return QStringList(); +} + +class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &name) const +{ + Q_UNUSED(name) + return new QPlatformTheme; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 3f9de9df5e..632b3af613 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -105,7 +105,9 @@ public: virtual QPlatformDrag *drag() const; #endif virtual QPlatformInputContext *inputContext() const; +#ifndef QT_NO_ACCESSIBILITY virtual QPlatformAccessibility *accessibility() const; +#endif // Access native handles. The window handle is already available from Wid; virtual QPlatformNativeInterface *nativeInterface() const; @@ -126,7 +128,8 @@ public: virtual Qt::KeyboardModifiers queryKeyboardModifiers() const; - virtual QPlatformTheme *platformTheme() const; + virtual QStringList themeNames() const; + virtual QPlatformTheme *createPlatformTheme(const QString &name) const; protected: void screenAdded(QPlatformScreen *screen); diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index f87a2956a3..48e43f5226 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -43,6 +43,11 @@ QT_BEGIN_NAMESPACE +void *QPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource) +{ + Q_UNUSED(resource); + return 0; +} void *QPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { Q_UNUSED(resource); diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index b25ebf0fe9..dd1ef22354 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -60,6 +60,7 @@ class Q_GUI_EXPORT QPlatformNativeInterface : public QObject { Q_OBJECT public: + virtual void *nativeResourceForIntegration(const QByteArray &resource); virtual void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); virtual void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore); diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp index 5fd9c073fe..6d3b6503d7 100644 --- a/src/gui/kernel/qplatformsurface_qpa.cpp +++ b/src/gui/kernel/qplatformsurface_qpa.cpp @@ -43,7 +43,10 @@ QT_BEGIN_NAMESPACE -QPlatformSurface::~QPlatformSurface() {} +QPlatformSurface::~QPlatformSurface() +{ + +} QSurface::SurfaceClass QPlatformSurface::surfaceClass() const { diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index da0716b7d5..5d7ffdbc2b 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE /*! \class QScreen + \since 5.0 \brief The QScreen class is used to query screen properties. A note on logical vs physical dots per inch: physical DPI is based on the diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index c98158b6b6..15fcec21d8 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -50,6 +50,11 @@ static inline QVariant hint(QPlatformIntegration::StyleHint h) return QGuiApplicationPrivate::platformIntegration()->styleHint(h); } +/*! + \class QStyleHints + \since 5.0 + \brief The QStyleHints contains platform specific hints and settings. + */ QStyleHints::QStyleHints() : QObject() { diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp index eb2676802b..534135cc2f 100644 --- a/src/gui/kernel/qsurface.cpp +++ b/src/gui/kernel/qsurface.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE /*! \class QSurface + \since 5.0 \brief The QSurface class is an abstraction of renderable surfaces in Qt. The size of the surface is accessible with the size() function. The rendering diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 9021d82e20..cc6b621047 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -108,6 +108,7 @@ public: /*! \class QSurfaceFormat + \since 5.0 \brief The QSurfaceFormat class represents the format of a QSurface. The format includes the size of the color buffers, red, green, and blue; diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 367cee70e3..78b6f6f722 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -63,6 +63,7 @@ QT_BEGIN_NAMESPACE /*! \class QWindow + \since 5.0 \brief The QWindow class represents a window in the underlying windowing system. A window that is supplied a parent becomes a native child window of @@ -597,6 +598,11 @@ bool QWindow::isActive() const return false; QWindow *focus = QGuiApplication::focusWindow(); + + // Means the whole application lost the focus + if (!focus) + return false; + if (focus == this) return true; |