aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2012-05-09 13:45:55 +0200
committerEike Ziller <eike.ziller@nokia.com>2012-05-09 14:11:20 +0200
commitdd66fe6c4820be2312de14e1884213d61f9e199b (patch)
tree04804800f42d53da83ef0c36933e1d21caa1686f
parent9ca4df02e7a36b284599cb2095ee2b357e621ca9 (diff)
Revert "debugger: improve expansion behaviour of pinned tooltips."
This reverts commit 89cee4313cca5f16e785d6e1736315ca7374689f, as part of the patch breaks QTCREATORBUG-7277. The GDB case should not filter the Locals model, but the Tooltip model to display tooltips. CDB has no choice, as the tooltips are expressions, i.e. cannot be handled, so using the Locals as fall back there is ok. Change-Id: I196bc683e06f68301bd86aa6fcce14ad2e8c5774 Reviewed-by: Eike Ziller <eike.ziller@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp1
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp27
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.h8
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp1
4 files changed, 27 insertions, 10 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index eac6068952..7563134926 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -561,6 +561,7 @@ bool CdbEngine::setToolTipExpression(const QPoint &mousePos,
}
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
tw->setContext(context);
+ tw->setDebuggerModel(LocalsWatch);
tw->setExpression(exp);
tw->acquireEngine(this);
DebuggerToolTipManager::instance()->showToolTip(mousePos, editor, tw);
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index ce88fe08a0..a07389ddec 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -38,7 +38,6 @@
#include "watchutils.h"
#include "stackhandler.h"
#include "debuggercore.h"
-#include "debuggerinternalconstants.h"
#include <coreplugin/icore.h>
#include <coreplugin/modemanager.h>
@@ -579,7 +578,7 @@ QDebug operator<<(QDebug d, const DebuggerToolTipContext &c)
It consists of a title toolbar and a vertical main layout.
The widget has the ability to save/restore tree model contents to XML.
With the engine acquired, it sets a filter model (by expression) on
- the engine's Locals model.
+ one of the engine's models (debuggerModel).
On release, it serializes and restores the data to a QStandardItemModel
(defaultModel) and displays that.
@@ -618,6 +617,7 @@ DebuggerToolTipWidget::DebuggerToolTipWidget(QWidget *parent) :
m_titleLabel(new DraggableLabel),
m_engineAcquired(false),
m_creationDate(QDate::currentDate()),
+ m_debuggerModel(TooltipsWatch),
m_treeView(new DebuggerToolTipTreeView),
m_defaultModel(new QStandardItemModel(this))
{
@@ -651,8 +651,8 @@ DebuggerToolTipWidget::DebuggerToolTipWidget(QWidget *parent) :
}
bool DebuggerToolTipWidget::matches(const QString &fileName,
- const QString &engineType,
- const QString &function) const
+ const QString &engineType,
+ const QString &function) const
{
if (fileName.isEmpty() || m_context.fileName != fileName)
return false;
@@ -994,7 +994,18 @@ void DebuggerToolTipTreeView::computeSize()
void DebuggerToolTipWidget::doAcquireEngine(Debugger::DebuggerEngine *engine)
{
// Create a filter model on the debugger's model and switch to it.
- QAbstractItemModel *model = engine->localsModel();
+ QAbstractItemModel *model = 0;
+ switch (m_debuggerModel) {
+ case LocalsWatch:
+ model = engine->localsModel();
+ break;
+ case WatchersWatch:
+ model = engine->watchersModel();
+ break;
+ case TooltipsWatch:
+ model = engine->toolTipsModel();
+ break;
+ }
QTC_ASSERT(model, return);
DebuggerToolTipExpressionFilterModel *filterModel =
new DebuggerToolTipExpressionFilterModel(model, m_expression);
@@ -1006,7 +1017,7 @@ QAbstractItemModel *DebuggerToolTipWidget::swapModel(QAbstractItemModel *newMode
QAbstractItemModel *oldModel = m_treeView->swapModel(newModel);
// When looking at some 'this.m_foo.x', expand all items
if (newModel) {
- if (const int level = m_expression.count(QLatin1Char('.')) + 1) {
+ if (const int level = m_expression.count(QLatin1Char('.'))) {
QModelIndex index = newModel->index(0, 0);
for (int i = 0; i < level && index.isValid(); i++, index = index.child(0, 0))
m_treeView->setExpanded(index, true);
@@ -1068,6 +1079,7 @@ void DebuggerToolTipWidget::doSaveSessionData(QXmlStreamWriter &w) const
{
w.writeStartElement(QLatin1String(treeElementC));
QXmlStreamAttributes attributes;
+ attributes.append(QLatin1String(treeModelAttributeC), QString::number(m_debuggerModel));
attributes.append(QLatin1String(treeExpressionAttributeC), m_expression);
w.writeAttributes(attributes);
if (QAbstractItemModel *model = m_treeView->model()) {
@@ -1083,9 +1095,10 @@ void DebuggerToolTipWidget::doLoadSessionData(QXmlStreamReader &r)
return;
// Restore data to default model and show that.
const QXmlStreamAttributes attributes = r.attributes();
+ m_debuggerModel = attributes.value(QLatin1String(treeModelAttributeC)).toString().toInt();
m_expression = attributes.value(QLatin1String(treeExpressionAttributeC)).toString();
if (debugToolTips)
- qDebug() << "DebuggerTreeViewToolTipWidget::doLoadSessionData() " << m_expression;
+ qDebug() << "DebuggerTreeViewToolTipWidget::doLoadSessionData() " << m_debuggerModel << m_expression;
setObjectName(QLatin1String("DebuggerTreeViewToolTipWidget: ") + m_expression);
restoreTreeModel(r, m_defaultModel);
r.readNext(); // Skip </tree>
diff --git a/src/plugins/debugger/debuggertooltipmanager.h b/src/plugins/debugger/debuggertooltipmanager.h
index 8c995c622f..b64209f470 100644
--- a/src/plugins/debugger/debuggertooltipmanager.h
+++ b/src/plugins/debugger/debuggertooltipmanager.h
@@ -54,6 +54,7 @@ QT_END_NAMESPACE
namespace Core {
class IEditor;
+class IMode;
}
namespace TextEditor {
@@ -64,7 +65,6 @@ namespace Debugger {
class DebuggerEngine;
namespace Internal {
-
class DraggableLabel;
class DebuggerToolTipEditor;
@@ -103,9 +103,8 @@ public:
QString function() const { return m_context.function; }
int position() const { return m_context.position; }
// Check for a match at position.
-
bool matches(const QString &fileName,
- const QString &engineType,
+ const QString &engineType = QString(),
const QString &function= QString()) const;
const DebuggerToolTipContext &context() const { return m_context; }
@@ -122,6 +121,8 @@ public:
static DebuggerToolTipWidget *loadSessionData(QXmlStreamReader &r);
+ int debuggerModel() const { return m_debuggerModel; }
+ void setDebuggerModel(int m) { m_debuggerModel = m; }
QString expression() const { return m_expression; }
void setExpression(const QString &e) { m_expression = e; }
@@ -165,6 +166,7 @@ private:
QAbstractItemModel *swapModel(QAbstractItemModel *newModel);
static void restoreTreeModel(QXmlStreamReader &r, QStandardItemModel *m);
+ int m_debuggerModel;
QString m_expression;
DebuggerToolTipTreeView *m_treeView;
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 460de991f4..ba6276e793 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -3786,6 +3786,7 @@ bool GdbEngine::showToolTip()
return true;
}
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
+ tw->setDebuggerModel(TooltipsWatch);
tw->setExpression(expression);
tw->setContext(*m_toolTipContext);
tw->acquireEngine(this);