QLibraryInfo::location is deprecated since 6.0.

This commit is contained in:
Roman Telezhynskyi 2023-02-09 17:23:46 +02:00
parent 0335bcf571
commit 88a793319e
2 changed files with 14 additions and 1 deletions

View File

@ -347,4 +347,15 @@ inline auto DropEventPos(const QDropEvent *event) -> QPoint
#endif
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
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

View File

@ -39,6 +39,8 @@
#include <QWidget>
#include <QStandardPaths>
#include "../vmisc/compatibility.h"
#ifdef Q_OS_UNIX
# include <unistd.h>
#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);