From 72c800821829bba467746e0347c830b35f0fa35f Mon Sep 17 00:00:00 2001 From: Levi Jetzer Date: Thu, 6 Aug 2026 17:20:48 +0200 Subject: [PATCH 1/2] Avoid needless dock churn in QETElementEditor::updateInformations() updateInformations() runs on every selection change and on every undo stack index change. It unconditionally called clearToolsDock(), which removes and hides the current editor widget, and then re-inserted the same widget into the stack. When the editor for the new selection is the one already shown, that means removing, hiding, reparenting and re-adding a widget only to end up in the same state. Look up the editor first and only clear and re-insert the tools dock when a different editor is needed. setPart()/setParts() still updates the contents in every case, so the visible result is unchanged. --- sources/editor/ui/qetelementeditor.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sources/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index 9a4eb2ffb..691b370fd 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -573,9 +573,11 @@ void QETElementEditor::updateInformations() || selection_xml_name == "ellipse" || selection_xml_name == "arc") { - clearToolsDock(); //We add the editor widget ElementItemEditor *editor = static_cast(m_editors[selection_xml_name]); + if (m_tools_dock_stack -> widget(1) != editor) { + clearToolsDock(); + } #if TODO_LIST #pragma message("@TODO Check if it takes longer than setting the parts again to the editor.") @@ -608,7 +610,9 @@ void QETElementEditor::updateInformations() success = editor -> setParts(cep_list); } if (success) { - m_tools_dock_stack -> insertWidget(1, editor); + if (m_tools_dock_stack -> widget(1) != editor) { + m_tools_dock_stack -> insertWidget(1, editor); + } m_tools_dock_stack -> setCurrentIndex(1); } else { @@ -626,8 +630,10 @@ void QETElementEditor::updateInformations() // multi edit for polygons makes no sense // TODO: maybe allowing multipart edit when number of points is the same? //We add the editor widget - clearToolsDock(); ElementItemEditor *editor = static_cast(m_editors[selection_xml_name]); + if (m_tools_dock_stack -> widget(1) != editor) { + clearToolsDock(); + } CustomElementPart* part = editor -> currentPart(); bool equal = part == cep_list.first(); @@ -637,7 +643,9 @@ void QETElementEditor::updateInformations() success = editor -> setPart(cep_list.first()); } if (success) { - m_tools_dock_stack -> insertWidget(1, editor); + if (m_tools_dock_stack -> widget(1) != editor) { + m_tools_dock_stack -> insertWidget(1, editor); + } m_tools_dock_stack -> setCurrentIndex(1); } else { @@ -655,11 +663,15 @@ void QETElementEditor::updateInformations() //There's several parts selecteds and all can be edited by style editor. if (style_editable) { - clearToolsDock(); ElementItemEditor *selection_editor = m_editors["style"]; + if (m_tools_dock_stack -> widget(1) != selection_editor) { + clearToolsDock(); + } if (selection_editor) { if (selection_editor -> setParts(cep_list)) { - m_tools_dock_stack -> insertWidget(1, selection_editor); + if (m_tools_dock_stack -> widget(1) != selection_editor) { + m_tools_dock_stack -> insertWidget(1, selection_editor); + } m_tools_dock_stack -> setCurrentIndex(1); } else { From 7a85e2592c7f3573716c999fcf0ce7de472cee39 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Wed, 16 Sep 2026 21:27:22 +1200 Subject: [PATCH 2/2] Fix stale geometry in LineEditor on multi-select LineEditor::setPart() no-ops (skipping updateForm()) when the part passed in is already m_part. That is harmless when the editor widget is torn down between selections, but this branch keeps the same editor instance installed across selection changes instead of recreating it, so a line already shown alone can also be parts.first() of a later multi-selection -- and the x1/y1/x2/y2 spinboxes then keep showing whatever was in them before, not this selection's actual first line. setParts() now always calls updateForm() after setPart() succeeds, closing the gap regardless of the identity check inside setPart(). Co-Authored-By: Claude Sonnet 5 --- sources/editor/ui/lineeditor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sources/editor/ui/lineeditor.cpp b/sources/editor/ui/lineeditor.cpp index b75dfcf39..18ec7d0be 100644 --- a/sources/editor/ui/lineeditor.cpp +++ b/sources/editor/ui/lineeditor.cpp @@ -156,6 +156,16 @@ bool LineEditor::setParts(QList parts) return false; } + // setPart() no-ops when parts.first() is already m_part (its own + // identity guard), which skips updateForm(). That is fine when this + // editor widget stayed on screen the whole time, but since PR #675 + // keeps the same editor instance installed across selection changes + // instead of tearing it down, an already-shown single line can also be + // parts.first() of a later multi-selection -- and without this call + // the geometry spinboxes keep showing whatever was in them before, + // not this selection's actual first line. + updateForm(); + return m_style->setParts(parts); }