Debugger: Fix persisting of debugger settings

When triggering them from the context menu while debugging.
Fix used settings group when triggering writeSettings() on
the aspect instead of the AspectContainer.
Explicitly persist respective settings when triggering them
on the context menu.

Fixes: QTCREATORBUG-30491
Change-Id: I6f429bb54630cbe61c8b2ee063028f323a2d08f6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2024-03-05 10:45:46 +01:00
parent 477f4e18eb
commit 27c02d94af
2 changed files with 31 additions and 24 deletions

View File

@@ -1820,13 +1820,20 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator();
DebuggerSettings &s = settings();
menu->addAction(s.useDebuggingHelpers.action());
QAction *debugHelperAction = s.useDebuggingHelpers.action();
menu->addAction(debugHelperAction);
menu->addAction(s.useToolTipsInLocalsView.action());
menu->addAction(s.autoDerefPointers.action());
menu->addAction(s.sortStructMembers.action());
menu->addAction(s.useDynamicType.action());
QAction *dynamicTypeAction = s.useDynamicType.action();
menu->addAction(dynamicTypeAction);
menu->addAction(s.settingsDialog.action());
// useDebuggingHelpers/useDynamicType have no auto-apply, but need to be persisted on triggered
connect(debugHelperAction, &QAction::triggered,
&s.useDebuggingHelpers, &BoolAspect::writeSettings, Qt::UniqueConnection);
connect(dynamicTypeAction, &QAction::triggered,
&s.useDynamicType, &BoolAspect::writeSettings, Qt::UniqueConnection);
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos());
return true;