From fa753449ad99a01d4113b0741f454f9e03f1aee4 Mon Sep 17 00:00:00 2001 From: joshua Date: Wed, 22 Jun 2022 18:56:22 +0200 Subject: [PATCH] Minor : fix little gui defect At opening of terminal strip editor window, click on free terminal in the tree dock don't show up the free terminal table. --- .../ui/terminalstriptreedockwidget.cpp | 19 ++++++++++++++----- .../ui/terminalstriptreedockwidget.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp b/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp index f568a8f76..ed4dae6e6 100644 --- a/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp +++ b/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp @@ -177,17 +177,26 @@ void TerminalStripTreeDockWidget::on_m_tree_view_currentItemChanged(QTreeWidgetI } TerminalStrip *strip_ = nullptr; - if (current->type() == Strip) { + bool current_is_free{false}; + const auto current_type{current->type()}; + if (current_type == Strip) { strip_ = m_item_strip_H.value(current); } - else if (current->type() == Terminal - && current->parent() - && current->parent()->type() == Strip) { - strip_ = m_item_strip_H.value(current->parent()); + else if (current_type == Terminal && current->parent()) + { + const auto parent_type{current->parent()->type()}; + if (parent_type == Strip) { + strip_ = m_item_strip_H.value(current->parent()); + } else if (parent_type == FreeTerminal) { + current_is_free = true; + } } if (strip_ != m_current_strip) { setCurrentStrip(strip_); + } else if (current_is_free != m_current_is_free_terminal) { + m_current_is_free_terminal = current_is_free; + emit currentStripChanged(nullptr); } } diff --git a/sources/TerminalStrip/ui/terminalstriptreedockwidget.h b/sources/TerminalStrip/ui/terminalstriptreedockwidget.h index 586d212a1..c03ca2ff7 100644 --- a/sources/TerminalStrip/ui/terminalstriptreedockwidget.h +++ b/sources/TerminalStrip/ui/terminalstriptreedockwidget.h @@ -78,6 +78,7 @@ class TerminalStripTreeDockWidget : public QDockWidget QHash> m_uuid_terminal_H; QHash> m_uuid_strip_H; QVector m_strip_changed_connection; + bool m_current_is_free_terminal{false}; }; #endif // TERMINALSTRIPTREEDOCKWIDGET_H