forked from qt-creator/qt-creator
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 <orgads@gmail.com>
This commit is contained in:
@@ -882,7 +882,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
|
|||||||
case Qt::EditRole:
|
case Qt::EditRole:
|
||||||
switch (idx.column()) {
|
switch (idx.column()) {
|
||||||
case 0: {
|
case 0: {
|
||||||
m_handler->watchExpression(value.toString().trimmed());
|
m_handler->updateWatchExpression(item, value.toString().trimmed().toUtf8());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // Change value
|
case 1: // Change value
|
||||||
@@ -1278,6 +1278,30 @@ void WatchHandler::watchExpression(const QString &exp0, const QString &name)
|
|||||||
if (m_model->m_engine->state() == DebuggerNotReady) {
|
if (m_model->m_engine->state() == DebuggerNotReady) {
|
||||||
item->setAllUnneeded();
|
item->setAllUnneeded();
|
||||||
item->setValue(QString(QLatin1Char(' ')));
|
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 {
|
} else {
|
||||||
m_model->m_engine->updateItem(item->iname);
|
m_model->m_engine->updateItem(item->iname);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ public:
|
|||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void watchExpression(const QString &exp, const QString &name = QString());
|
void watchExpression(const QString &exp, const QString &name = QString());
|
||||||
|
void updateWatchExpression(WatchItem *item, const QByteArray &newExp);
|
||||||
void watchVariable(const QString &exp);
|
void watchVariable(const QString &exp);
|
||||||
Q_SLOT void clearWatches();
|
Q_SLOT void clearWatches();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user