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:
@@ -143,8 +143,12 @@ ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsL
|
||||
//On windows when user drag and drop an element from the common elements collection
|
||||
//to the custom elements collection, the element file stay in read only mode, and so
|
||||
//user can't save the element
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
||||
QNtfsPermissionCheckGuard ntfs_guard;
|
||||
#else
|
||||
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
||||
qt_ntfs_permission_lookup++;
|
||||
#endif
|
||||
QFile file(destination.fileSystemPath() % "/" % new_elmt_name);
|
||||
if (!file.isWritable()) {
|
||||
if (!file.setPermissions(file.permissions() | QFileDevice::WriteUser)) {
|
||||
@@ -152,7 +156,9 @@ ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsL
|
||||
<< " in ECHSFileToFile::copyElement";
|
||||
}
|
||||
}
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
|
||||
qt_ntfs_permission_lookup--;
|
||||
#endif
|
||||
#endif
|
||||
return ElementsLocation (destination.fileSystemPath() % "/" % new_elmt_name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user