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: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Artem Sokolovskii
2023-08-31 15:37:26 +02:00
parent 3beaa29e29
commit 05fac26dc9

View File

@@ -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<EngineTypeFilterProxyModel> m_proxyModel;
QAbstractItemModel *m_sourceModel;
QString m_enginType;
int m_lastActivatedIndex = -1;
};
struct PerspectiveItem