From 88a793319e017659cd71b7beb96443d317c16952 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 9 Feb 2023 17:23:46 +0200 Subject: [PATCH] QLibraryInfo::location is deprecated since 6.0. --- src/libs/vmisc/compatibility.h | 11 +++++++++++ src/libs/vmisc/vabstractapplication.cpp | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libs/vmisc/compatibility.h b/src/libs/vmisc/compatibility.h index e9c132b81..44f00d850 100644 --- a/src/libs/vmisc/compatibility.h +++ b/src/libs/vmisc/compatibility.h @@ -347,4 +347,15 @@ inline auto DropEventPos(const QDropEvent *event) -> QPoint #endif } +//--------------------------------------------------------------------------------------------------------------------- +template +inline auto QLibraryPath(T loc) -> QString +{ +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QLibraryInfo::path(loc); +#else + return QLibraryInfo::location(loc); +#endif +} + #endif // COMPATIBILITY_H diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index 46a756c0f..c46ca905d 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -39,6 +39,8 @@ #include #include +#include "../vmisc/compatibility.h" + #ifdef Q_OS_UNIX # include #endif @@ -260,7 +262,7 @@ void VAbstractApplication::LoadTranslation(QString locale) #if defined(Q_OS_WIN) || defined(Q_OS_MAC) const QString qtQmDir = appQmDir; #else - const QString qtQmDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + const QString qtQmDir = QLibraryPath(QLibraryInfo::TranslationsPath); #endif LoadQM(qtTranslator, QStringLiteral("qt_"), locale, qtQmDir); installTranslator(qtTranslator);