Adapt to Qt 6 (757a9c21c1)

* Don't use deprecated QLibraryInfo::path()
* Avoid conflicting QT_FORWARD_DECLARE_CLASS(QStringList)
This commit is contained in:
Martchus 2020-09-18 18:28:35 +02:00
parent 51ca0e895c
commit 429ec48a6e
2 changed files with 11 additions and 2 deletions

View File

@ -121,7 +121,13 @@ void loadQtTranslationFile(initializer_list<QString> repositoryNames, const QStr
QString path;
if ((!additionalTranslationFilePath().isEmpty() && qtTranslator->load(fileName, path = additionalTranslationFilePath()))
|| qtTranslator->load(fileName, path = QLibraryInfo::location(QLibraryInfo::TranslationsPath))
|| qtTranslator->load(fileName, path =
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QLibraryInfo::location(QLibraryInfo::TranslationsPath)
#else
QLibraryInfo::path(QLibraryInfo::TranslationsPath)
#endif
)
|| qtTranslator->load(fileName, path = QStringLiteral("../share/qt/translations"))
|| qtTranslator->load(fileName, path = QStringLiteral(":/translations"))) {
QCoreApplication::installTranslator(qtTranslator);

View File

@ -4,12 +4,15 @@
#include "../global.h"
#include <QtGlobal>
#include <QtContainerFwd>
#include <initializer_list>
QT_FORWARD_DECLARE_CLASS(QString)
QT_FORWARD_DECLARE_CLASS(QStringList)
QT_FORWARD_DECLARE_CLASS(QSettings)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QT_FORWARD_DECLARE_CLASS(QStringList)
#endif
/*!
* \brief Sets the application meta data in the QCoreApplication singleton and attributes commonly used