Fix QHighDPiScaling initialization issues
Call QHighDpiScaling::updateHighDpiScaling() in init_plaform(), after the platform integration has been created and most platforms have populated the screen list. Keep the existing udpate call for the platforms that don't, but guard against calling it twice. Task-number: QTBUG-47947 Change-Id: Ib73bea7c4ab42e7acf6532f3a3100e1fc29acc2c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
This commit is contained in:
parent
a681b90418
commit
45bb9c29e8
@ -129,6 +129,8 @@ QWindow *QGuiApplicationPrivate::currentMouseWindow = 0;
|
|||||||
|
|
||||||
Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
|
Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
|
||||||
|
|
||||||
|
bool QGuiApplicationPrivate::highDpiScalingUpdated = false;
|
||||||
|
|
||||||
QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
|
QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
|
||||||
QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0;
|
QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0;
|
||||||
|
|
||||||
@ -1051,6 +1053,13 @@ static void init_platform(const QString &pluginArgument, const QString &platform
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Many platforms have created QScreens at this point. Finish initializing
|
||||||
|
// QHighDpiScaling to be prepared for early calls to qt_defaultDpi().
|
||||||
|
if (QGuiApplication::primaryScreen()) {
|
||||||
|
QGuiApplicationPrivate::highDpiScalingUpdated = true;
|
||||||
|
QHighDpiScaling::updateHighDpiScaling();
|
||||||
|
}
|
||||||
|
|
||||||
// Create the platform theme:
|
// Create the platform theme:
|
||||||
|
|
||||||
// 1) Fetch the platform name from the environment if present.
|
// 1) Fetch the platform name from the environment if present.
|
||||||
@ -1220,9 +1229,10 @@ void QGuiApplicationPrivate::eventDispatcherReady()
|
|||||||
|
|
||||||
platform_integration->initialize();
|
platform_integration->initialize();
|
||||||
|
|
||||||
// Do this here in order to play nice with platforms that add screens only
|
// All platforms should have added screens at this point. Finish
|
||||||
// in initialize().
|
// QHighDpiScaling initialization if it has not been done so already.
|
||||||
QHighDpiScaling::updateHighDpiScaling();
|
if (!QGuiApplicationPrivate::highDpiScalingUpdated)
|
||||||
|
QHighDpiScaling::updateHighDpiScaling();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::init()
|
void QGuiApplicationPrivate::init()
|
||||||
|
@ -202,6 +202,7 @@ public:
|
|||||||
static QWindow *currentMouseWindow;
|
static QWindow *currentMouseWindow;
|
||||||
static QWindow *currentMousePressWindow;
|
static QWindow *currentMousePressWindow;
|
||||||
static Qt::ApplicationState applicationState;
|
static Qt::ApplicationState applicationState;
|
||||||
|
static bool highDpiScalingUpdated;
|
||||||
|
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
static QClipboard *qt_clipboard;
|
static QClipboard *qt_clipboard;
|
||||||
|
Loading…
Reference in New Issue
Block a user