mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
Improve HiDpi handling
Add code stolen from QBitTorrent and Qt Creator that properly enables HighDpi handling. The rules are: 1/ nothing needs to be done for macOS and Qt >= 6 2/ HighDpi support is set by default starting with Qt 5.6. 3/ Support for fractional scaling is added for Qt >= 5.14. Hopefully fixes bug #12060. (cherry picked from commitd7a4f47e7d
) (cherry picked from commitf92f2f95ff
)
This commit is contained in:
parent
5adb555006
commit
8b6460e4f2
@ -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"
|
||||
@ -194,6 +195,24 @@ frontend::Application * createApplication(int & argc, char * argv[])
|
||||
AllowSetForegroundWindow(ASFW_ANY);
|
||||
#endif
|
||||
|
||||
|
||||
// Setup high DPI handling. This is a bit complicated, but will be default in Qt6.
|
||||
// macOS does it by itself.
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_OS_MAC)
|
||||
#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
|
||||
#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.
|
||||
|
@ -34,8 +34,11 @@ What's new
|
||||
- Other than directly inserted, now references can also be pasted as insets
|
||||
into an equation, instead of simply as text (bug 11539).
|
||||
|
||||
- Add support for High DPI screens in Windows and Linux (bug 12060).
|
||||
|
||||
- Add Qt platform name in About dialog.
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user