forked from qt-creator/qt-creator
Debugger: Merge Locals and Expressions context menus
Task-number: QTCREATORBUG-12310 Change-Id: Id5566021038ef03998103684e41df334baae2d94 Reviewed-by: Christian Stenger <christian.stenger@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -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)
|
|||||||
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);
|
|
||||||
actRemoveWatches->setEnabled(!WatchHandler::watcherNames().isEmpty());
|
|
||||||
|
|
||||||
if (m_type == LocalsType) {
|
|
||||||
menu.addAction(actWatchExpression);
|
menu.addAction(actWatchExpression);
|
||||||
} else if (m_type == WatchersType) {
|
|
||||||
menu.addAction(actRemoveWatchExpression);
|
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)
|
|||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user