From c29d4aff241dd3867c3c564d0cd96ae6264b54ad Mon Sep 17 00:00:00 2001 From: ispyisail Date: Mon, 28 Sep 2026 07:57:21 +1300 Subject: [PATCH] Fix the build on Qt older than 6.5 (#1080) QDomDocument::ParseOption::PreserveSpacingOnlyNodes, used since 84add7b3e to keep a title-block variable set to a single space through a reload, only exists from Qt 6.5. On older Qt the project file is parsed as it was before that commit: the build works again, and such a value reloads as empty there. Checked on Ubuntu 22.04's Qt 6.2.4: qetproject.cpp fails on master with "'QDomDocument::ParseOption' has not been declared" and compiles with this change. On Qt 6.5 and later the code is unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G2d2Zi8BfrYRPX88zhaoFG --- sources/qetproject.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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();