Commit 557c73ad authored by hjk's avatar hjk Committed by Friedemann Kleint

debugger: prevent watched expressions from re-appearing

Task-number: QTCREATORBUG-7408
Change-Id: I2936aff74b629b6d58cbcd09e023346dabdf191f
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent ba185b83
......@@ -1615,8 +1615,13 @@ void WatchHandler::removeAllData()
void WatchHandler::removeData(const QByteArray &iname)
{
WatchItem *item = m_model->findItem(iname);
if (item)
m_model->destroyItem(item);
if (!item)
return;
if (item->isWatcher()) {
theWatcherNames.remove(item->exp);
saveWatchers();
}
m_model->destroyItem(item);
updateWatchersWindow();
}
......
......@@ -131,7 +131,8 @@ public:
const QString exp = index.data(LocalsExpressionRole).toString();
if (exp == value)
return;
m_watchWindow->removeWatch(index.data(LocalsINameRole).toByteArray());
WatchHandler *handler = currentEngine()->watchHandler();
handler->removeData(index.data(LocalsINameRole).toByteArray());
m_watchWindow->watchExpression(value);
}
......@@ -515,10 +516,9 @@ void WatchTreeView::keyPressEvent(QKeyEvent *ev)
QModelIndexList indices = selectionModel()->selectedRows();
if (indices.isEmpty() && selectionModel()->currentIndex().isValid())
indices.append(selectionModel()->currentIndex());
foreach (const QModelIndex &idx, indices) {
const QByteArray iname = idx.data(LocalsINameRole).toByteArray();
removeWatch(iname);
}
WatchHandler *handler = currentEngine()->watchHandler();
foreach (const QModelIndex &idx, indices)
handler->removeData(idx.data(LocalsINameRole).toByteArray());
} else if (ev->key() == Qt::Key_Return
&& ev->modifiers() == Qt::ControlModifier
&& m_type == LocalsType) {
......@@ -924,7 +924,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == actWatchExpression) {
watchExpression(exp);
} else if (act == actRemoveWatchExpression) {
removeWatch(p.data(LocalsINameRole).toByteArray());
handler->removeData(p.data(LocalsINameRole).toByteArray());
} else if (act == actCopy) {
copyToClipboard(DebuggerToolTipWidget::treeModelClipboardContents(model()));
} else if (act == actEditTypeFormats) {
......@@ -932,7 +932,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == actCopyValue) {
copyToClipboard(mi1.data().toString());
} else if (act == actRemoveWatches) {
currentEngine()->watchHandler()->clearWatches();
handler->clearWatches();
} else if (act == clearTypeFormatAction) {
setModelData(LocalsTypeFormatRole, -1, mi1);
} else if (act == clearIndividualFormatAction) {
......@@ -1043,11 +1043,6 @@ void WatchTreeView::watchExpression(const QString &exp)
currentEngine()->watchHandler()->watchExpression(exp);
}
void WatchTreeView::removeWatch(const QByteArray &iname)
{
currentEngine()->watchHandler()->removeData(iname);
}
void WatchTreeView::setModelData
(int role, const QVariant &value, const QModelIndex &index)
{
......
......@@ -58,7 +58,6 @@ public:
public slots:
void watchExpression(const QString &exp);
void removeWatch(const QByteArray &iname);
void handleItemIsExpanded(const QModelIndex &idx);
private:
......
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