diff options
author | laanwj <126646+laanwj@users.noreply.github.com> | 2022-06-23 11:27:28 +0200 |
---|---|---|
committer | laanwj <126646+laanwj@users.noreply.github.com> | 2022-06-23 11:47:51 +0200 |
commit | bc83710fdcc09d8e427e77457df107acc9db1be5 (patch) | |
tree | f080452783cc4b0c4c66124d8f43015d404aab4b /src | |
parent | b9122e95f0f4ff5d2b2e21a5caf6c69d488c0347 (diff) | |
parent | d8d99d041a063a1719fc1d43ecd4a6365e0657ca (diff) | |
download | bitcoin-bc83710fdcc09d8e427e77457df107acc9db1be5.tar.xz |
Merge bitcoin-core/gui#623: Getting ready to Qt 6 (9/n). Apply Qt 6 specific changes
d8d99d041a063a1719fc1d43ecd4a6365e0657ca qt6: Do not use deprecated high DPI attributes in Qt 6 (Hennadii Stepanov)
8927bb8f063e88546fd9cf2ce595902d2ea63bb6 refactor: Fix style in `initTranslations()` function (Hennadii Stepanov)
ad73447dc2bd04120c4eb7f5757613ad35a35cf5 qt6: Do not use deprecated `QLibraryInfo::path` in Qt 6 (Hennadii Stepanov)
3f51d0b8b2b2fabf5e305bd71226a8e3e5f3ad2d qt6: Fix type registration (Hennadii Stepanov)
Pull request description:
One more step in migration to Qt 6.
Could be tested with hebasto/bitcoin#3 or bitcoin/bitcoin#24798.
No behavior change when compiling with Qt 5.
ACKs for top commit:
laanwj:
Code review ACK d8d99d041a063a1719fc1d43ecd4a6365e0657ca
jarolrod:
ACK d8d99d041a063a1719fc1d43ecd4a6365e0657ca
Tree-SHA512: e5f92a80f8622e5f95dd98a90783956a26d3c8382b9ca8e479fb6c152cfdc85a2f6084e78d463ceea1e0f0b3ac72d2b086c8ca24967b2b6070553317e9e3252e
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/bitcoin.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index f11ddad30f..27d3a1b9e2 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -96,7 +96,11 @@ static void RegisterMetaTypes() qRegisterMetaType<QMessageBox::Icon>("QMessageBox::Icon"); qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo"); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qRegisterMetaTypeStreamOperators<BitcoinUnit>("BitcoinUnit"); +#else + qRegisterMetaType<BitcoinUnit>("BitcoinUnit"); +#endif } static QString GetLangTerritory() @@ -135,21 +139,30 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans // - First load the translator for the base language, without territory // - Then load the more specific locale translator +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) + const QString translation_path{QLibraryInfo::location(QLibraryInfo::TranslationsPath)}; +#else + const QString translation_path{QLibraryInfo::path(QLibraryInfo::TranslationsPath)}; +#endif // Load e.g. qt_de.qm - if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + if (qtTranslatorBase.load("qt_" + lang, translation_path)) { QApplication::installTranslator(&qtTranslatorBase); + } // Load e.g. qt_de_DE.qm - if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + if (qtTranslator.load("qt_" + lang_territory, translation_path)) { QApplication::installTranslator(&qtTranslator); + } // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc) - if (translatorBase.load(lang, ":/translations/")) + if (translatorBase.load(lang, ":/translations/")) { QApplication::installTranslator(&translatorBase); + } // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc) - if (translator.load(lang_territory, ":/translations/")) + if (translator.load(lang_territory, ":/translations/")) { QApplication::installTranslator(&translator); + } } static bool InitSettings() @@ -517,9 +530,11 @@ int GuiMain(int argc, char* argv[]) Q_INIT_RESOURCE(bitcoin); Q_INIT_RESOURCE(bitcoin_locale); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) // Generate high-dpi pixmaps QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif #if defined(QT_QPA_PLATFORM_ANDROID) QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar); |