diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index aff64de8f8d..cf4a40de9a6 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -919,6 +919,7 @@ public slots: exp = removeObviousSideEffects(exp); else exp = fixCppExpression(exp); + exp = exp.trimmed(); if (exp.isEmpty()) return; currentEngine()->watchHandler()->watchVariable(exp); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 687d26ef3a9..015f6a2ea74 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -856,7 +856,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role case Qt::EditRole: switch (idx.column()) { case 0: { - m_handler->watchExpression(value.toString()); + m_handler->watchExpression(value.toString().trimmed()); break; } case 1: // Change value @@ -1491,7 +1491,7 @@ void WatchHandler::loadSessionData() QVariant value = sessionValue("Watchers"); m_model->m_watchRoot->removeChildren(); foreach (const QString &exp, value.toStringList()) - watchExpression(exp); + watchExpression(exp.trimmed()); } WatchModelBase *WatchHandler::model() const diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 6ff501c61e3..c82a3fa5b93 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -1108,7 +1108,7 @@ void WatchTreeView::inputNewExpression() "\">documentation.")); dlg.setHistoryCompleter(QLatin1String("WatchItems")); if (dlg.exec() == QDialog::Accepted) { - QString exp = dlg.text(); + const QString exp = dlg.text().trimmed(); if (!exp.isEmpty()) watchExpression(exp, exp); }