mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 22:40:26 +00:00
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.
This commit is contained in:
parent
0274bf63f7
commit
d7a4f47e7d
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user