forked from qt-creator/qt-creator
debugger: fix regression when trying to remove watched expressions
Change-Id: I0d12339ab1903dc78eec699e07fc0c17daab0e5d Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -1609,6 +1609,7 @@ void WatchHandler::insertData(const QList<WatchData> &list)
|
|||||||
void WatchHandler::removeAllData()
|
void WatchHandler::removeAllData()
|
||||||
{
|
{
|
||||||
m_model->reinitialize();
|
m_model->reinitialize();
|
||||||
|
updateWatchersWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::removeData(const QByteArray &iname)
|
void WatchHandler::removeData(const QByteArray &iname)
|
||||||
@@ -1616,6 +1617,7 @@ 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);
|
m_model->destroyItem(item);
|
||||||
|
updateWatchersWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::removeChildren(const QByteArray &iname)
|
void WatchHandler::removeChildren(const QByteArray &iname)
|
||||||
@@ -1623,6 +1625,7 @@ void WatchHandler::removeChildren(const QByteArray &iname)
|
|||||||
WatchItem *item = m_model->findItem(iname);
|
WatchItem *item = m_model->findItem(iname);
|
||||||
if (item)
|
if (item)
|
||||||
m_model->destroyChildren(item);
|
m_model->destroyChildren(item);
|
||||||
|
updateWatchersWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray WatchHandler::watcherName(const QByteArray &exp)
|
QByteArray WatchHandler::watcherName(const QByteArray &exp)
|
||||||
@@ -1766,22 +1769,6 @@ void WatchHandler::clearWatches()
|
|||||||
saveWatchers();
|
saveWatchers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::removeWatchExpression(const QString &exp0)
|
|
||||||
{
|
|
||||||
QByteArray exp = exp0.toLatin1();
|
|
||||||
MODEL_DEBUG("REMOVE WATCH: " << exp);
|
|
||||||
theWatcherNames.remove(exp);
|
|
||||||
|
|
||||||
foreach (WatchItem *item, m_model->m_watchRoot->children) {
|
|
||||||
if (item->exp == exp) {
|
|
||||||
m_model->destroyItem(item);
|
|
||||||
saveWatchers();
|
|
||||||
updateWatchersWindow();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WatchHandler::updateWatchersWindow()
|
void WatchHandler::updateWatchersWindow()
|
||||||
{
|
{
|
||||||
// Force show/hide of watchers and return view.
|
// Force show/hide of watchers and return view.
|
||||||
|
@@ -89,7 +89,6 @@ public:
|
|||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void watchExpression(const QString &exp);
|
void watchExpression(const QString &exp);
|
||||||
void removeWatchExpression(const QString &exp);
|
|
||||||
Q_SLOT void clearWatches();
|
Q_SLOT void clearWatches();
|
||||||
|
|
||||||
void updateWatchers(); // Called after locals are fetched
|
void updateWatchers(); // Called after locals are fetched
|
||||||
|
@@ -131,7 +131,7 @@ 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->removeWatchExpression(exp);
|
m_watchWindow->removeWatch(index.data(LocalsINameRole).toByteArray());
|
||||||
m_watchWindow->watchExpression(value);
|
m_watchWindow->watchExpression(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,13 +515,10 @@ 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());
|
||||||
QStringList exps;
|
|
||||||
foreach (const QModelIndex &idx, indices) {
|
foreach (const QModelIndex &idx, indices) {
|
||||||
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
const QByteArray iname = idx.data(LocalsINameRole).toByteArray();
|
||||||
exps.append(idx1.data(LocalsRawExpressionRole).toString());
|
removeWatch(iname);
|
||||||
}
|
}
|
||||||
foreach (const QString &exp, exps)
|
|
||||||
removeWatchExpression(exp);
|
|
||||||
} 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) {
|
||||||
@@ -780,8 +777,12 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
|
|
||||||
// Can remove watch if engine can handle it or session engine.
|
// Can remove watch if engine can handle it or session engine.
|
||||||
QModelIndex p = mi0;
|
QModelIndex p = mi0;
|
||||||
while (p.parent().isValid())
|
while (true) {
|
||||||
p = p.parent();
|
QModelIndex pp = p.parent();
|
||||||
|
if (!pp.isValid() || !pp.parent().isValid())
|
||||||
|
break;
|
||||||
|
p = pp;
|
||||||
|
}
|
||||||
QString removeExp = p.data(LocalsExpressionRole).toString();
|
QString removeExp = p.data(LocalsExpressionRole).toString();
|
||||||
QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(removeExp), &menu);
|
QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(removeExp), &menu);
|
||||||
actRemoveWatchExpression->setEnabled(
|
actRemoveWatchExpression->setEnabled(
|
||||||
@@ -923,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) {
|
||||||
removeWatchExpression(removeExp);
|
removeWatch(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) {
|
||||||
@@ -1042,9 +1043,9 @@ void WatchTreeView::watchExpression(const QString &exp)
|
|||||||
currentEngine()->watchHandler()->watchExpression(exp);
|
currentEngine()->watchHandler()->watchExpression(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchTreeView::removeWatchExpression(const QString &exp)
|
void WatchTreeView::removeWatch(const QByteArray &iname)
|
||||||
{
|
{
|
||||||
currentEngine()->watchHandler()->removeWatchExpression(exp);
|
currentEngine()->watchHandler()->removeData(iname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchTreeView::setModelData
|
void WatchTreeView::setModelData
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void watchExpression(const QString &exp);
|
void watchExpression(const QString &exp);
|
||||||
void removeWatchExpression(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