From 05fac26dc9952403f4c40d8e9ce5704c5ebcdece Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Thu, 31 Aug 2023 15:37:26 +0200 Subject: [PATCH] DAP: Set last chosen preset Set last activated item in ModelChooser when the debugging is ended. It sets the last chosen preset in debuger menu. It is needed for DAP debugger because it has several presets. Note: Logic should be improved or DAP debugger presets should be combined in one. Change-Id: I043d2fe17ec847db287ee246e1fb4455b3b6d727 Reviewed-by: Reviewed-by: hjk --- src/plugins/debugger/enginemanager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/debugger/enginemanager.cpp b/src/plugins/debugger/enginemanager.cpp index 5b6fb74ac49..4656f15cb30 100644 --- a/src/plugins/debugger/enginemanager.cpp +++ b/src/plugins/debugger/enginemanager.cpp @@ -143,6 +143,11 @@ public: connect(m_engineChooser, &QComboBox::activated, this, [this](int index) { QModelIndex sourceIndex = m_proxyModel->mapToSource(m_proxyModel->index(index, 0)); emit activated(sourceIndex.row()); + m_lastActivatedIndex = sourceIndex.row(); + }); + + connect(m_proxyModel, &QAbstractItemModel::rowsRemoved, this, [this] { + setCurrentIndex(m_lastActivatedIndex); }); } @@ -188,6 +193,7 @@ private: QPointer m_proxyModel; QAbstractItemModel *m_sourceModel; QString m_enginType; + int m_lastActivatedIndex = -1; }; struct PerspectiveItem