From b1d255efeb17e7f1cf38d213a59b086747b2cee2 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Thu, 17 Mar 2011 19:37:07 +0100
Subject: [PATCH] debugger: fix removal of dummy <Edit> watch item using the
 <Del> key

---
 src/plugins/debugger/debuggerconstants.h | 1 +
 src/plugins/debugger/watchhandler.cpp    | 3 +++
 src/plugins/debugger/watchwindow.cpp     | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index 3a9e6b46906..c7ba8834b6d 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -214,6 +214,7 @@ enum ModelRoles
     LocalsEditTypeRole,     // A QVariant::type describing the item
     LocalsIntegerBaseRole,  // Number base 16, 10, 8, 2
     LocalsExpressionRole,
+    LocalsRawExpressionRole,
     LocalsExpandedRole,     // The preferred expanded state to the view
     LocalsTypeFormatListRole,
     LocalsTypeFormatRole,   // Used to communicate alternative formats to the view
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 2fe3481810d..f7826ccd289 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -682,6 +682,9 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
         case LocalsExpressionRole:
             return QVariant(expression(item));
 
+        case LocalsRawExpressionRole:
+            return data.exp;
+
         case LocalsINameRole:
             return data.iname;
 
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index eb936697009..1632e655635 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -191,7 +191,7 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev)
     if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
         QModelIndex idx = currentIndex();
         QModelIndex idx1 = idx.sibling(idx.row(), 0);
-        QString exp = idx1.data().toString();
+        QString exp = idx1.data(LocalsRawExpressionRole).toString();
         removeWatchExpression(exp);
     } else if (ev->key() == Qt::Key_Return
             && ev->modifiers() == Qt::ControlModifier
-- 
GitLab