From 6b4edc9be8ec556147c195cf2047d92b9439efd7 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Tue, 18 Nov 2025 00:46:27 +0800 Subject: Bring back ControlHost and refactor tree management of control. --- src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp') diff --git a/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp b/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp index b9b1fdef..d7324350 100644 --- a/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp +++ b/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp @@ -63,7 +63,8 @@ CompoundConditionEditor::CompoundConditionEditor() { if (editor) { ConnectChangeEvent(editor.get()); editor->RemoveEvent()->AddSpyOnlyHandler([this, c = editor.get()] { - auto index = this->children_container_.IndexOf(c->GetRootControl()); + auto index = + this->children_container_.IndexOfChild(c->GetRootControl()); this->children_.erase(this->children_.begin() + index); this->children_container_.RemoveChildAt(index); RaiseChangeEvent(); @@ -88,13 +89,13 @@ CompoundConditionEditor::GetChildren() { void CompoundConditionEditor::SetChildren( std::vector> children, bool trigger_change) { - children_container_.ClearChildren(); + children_container_.RemoveAllChild(); children_.clear(); for (const auto& condition : children) { auto editor = CreateConditionEditor(condition.get()); ConnectChangeEvent(editor.get()); editor->RemoveEvent()->AddSpyOnlyHandler([this, c = editor.get()] { - auto index = this->children_container_.IndexOf(c->GetRootControl()); + auto index = this->children_container_.IndexOfChild(c->GetRootControl()); this->children_.erase(this->children_.begin() + index); this->children_container_.RemoveChildAt(index); RaiseChangeEvent(); -- cgit v1.2.3