Commit 7a88612a authored by hjk's avatar hjk

Debugger: Don't add a new watcher item when editing one in-place

Task-number: QTCREATORBUG-14775
Task-number: QTCREATORBUG-14851
Change-Id: I06638ffc2d5a1723e87c1c5a651592e7e0bbad22
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent f99e4060
......@@ -882,7 +882,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().trimmed());
m_handler->updateWatchExpression(item, value.toString().trimmed().toUtf8());
break;
}
case 1: // Change value
......@@ -1278,6 +1278,30 @@ void WatchHandler::watchExpression(const QString &exp0, const QString &name)
if (m_model->m_engine->state() == DebuggerNotReady) {
item->setAllUnneeded();
item->setValue(QString(QLatin1Char(' ')));
item->update();
} else {
m_model->m_engine->updateItem(item->iname);
}
updateWatchersWindow();
}
void WatchHandler::updateWatchExpression(WatchItem *item, const QByteArray &newExp)
{
if (newExp.isEmpty())
return;
if (item->exp != newExp) {
theWatcherNames.insert(newExp, theWatcherNames.value(item->exp));
theWatcherNames.remove(item->exp);
item->exp = newExp;
item->name = QString::fromUtf8(item->exp);
}
saveWatchers();
if (m_model->m_engine->state() == DebuggerNotReady) {
item->setAllUnneeded();
item->setValue(QString(QLatin1Char(' ')));
item->update();
} else {
m_model->m_engine->updateItem(item->iname);
}
......
......@@ -153,6 +153,7 @@ public:
void cleanup();
void watchExpression(const QString &exp, const QString &name = QString());
void updateWatchExpression(WatchItem *item, const QByteArray &newExp);
void watchVariable(const QString &exp);
Q_SLOT void clearWatches();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment