From 8f85e82c5dc3d3028828e11ff59b16e3cae2844d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 4 Jul 2016 08:07:42 +0200 Subject: Windows: Handle theme switching correctly if a palette is set If a palette is set on the application object and the user does something to trigger a theme change, i.e. connects via remote desktop or logs out and in again, then it will cause Qt to render incorrectly. Therefore we should only update the palette from the new theme if we don't have our own already set. Task-number: QTBUG-52962 Change-Id: I4e2288efd82ad98b698cc09f26ad188064ec7b2a Reviewed-by: Giuseppe D'Angelo Reviewed-by: Friedemann Kleint --- src/gui/kernel/qguiapplication.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 834449fec6..dec701a17d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3567,7 +3567,8 @@ QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) void QGuiApplicationPrivate::notifyThemeChanged() { - if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet)) { + if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet) && + !QCoreApplication::testAttribute(Qt::AA_SetPalette)) { clearPalette(); initPalette(); } -- cgit v1.2.3 From 3cc2884c031e0ab1098f59fae9aa6e05f54d36f8 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 30 May 2016 11:16:19 +0200 Subject: Fix defining QGuiApplication::sync() when QT_NO_SESSIONMANAGER is set sync() is unconditionally declared in the QGuiApplication header, but the definition was under QT_NO_SESSIONMANAGER guards. This commit moves the definition of sync() outside of the QT_NO_SESSIONMANAGER guards, since the sync code has nothing to do with session management. [ChangeLog][QtGui][QGuiApplication] Fixed a bug that would cause QGuiApplication::sync() to be left undefined for Qt builds without session management support. Change-Id: Ieb46f7c90c9193e89469126170117d9df672f4cb Task-number: QTBUG-51703 Reviewed-by: Thiago Macieira --- src/gui/kernel/qguiapplication.cpp | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index dec701a17d..7b05ee562b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3275,28 +3275,6 @@ bool QGuiApplication::isSavingSession() const return d->is_saving_session; } -/*! - \since 5.2 - - Function that can be used to sync Qt state with the Window Systems state. - - This function will first empty Qts events by calling QCoreApplication::processEvents(), - then the platform plugin will sync up with the windowsystem, and finally Qts events - will be delived by another call to QCoreApplication::processEvents(); - - This function is timeconsuming and its use is discouraged. -*/ -void QGuiApplication::sync() -{ - QCoreApplication::processEvents(); - if (QGuiApplicationPrivate::platform_integration - && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) { - QGuiApplicationPrivate::platform_integration->sync(); - QCoreApplication::processEvents(); - QWindowSystemInterface::flushWindowSystemEvents(); - } -} - void QGuiApplicationPrivate::commitData() { Q_Q(QGuiApplication); @@ -3321,6 +3299,28 @@ void QGuiApplicationPrivate::saveState() } #endif //QT_NO_SESSIONMANAGER +/*! + \since 5.2 + + Function that can be used to sync Qt state with the Window Systems state. + + This function will first empty Qts events by calling QCoreApplication::processEvents(), + then the platform plugin will sync up with the windowsystem, and finally Qts events + will be delived by another call to QCoreApplication::processEvents(); + + This function is timeconsuming and its use is discouraged. +*/ +void QGuiApplication::sync() +{ + QCoreApplication::processEvents(); + if (QGuiApplicationPrivate::platform_integration + && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) { + QGuiApplicationPrivate::platform_integration->sync(); + QCoreApplication::processEvents(); + QWindowSystemInterface::flushWindowSystemEvents(); + } +} + /*! \property QGuiApplication::layoutDirection \brief the default layout direction for this application -- cgit v1.2.3 From b6c10cf33107309f13c9845495d9d7d4f45f34bf Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 4 Jul 2016 15:21:19 +0200 Subject: Improve lookup speed for QAccessible::uniqueId When QAccessible::uniqueId was called, it would call QHash::key(), which has linear time performance. This can cause application slowdown if a big number of QAccessibleInterface Ids have to be found. The patch adds an additional QHash to keep track of the inverse relationship from QAccessibleInterface pointers to their Ids. Change-Id: I975e3dc0e6c628e2ea701323d8b87184ad133cfb Task-number: QTBUG-54491 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible.cpp | 4 ++-- src/gui/accessible/qaccessiblecache.cpp | 9 ++++++++- src/gui/accessible/qaccessiblecache_p.h | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 4731e8a240..658e0f26ba 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -755,7 +755,7 @@ void QAccessible::deleteAccessibleInterface(Id id) */ QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface) { - Id id = QAccessibleCache::instance()->idToInterface.key(iface); + Id id = QAccessibleCache::instance()->idForInterface(iface); if (!id) id = registerAccessibleInterface(iface); return id; @@ -768,7 +768,7 @@ QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface) */ QAccessibleInterface *QAccessible::accessibleInterface(Id id) { - return QAccessibleCache::instance()->idToInterface.value(id); + return QAccessibleCache::instance()->interfaceForId(id); } diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp index 0b9366631c..5fae442370 100644 --- a/src/gui/accessible/qaccessiblecache.cpp +++ b/src/gui/accessible/qaccessiblecache.cpp @@ -77,6 +77,11 @@ QAccessibleInterface *QAccessibleCache::interfaceForId(QAccessible::Id id) const return idToInterface.value(id); } +QAccessible::Id QAccessibleCache::idForInterface(QAccessibleInterface *iface) const +{ + return interfaceToId.value(iface); +} + QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *iface) const { Q_ASSERT(iface); @@ -84,7 +89,7 @@ QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface * // object might be 0 Q_ASSERT(!objectToId.contains(object)); - Q_ASSERT_X(!idToInterface.values().contains(iface), "", "Accessible interface inserted into cache twice!"); + Q_ASSERT_X(!interfaceToId.contains(iface), "", "Accessible interface inserted into cache twice!"); QAccessible::Id id = acquireId(); QObject *obj = iface->object(); @@ -94,6 +99,7 @@ QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface * connect(obj, &QObject::destroyed, this, &QAccessibleCache::objectDestroyed); } idToInterface.insert(id, iface); + interfaceToId.insert(iface, id); return id; } @@ -109,6 +115,7 @@ void QAccessibleCache::objectDestroyed(QObject* obj) void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj) { QAccessibleInterface *iface = idToInterface.take(id); + interfaceToId.take(iface); if (!obj) obj = iface->object(); if (obj) diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h index ffaccbca42..bb33ea2cd4 100644 --- a/src/gui/accessible/qaccessiblecache_p.h +++ b/src/gui/accessible/qaccessiblecache_p.h @@ -64,6 +64,7 @@ class Q_GUI_EXPORT QAccessibleCache :public QObject public: static QAccessibleCache *instance(); QAccessibleInterface *interfaceForId(QAccessible::Id id) const; + QAccessible::Id idForInterface(QAccessibleInterface *iface) const; QAccessible::Id insert(QObject *object, QAccessibleInterface *iface) const; void deleteInterface(QAccessible::Id id, QObject *obj = 0); @@ -79,6 +80,7 @@ private: QAccessible::Id acquireId() const; mutable QHash idToInterface; + mutable QHash interfaceToId; mutable QHash objectToId; #ifdef Q_OS_MAC -- cgit v1.2.3 From 5d8a33a86cb6d852716a9c871576b2f9361a61a1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 8 Jul 2016 15:44:39 +0200 Subject: [iOS] Blacklist iOS with regards to bgra support A number of devices are indicating that there is a problem with using bgra so instead of blacklisting all of them individually it is best to blacklist them all on the iOS platform. This ensures QQuickItem::grabToImage() will work then. Task-number: QTBUG-45902 Change-Id: I900857cfa996924469aaaeeee8037dc84a4fd575 Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglframebufferobject.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index db7de5e8bf..6fc18b1d01 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -1282,6 +1282,7 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ const char *ver = reinterpret_cast(funcs->glGetString(GL_VERSION)); // Blacklist GPU chipsets that have problems with their BGRA support. +#ifndef Q_OS_IOS const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0 && ::strstr(ver, "1.3") != 0) || (qstrcmp(renderer, "Mali-T760") == 0 @@ -1289,7 +1290,9 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ (qstrcmp(renderer, "Mali-T720") == 0 && ::strstr(ver, "3.1") != 0) || qstrcmp(renderer, "PowerVR SGX 554") == 0; - +#else + const bool blackListed = true; +#endif const bool supports_bgra = has_bgra_ext && !blackListed; if (supports_bgra) { -- cgit v1.2.3