aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/watchhandler.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2010-09-08 09:09:09 +0200
committerhjk <[email protected]>2010-09-08 09:10:22 +0200
commit1d3606f4b95b34aed5012960576b36e830bb10f5 (patch)
tree2d56e3ce1e6e05b10c7131e306cfaea1c578b3d4 /src/plugins/debugger/watchhandler.cpp
parent18d14b536707a8f3eb6d8619e8112dbf369aa59b (diff)
debugger: provide a method to copy Locals&Watchers contents into a main editor.
Task-number: QTCREATORBUG-982
Diffstat (limited to 'src/plugins/debugger/watchhandler.cpp')
-rw-r--r--src/plugins/debugger/watchhandler.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index b913fd3ff91..9a062a420a1 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -743,6 +743,11 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro
return true;
}
+ case RequestShowInEditorRole: {
+ m_handler->showInEditor();
+ return true;
+ }
+
case RequestToggleWatchRole: {
BreakHandler *handler = engine()->breakHandler();
const quint64 address = value.toULongLong();
@@ -1616,5 +1621,26 @@ void WatchHandler::addTypeFormats(const QByteArray &type, const QStringList &for
m_reportedTypeFormats.insert(type, formats);
}
+void WatchHandler::showInEditor()
+{
+ QString contents;
+ showInEditorHelper(&contents, m_locals->m_root, 0);
+ showInEditorHelper(&contents, m_watchers->m_root, 0);
+ plugin()->openTextEditor(tr("Locals & Watchers"), contents);
+}
+
+void WatchHandler::showInEditorHelper(QString *contents, WatchItem *item, int depth)
+{
+ const QChar tab = QLatin1Char('\t');
+ const QChar nl = QLatin1Char('\n');
+ contents->append(QString(depth, tab));
+ contents->append(item->name);
+ contents->append(tab);
+ contents->append(item->value);
+ contents->append(nl);
+ foreach (WatchItem *child, item->children)
+ showInEditorHelper(contents, child, depth + 1);
+}
+
} // namespace Internal
} // namespace Debugger