summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2020-01-04 15:32:34 +0100
committerLiang Qi <liang.qi@qt.io>2020-01-04 15:32:34 +0100
commita503bf54705d89204007e8f887b668fe5ef519fc (patch)
treeb2d1a452da39450eac78a1aeb1df116a73f64b23 /src/gui/kernel/qguiapplication.cpp
parente65c43fd0ffa57248e7d750570b7deae171a82f5 (diff)
parent1f87fb359fdff14e42662384a9c8a0bcb3837671 (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/qguiapplication.cpp')
-rw-r--r--src/gui/kernel/qguiapplication.cpp28
1 files changed, 17 insertions, 11 deletions
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);