mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
Merge bitcoin-core/gui#623: Getting ready to Qt 6 (9/n). Apply Qt 6 specific changes
d8d99d041a
qt6: Do not use deprecated high DPI attributes in Qt 6 (Hennadii Stepanov)8927bb8f06
refactor: Fix style in `initTranslations()` function (Hennadii Stepanov)ad73447dc2
qt6: Do not use deprecated `QLibraryInfo::path` in Qt 6 (Hennadii Stepanov)3f51d0b8b2
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 ACKd8d99d041a
jarolrod: ACKd8d99d041a
Tree-SHA512: e5f92a80f8622e5f95dd98a90783956a26d3c8382b9ca8e479fb6c152cfdc85a2f6084e78d463ceea1e0f0b3ac72d2b086c8ca24967b2b6070553317e9e3252e
This commit is contained in:
commit
bc83710fdc
1 changed files with 19 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue