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