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
This commit is contained in:
parent
37f96f5a3a
commit
d9741fc632
@ -600,18 +600,19 @@ int main(int argc, char *argv[])
|
||||
Q_INIT_RESOURCE(dash);
|
||||
Q_INIT_RESOURCE(dash_locale);
|
||||
|
||||
BitcoinApplication app(argc, argv);
|
||||
#if QT_VERSION > 0x050100
|
||||
// Generate high-dpi pixmaps
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
#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(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)
|
||||
|
Loading…
Reference in New Issue
Block a user