diff --git a/external/imgui-backend-qt b/external/imgui-backend-qt index 0ebc0fe7..a914f181 160000 --- a/external/imgui-backend-qt +++ b/external/imgui-backend-qt @@ -1 +1 @@ -Subproject commit 0ebc0fe7fa88aa3d1eb58b2f040f11ba45227829 +Subproject commit a914f1811185f5959d50f2a199420dee4d15ae74 diff --git a/scwx-qt/source/scwx/qt/ui/imgui_debug_widget.cpp b/scwx-qt/source/scwx/qt/ui/imgui_debug_widget.cpp index 56d45c94..066ba59d 100644 --- a/scwx-qt/source/scwx/qt/ui/imgui_debug_widget.cpp +++ b/scwx-qt/source/scwx/qt/ui/imgui_debug_widget.cpp @@ -75,7 +75,22 @@ std::string ImGuiDebugWidget::context_name() const void ImGuiDebugWidget::set_current_context(ImGuiContext* context) { + if (context == p->currentContext_) + { + return; + } + + // Unregister widget with current context + ImGui::SetCurrentContext(p->currentContext_); + ImGui_ImplQt_UnregisterWidget(this); + p->currentContext_ = context; + + // Register widget with new context + ImGui::SetCurrentContext(context); + ImGui_ImplQt_RegisterWidget(this); + + // Queue an update update(); }