diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-06-24 08:58:27 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-06-24 08:58:30 -0400 |
commit | 44e849c35a7eff6c1c748f030722fc6a56727578 (patch) | |
tree | b776b3fd884d5c019facc45eccda684dc28468d5 | |
parent | c8fee6769a106bb5fbcdd3674fd0444b01d3391c (diff) | |
parent | 099e4b9ad3d9967051d5c3d45c6315d1b30fea05 (diff) |
Merge #16254: qt: Set AA_EnableHighDpiScaling attribute early
099e4b9ad3 Set AA_EnableHighDpiScaling attribute early (Hennadii Stepanov)
Pull request description:
Running `bitcoin-qt` compiled against Qt 5.12.4 causes a warning:
```
hebasto@bionic-qt:~/bitcoin$ src/qt/bitcoin-qt
Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
```
This PR fixes this issue.
From Qt docs:
- [Qt::AA_EnableHighDpiScaling](https://doc.qt.io/qt-5/qt.html#ApplicationAttribute-enum):
> Enables high-DPI scaling in Qt on supported platforms (see also High DPI Displays). _Supported platforms are X11, Windows and Android._ Enabling makes Qt scale the main (device independent) coordinate system according to display scale factors provided by the operating system. This corresponds to setting the `QT_AUTO_SCREEN​_SCALE_FACTOR` environment variable to 1. This attribute must be set before `QGuiApplication` is constructed. This value was added in Qt 5.6.
- [QCoreApplication::setAttribute()](https://doc.qt.io/qt-5/qcoreapplication.html#setAttribute)
ACKs for commit 099e4b:
MarcoFalke:
ACK 099e4b9ad3d9967051d5c3d45c6315d1b30fea05
jonasschnelli:
utACK 099e4b9ad3d9967051d5c3d45c6315d1b30fea05
fanquake:
ACK 099e4b9ad3d9967051d5c3d45c6315d1b30fea05. Did some testing on `Bionic` and `Windows 10` (using VirtualBox). I couldn't see any obvious visual difference, but given Marco's screens above, this change is obviously better. I also checked that there wasn't any sort of regression on macOS.
Tree-SHA512: 1965a427ee14ffb3871bac317685032406cf02d1fa2b2dc11c8b643bfe4ba09195674d149d1e41752f14c0d000446b35e142f3ce60d987ba97082fd7ee39a094
-rw-r--r-- | src/qt/bitcoin.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index f6ed88a1e6..2fdbcca043 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -436,16 +436,17 @@ int GuiMain(int argc, char* argv[]) Q_INIT_RESOURCE(bitcoin); Q_INIT_RESOURCE(bitcoin_locale); - BitcoinApplication app(*node, argc, argv); // Generate high-dpi pixmaps QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #if QT_VERSION >= 0x050600 - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif #ifdef Q_OS_MAC QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif + BitcoinApplication app(*node, argc, argv); + // Register meta types used for QMetaObject::invokeMethod qRegisterMetaType< bool* >(); // Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) |