summaryrefslogtreecommitdiff
path: root/src/plugins/debugger
diff options
context:
space:
mode:
authorhjk <qthjk@ovi.com>2013-01-10 15:48:45 +0100
committerhjk <qthjk@ovi.com>2013-01-10 16:01:36 +0100
commitb36afdac3e4fa58602e1a98cd7e038903c284bea (patch)
treeecb9ec331d18a6965ef984516dd03852287511a1 /src/plugins/debugger
parentca76c704fdda670d2f88a169751b991abb8260b9 (diff)
downloadqt-creator-b36afdac3e4fa58602e1a98cd7e038903c284bea.tar.gz
Debugger: make variable format changes work with multi-selection
Task-number: QTCREATORBUG-7577 Change-Id: I9c9a5b40bfe88970d99ed855e4c912fc98f1fa11 Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r--src/plugins/debugger/watchwindow.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 7464044a2a..1f74574dd5 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -502,11 +502,8 @@ void WatchTreeView::collapseNode(const QModelIndex &idx)
void WatchTreeView::keyPressEvent(QKeyEvent *ev)
{
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
- QModelIndexList indices = selectionModel()->selectedRows();
- if (indices.isEmpty() && selectionModel()->currentIndex().isValid())
- indices.append(selectionModel()->currentIndex());
WatchHandler *handler = currentEngine()->watchHandler();
- foreach (const QModelIndex &idx, indices)
+ foreach (const QModelIndex &idx, activeRows())
handler->removeData(idx.data(LocalsINameRole).toByteArray());
} else if (ev->key() == Qt::Key_Return
&& ev->modifiers() == Qt::ControlModifier
@@ -599,6 +596,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
DebuggerEngine *engine = currentEngine();
WatchHandler *handler = engine->watchHandler();
+ const QModelIndexList active = activeRows();
const QModelIndex idx = indexAt(ev->pos());
const QModelIndex mi0 = idx.sibling(idx.row(), 0);
const QModelIndex mi1 = idx.sibling(idx.row(), 1);
@@ -924,9 +922,11 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == actRemoveWatches) {
handler->clearWatches();
} else if (act == clearTypeFormatAction) {
- setModelData(LocalsTypeFormatRole, -1, mi1);
+ foreach (const QModelIndex &idx, active)
+ setModelData(LocalsTypeFormatRole, -1, idx);
} else if (act == clearIndividualFormatAction) {
- setModelData(LocalsIndividualFormatRole, -1, mi1);
+ foreach (const QModelIndex &idx, active)
+ setModelData(LocalsIndividualFormatRole, -1, idx);
} else if (act == actShowInEditor) {
QString contents = handler->editorContents();
debuggerCore()->openTextEditor(tr("Locals & Expressions"), contents);
@@ -943,13 +943,20 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
} else if (handleBaseContextAction(act)) {
;
} else {
+ // Restrict multiple changes to items of the same type
+ // to avoid assigning illegal formats.
+ const QVariant currentType = mi1.data(LocalsTypeRole);
for (int i = 0; i != typeFormatActions.size(); ++i) {
if (act == typeFormatActions.at(i))
- setModelData(LocalsTypeFormatRole, i, mi1);
+ foreach (const QModelIndex &idx, active)
+ if (idx.data(LocalsTypeRole) == currentType)
+ setModelData(LocalsTypeFormatRole, i, idx);
}
for (int i = 0; i != individualFormatActions.size(); ++i) {
if (act == individualFormatActions.at(i))
- setModelData(LocalsIndividualFormatRole, i, mi1);
+ foreach (const QModelIndex &idx, active)
+ if (idx.data(LocalsTypeRole) == currentType)
+ setModelData(LocalsIndividualFormatRole, i, idx);
}
}
}