From 8f6f41ed19ec116401bc9d36ad4f68de3a31ffc9 Mon Sep 17 00:00:00 2001 From: Kellermorph Date: Sun, 23 Aug 2026 18:25:23 +0200 Subject: [PATCH] Clean up readSettingsState() in all three editors - Remove dead #if QT_VERSION conditionals (both branches were identical) - Add settings.remove() guard on restoreState() failure consistently across all three editors (now safe since all run after show()) --- sources/editor/ui/qetelementeditor.cpp | 8 +++----- sources/qetdiagrameditor.cpp | 4 ---- sources/titleblock/qettemplateeditor.cpp | 8 +++----- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/sources/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index a46c56aa5..38fb6a8b7 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -967,11 +967,9 @@ void QETElementEditor::readSettingsState() QVariant state = settings.value("elementeditor/state"); if (state.isValid()) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - restoreState(state.toByteArray()); -#else - restoreState(state.toByteArray()); -#endif + if (!restoreState(state.toByteArray())) { + settings.remove("elementeditor/state"); + } } } diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 4ad6de7e7..d33426aa4 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -2224,13 +2224,9 @@ void QETDiagramEditor::readSettingsState() // etat de la fenetre (barres d'outils, docks...) QVariant state = settings.value("diagrameditor/state"); if (state.isValid()) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (!restoreState(state.toByteArray())) { settings.remove("diagrameditor/state"); } -#else - restoreState(state.toByteArray()); -#endif } } diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 4195c30ba..e3a44ecbb 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -661,11 +661,9 @@ void QETTitleBlockTemplateEditor::readSettingsState() QVariant state = settings.value("titleblocktemplateeditor/state"); if (state.isValid()) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - restoreState(state.toByteArray()); -#else - restoreState(state.toByteArray()); -#endif + if (!restoreState(state.toByteArray())) { + settings.remove("titleblocktemplateeditor/state"); + } } }