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.
This commit is contained in:
joshua
2022-06-22 18:56:22 +02:00
parent fe19b270f9
commit fa753449ad
2 changed files with 15 additions and 5 deletions

View File

@@ -177,17 +177,26 @@ void TerminalStripTreeDockWidget::on_m_tree_view_currentItemChanged(QTreeWidgetI
} }
TerminalStrip *strip_ = nullptr; 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); strip_ = m_item_strip_H.value(current);
} }
else if (current->type() == Terminal else if (current_type == Terminal && current->parent())
&& current->parent() {
&& current->parent()->type() == Strip) { const auto parent_type{current->parent()->type()};
if (parent_type == Strip) {
strip_ = m_item_strip_H.value(current->parent()); strip_ = m_item_strip_H.value(current->parent());
} else if (parent_type == FreeTerminal) {
current_is_free = true;
}
} }
if (strip_ != m_current_strip) { if (strip_ != m_current_strip) {
setCurrentStrip(strip_); setCurrentStrip(strip_);
} else if (current_is_free != m_current_is_free_terminal) {
m_current_is_free_terminal = current_is_free;
emit currentStripChanged(nullptr);
} }
} }

View File

@@ -78,6 +78,7 @@ class TerminalStripTreeDockWidget : public QDockWidget
QHash<QUuid, QSharedPointer<RealTerminal>> m_uuid_terminal_H; QHash<QUuid, QSharedPointer<RealTerminal>> m_uuid_terminal_H;
QHash<QUuid, QPointer<TerminalStrip>> m_uuid_strip_H; QHash<QUuid, QPointer<TerminalStrip>> m_uuid_strip_H;
QVector<QMetaObject::Connection> m_strip_changed_connection; QVector<QMetaObject::Connection> m_strip_changed_connection;
bool m_current_is_free_terminal{false};
}; };
#endif // TERMINALSTRIPTREEDOCKWIDGET_H #endif // TERMINALSTRIPTREEDOCKWIDGET_H