diff options
author | Liang Qi <liang.qi@qt.io> | 2020-01-04 15:32:34 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2020-01-04 15:32:34 +0100 |
commit | a503bf54705d89204007e8f887b668fe5ef519fc (patch) | |
tree | b2d1a452da39450eac78a1aeb1df116a73f64b23 /src/gui/kernel | |
parent | e65c43fd0ffa57248e7d750570b7deae171a82f5 (diff) | |
parent | 1f87fb359fdff14e42662384a9c8a0bcb3837671 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
src/corelib/tools/qvector.h
Make QVector(DataPointer dd) public to be able to properly merge
5b4b437b30b320e2cd7c9a566999a39772e5d431 from 5.15 into dev.
src/widgets/kernel/qapplication.cpp
tests/auto/tools/moc/allmocs_baseline_in.json
Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qcursor.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 28 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 14 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_p.h | 1 |
6 files changed, 29 insertions, 19 deletions
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 4ae5412367..f5a794b642 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -175,6 +175,8 @@ QT_BEGIN_NAMESPACE \fn void QCursor::swap(QCursor &other) Swaps this cursor with the \a other cursor. + + \since 5.7 */ /*! diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index d231869d40..2291241ef6 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -148,7 +148,13 @@ QString QGuiApplicationPrivate::styleOverride; Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; Qt::HighDpiScaleFactorRoundingPolicy QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy = +#ifdef Q_OS_ANDROID + // On Android, Qt has newer rounded the scale factor. Preserve + // that behavior by disabling rounding by default. + Qt::HighDpiScaleFactorRoundingPolicy::PassThrough; +#else Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor; +#endif bool QGuiApplicationPrivate::highDpiScalingUpdated = false; QPointer<QWindow> QGuiApplicationPrivate::currentDragWindow; @@ -166,7 +172,6 @@ bool QGuiApplicationPrivate::is_fallback_session_management_enabled = true; enum ApplicationResourceFlags { - ApplicationPaletteExplicitlySet = 0x1, ApplicationFontExplicitlySet = 0x2 }; @@ -690,8 +695,6 @@ QGuiApplication::~QGuiApplication() QGuiApplicationPrivate::lastCursorPosition = {qInf(), qInf()}; QGuiApplicationPrivate::currentMousePressWindow = QGuiApplicationPrivate::currentMouseWindow = nullptr; QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; - QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy = - Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor; QGuiApplicationPrivate::highDpiScalingUpdated = false; QGuiApplicationPrivate::currentDragWindow = nullptr; QGuiApplicationPrivate::tabletDevicePoints.clear(); @@ -3297,11 +3300,10 @@ void QGuiApplication::setPalette(const QPalette &pal) else *QGuiApplicationPrivate::app_pal = pal; - applicationResourceFlags |= ApplicationPaletteExplicitlySet; QCoreApplication::setAttribute(Qt::AA_SetPalette); if (qGuiApp) - emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); + qGuiApp->d_func()->sendApplicationPaletteChange(); } void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window) @@ -3553,6 +3555,8 @@ Qt::ApplicationState QGuiApplication::applicationState() accessor will reflect the environment, if set. The default value is Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor. + On Qt for Android the default is Qt::HighDpiScaleFactorRoundingPolicy::PassThough, + which preserves historical behavior from earlier Qt versions. */ void QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy policy) { @@ -4100,13 +4104,10 @@ QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) void QGuiApplicationPrivate::notifyThemeChanged() { - if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet) && - !QCoreApplication::testAttribute(Qt::AA_SetPalette)) { + if (!testAttribute(Qt::AA_SetPalette)) { clearPalette(); initPalette(); - emit qGuiApp->paletteChanged(*app_pal); - if (is_app_running && !is_app_closing) - sendApplicationPaletteChange(); + sendApplicationPaletteChange(); } if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) { const auto locker = qt_scoped_lock(applicationFontMutex); @@ -4119,7 +4120,12 @@ void QGuiApplicationPrivate::notifyThemeChanged() void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className) { Q_UNUSED(toAllWidgets) - Q_UNUSED(className) + + if (!className) + emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); + + if (!is_app_running || is_app_closing) + return; QEvent event(QEvent::ApplicationPaletteChange); QGuiApplication::sendEvent(QGuiApplication::instance(), &event); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 74e0e6401e..c4c7de1b2e 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1344,7 +1344,7 @@ Qt::WindowStates QWindow::windowStates() const This is a hint to the window manager that this window is a dialog or pop-up on behalf of the transient parent. - In order to cause the window to be centered above its transient parent by + In order to cause the window to be centered above its transient \a parent by default, depending on the window manager, it may also be necessary to call setFlags() with a suitable \l Qt::WindowType (such as \c Qt::Dialog). diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 00712ceb5d..2de0131640 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -46,7 +46,9 @@ #include <qpa/qplatformintegration.h> #include <qdebug.h> #include "qhighdpiscaling_p.h" + #include <QtCore/qscopedvaluerollback.h> +#include <QtCore/private/qlocking_p.h> #if QT_CONFIG(draganddrop) #include <qpa/qplatformdrag.h> @@ -623,7 +625,7 @@ bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device) static int g_nextPointId = 1; // map from device-independent point id (arbitrary) to "Qt point" ids -QMutex QWindowSystemInterfacePrivate::pointIdMapMutex; +static QBasicMutex pointIdMapMutex; typedef QMap<quint64, int> PointIdMap; Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) @@ -641,7 +643,7 @@ Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) */ static int acquireCombinedPointId(quint8 deviceId, int pointId) { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); quint64 combinedId64 = (quint64(deviceId) << 32) + pointId; auto it = g_pointIdMap->constFind(combinedId64); @@ -702,7 +704,7 @@ QList<QTouchEvent::TouchPoint> } if (states == Qt::TouchPointReleased) { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); // All points on deviceId have been released. // Remove all points associated with that device from g_pointIdMap. @@ -723,7 +725,7 @@ QList<QTouchEvent::TouchPoint> void QWindowSystemInterfacePrivate::clearPointIdMap() { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); g_pointIdMap->clear(); g_nextPointId = 1; } @@ -880,10 +882,10 @@ void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qrea QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleThemeChange(QWindow *window) +QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window) { QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(window); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); } #if QT_CONFIG(draganddrop) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index d5a4ad30d8..95e20f0f8b 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -249,6 +249,7 @@ public: static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY); static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleThemeChange(QWindow *window); static void handleFileOpenEvent(const QString& fileName); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 6e4bce607e..dd6f29b41f 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -529,7 +529,6 @@ public: static QWaitCondition eventsFlushed; static QMutex flushEventMutex; - static QMutex pointIdMapMutex; static QAtomicInt eventAccepted; static QList<QTouchEvent::TouchPoint> |