commit d7a4f47e7d42af33858ff263823bd7cdbea98b57
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Thu Feb 25 17:56:11 2021 +0100
Improve HiDpi handling
Add code stolen from QBitTorrent that enables properly HiDpi handling.
HighDpi support is set by default starting with Qt 5.6.
Support for fractional scaling is added for Qt >= 5.14.
Hopefully fixes bug #12060.
---
src/frontends/qt/GuiApplication.cpp | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/frontends/qt/GuiApplication.cpp
b/src/frontends/qt/GuiApplication.cpp
index 6395f8e..fc2210a 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -63,6 +63,7 @@
#include "support/convert.h"
#include "support/debug.h"
#include "support/ExceptionMessage.h"
+#include "support/environment.h"
#include "support/FileName.h"
#include "support/filetools.h"
#include "support/ForkedCalls.h"
@@ -180,6 +181,19 @@ frontend::Application * createApplication(int & argc, char
* argv[])
AllowSetForegroundWindow(ASFW_ANY);
#endif
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ // Attribute Qt::AA_EnableHighDpiScaling must be set before
QCoreApplication is created
+ if (getEnv("QT_ENABLE_HIGHDPI_SCALING").empty()
+ && getEnv("QT_AUTO_SCREEN_SCALE_FACTOR").empty())
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
+#endif
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ // HighDPI scale factor policy must be set before QGuiApplication is
created
+ if (getEnv("QT_SCALE_FACTOR_ROUNDING_POLICY").empty())
+
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
+#endif
+
frontend::GuiApplication * guiApp = new frontend::GuiApplication(argc,
argv);
// I'd rather do that in the constructor, but I do not think that
// the palette is accessible there.
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs