mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-07-30 07:44:13 +02:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user