diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index a9aec4e87..df45c2c08 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -386,7 +386,13 @@ QETProject::ProjectState QETProject::openFile(QFile *file) // QET::findInDomElement()), so the extra whitespace-only text nodes // this keeps around are inert everywhere but the two elements that // call .text() on themselves -- which is exactly where the bug was. + // The option exists since Qt 6.5; older Qt always drops such nodes, + // so there an all-whitespace value still reloads as "". +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) if (!xml_project.setContent(content, QDomDocument::ParseOption::PreserveSpacingOnlyNodes)) +#else + if (!xml_project.setContent(content)) +#endif { if(opened_here) { file->close();