Guard Qt6-only deprecation replacements for Qt5 compatibility

Three deprecated APIs have replacements that only exist in newer Qt6:
- QLocale::nativeCountryName() -> nativeTerritoryName() (Qt 6.2)
- QDomDocument::setContent() overload -> ParseResult (Qt 6.5)
- qt_ntfs_permission_lookup -> QNtfsPermissionCheckGuard RAII (Qt 6.6)
Each is wrapped in QT_VERSION_CHECK so Qt5 keeps the old path. Clears
4 -Wdeprecated-declarations warnings.
This commit is contained in:
Dieter Mayer
2026-07-12 21:54:14 +02:00
parent f57c921b78
commit e099fca5ad
3 changed files with 19 additions and 0 deletions
+9
View File
@@ -422,6 +422,14 @@ int checkOneElement(const QString &path)
return 2;
}
QDomDocument doc;
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
if (const auto result = doc.setContent(&file); !result) {
file.close();
out << "FAIL " << path << " (XML error line "
<< result.errorLine << ": " << result.errorMessage << ")\n";
return 2;
}
#else
QString error;
int line = 0;
if (!doc.setContent(&file, &error, &line)) {
@@ -430,6 +438,7 @@ int checkOneElement(const QString &path)
<< line << ": " << error << ")\n";
return 2;
}
#endif
file.close();
const QDomElement root = doc.documentElement();