Commit f7a4e447 authored by hjk's avatar hjk

Debugger: Merge Locals and Expressions context menus

Task-number: QTCREATORBUG-12310
Change-Id: Id5566021038ef03998103684e41df334baae2d94
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 76fd01d4
...@@ -810,7 +810,8 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) ...@@ -810,7 +810,8 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator(); menu.addSeparator();
QAction *actWatchExpression = new QAction(addWatchActionText(exp), &menu); QAction *actWatchExpression = new QAction(addWatchActionText(exp), &menu);
actWatchExpression->setEnabled(canHandleWatches && !exp.isEmpty()); actWatchExpression->setEnabled(
canHandleWatches && !exp.isEmpty() && m_type == LocalsType);
// Can remove watch if engine can handle it or session engine. // Can remove watch if engine can handle it or session engine.
QModelIndex p = mi0; QModelIndex p = mi0;
...@@ -823,17 +824,10 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) ...@@ -823,17 +824,10 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
QString removeExp = p.data(LocalsExpressionRole).toString(); QString removeExp = p.data(LocalsExpressionRole).toString();
QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(removeExp), &menu); QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(removeExp), &menu);
actRemoveWatchExpression->setEnabled( actRemoveWatchExpression->setEnabled(
(canHandleWatches || state == DebuggerNotReady) && !exp.isEmpty()); (canHandleWatches || state == DebuggerNotReady)
QAction *actRemoveWatches = && !exp.isEmpty() && m_type == WatchersType);
new QAction(tr("Remove All Expression Evaluators"), &menu); menu.addAction(actWatchExpression);
actRemoveWatches->setEnabled(!WatchHandler::watcherNames().isEmpty()); menu.addAction(actRemoveWatchExpression);
if (m_type == LocalsType) {
menu.addAction(actWatchExpression);
} else if (m_type == WatchersType) {
menu.addAction(actRemoveWatchExpression);
menu.addAction(actRemoveWatches);
}
QMenu formatMenu(tr("Change Local Display Format...")); QMenu formatMenu(tr("Change Local Display Format..."));
if (mi0.isValid()) { if (mi0.isValid()) {
...@@ -972,8 +966,6 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) ...@@ -972,8 +966,6 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
copyToClipboard(DebuggerToolTipWidget::treeModelClipboardContents(model())); copyToClipboard(DebuggerToolTipWidget::treeModelClipboardContents(model()));
} else if (act == actCopyValue) { } else if (act == actCopyValue) {
copyToClipboard(mi1.data().toString()); copyToClipboard(mi1.data().toString());
} else if (act == actRemoveWatches) {
handler->clearWatches();
} else if (act == actShowInEditor) { } else if (act == actShowInEditor) {
QString contents = handler->editorContents(); QString contents = handler->editorContents();
debuggerCore()->openTextEditor(tr("Locals & Expressions"), contents); debuggerCore()->openTextEditor(tr("Locals & Expressions"), contents);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment