From bc325eb9ab31918b3987d0f91a1cdd39a3854892 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 14 Jul 2010 14:52:14 +0200 Subject: [PATCH] debugger: disable some watch related actions when appropriate --- src/plugins/debugger/watchwindow.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 67357efccd4..35c7b78adff 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -283,7 +283,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) const bool actionsEnabled = modelData(EngineActionsEnabledRole).toBool(); const unsigned engineCapabilities = modelData(EngineCapabilitiesRole).toUInt(); - const bool canHandleWatches = actionsEnabled && (engineCapabilities & AddWatcherCapability); + const bool canHandleWatches = + actionsEnabled && (engineCapabilities & AddWatcherCapability); QMenu menu; QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item")); @@ -335,12 +336,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) actSetWatchPointAtVariableAddress->setEnabled(false); } - QAction *actWatchExpression = - new QAction(tr("Watch Expression \"%1\"").arg(exp), &menu); - actWatchExpression->setEnabled(canHandleWatches); + QString actionName = exp.isEmpty() ? tr("Watch Expression") + : tr("Watch Expression \"%1\"").arg(exp); + QAction *actWatchExpression = new QAction(actionName, &menu); + actWatchExpression->setEnabled(canHandleWatches && !exp.isEmpty()); - QAction *actRemoveWatchExpression = - new QAction(tr("Remove Watch Expression \"%1\"").arg(exp), &menu); + actionName = exp.isEmpty() ? tr("Remove Watch Expression") + : tr("Remove Watch Expression \"%1\"").arg(exp); + QAction *actRemoveWatchExpression = new QAction(actionName, &menu); + actRemoveWatchExpression->setEnabled(canHandleWatches && !exp.isEmpty()); if (m_type == LocalsType) menu.addAction(actWatchExpression); -- GitLab