From d8c8603a32a4292b0d487df328107616eb97e5d4 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 25 Aug 2011 12:36:11 +0200 Subject: [PATCH] debugger: Fix context menu behavior for evaluated expression children Task-number: QTCREATORBUG-5920 Change-Id: I5e215fd1df9596deb3b821764806f1db65096572 Reviewed-on: http://codereview.qt.nokia.com/3610 Reviewed-by: hjk --- src/plugins/debugger/watchwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index dfe35c27ce2..16b8fb5c05d 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -772,7 +772,11 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) actWatchExpression->setEnabled(canHandleWatches && !exp.isEmpty()); // Can remove watch if engine can handle it or session engine. - QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(exp), &menu); + QModelIndex p = mi0; + while (p.parent().isValid()) + p = p.parent(); + QString removeExp = p.data(LocalsExpressionRole).toString(); + QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(removeExp), &menu); actRemoveWatchExpression->setEnabled( (canHandleWatches || state == DebuggerNotReady) && !exp.isEmpty()); QAction *actRemoveWatches = @@ -923,7 +927,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) } else if (act == actWatchExpression) { watchExpression(exp); } else if (act == actRemoveWatchExpression) { - removeWatchExpression(exp); + removeWatchExpression(removeExp); } else if (act == actCopy) { copyToClipboard(DebuggerToolTipWidget::treeModelClipboardContents(model())); } else if (act == actCopyValue) {