forked from qt-creator/qt-creator
debugger: improve expansion behaviour of pinned tooltips.
Task-number: QTCREATORBUG-6554 Change-Id: I26ea4e5eb5826baaa6fd3bd4b199dd34e88703e0 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -560,7 +560,6 @@ bool CdbEngine::setToolTipExpression(const QPoint &mousePos,
|
|||||||
}
|
}
|
||||||
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
|
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
|
||||||
tw->setContext(context);
|
tw->setContext(context);
|
||||||
tw->setDebuggerModel(LocalsWatch);
|
|
||||||
tw->setExpression(exp);
|
tw->setExpression(exp);
|
||||||
tw->acquireEngine(this);
|
tw->acquireEngine(this);
|
||||||
DebuggerToolTipManager::instance()->showToolTip(mousePos, editor, tw);
|
DebuggerToolTipManager::instance()->showToolTip(mousePos, editor, tw);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "watchutils.h"
|
#include "watchutils.h"
|
||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
|
#include "debuggerinternalconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
@@ -578,7 +579,7 @@ QDebug operator<<(QDebug d, const DebuggerToolTipContext &c)
|
|||||||
It consists of a title toolbar and a vertical main layout.
|
It consists of a title toolbar and a vertical main layout.
|
||||||
The widget has the ability to save/restore tree model contents to XML.
|
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
|
With the engine acquired, it sets a filter model (by expression) on
|
||||||
one of the engine's models (debuggerModel).
|
the engine's Locals model.
|
||||||
On release, it serializes and restores the data to a QStandardItemModel
|
On release, it serializes and restores the data to a QStandardItemModel
|
||||||
(defaultModel) and displays that.
|
(defaultModel) and displays that.
|
||||||
|
|
||||||
@@ -617,7 +618,6 @@ DebuggerToolTipWidget::DebuggerToolTipWidget(QWidget *parent) :
|
|||||||
m_titleLabel(new DraggableLabel),
|
m_titleLabel(new DraggableLabel),
|
||||||
m_engineAcquired(false),
|
m_engineAcquired(false),
|
||||||
m_creationDate(QDate::currentDate()),
|
m_creationDate(QDate::currentDate()),
|
||||||
m_debuggerModel(TooltipsWatch),
|
|
||||||
m_treeView(new DebuggerToolTipTreeView),
|
m_treeView(new DebuggerToolTipTreeView),
|
||||||
m_defaultModel(new QStandardItemModel(this))
|
m_defaultModel(new QStandardItemModel(this))
|
||||||
{
|
{
|
||||||
@@ -993,18 +993,7 @@ void DebuggerToolTipTreeView::computeSize()
|
|||||||
void DebuggerToolTipWidget::doAcquireEngine(Debugger::DebuggerEngine *engine)
|
void DebuggerToolTipWidget::doAcquireEngine(Debugger::DebuggerEngine *engine)
|
||||||
{
|
{
|
||||||
// Create a filter model on the debugger's model and switch to it.
|
// Create a filter model on the debugger's model and switch to it.
|
||||||
QAbstractItemModel *model = 0;
|
QAbstractItemModel *model = engine->localsModel();
|
||||||
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);
|
QTC_ASSERT(model, return);
|
||||||
DebuggerToolTipExpressionFilterModel *filterModel =
|
DebuggerToolTipExpressionFilterModel *filterModel =
|
||||||
new DebuggerToolTipExpressionFilterModel(model, m_expression);
|
new DebuggerToolTipExpressionFilterModel(model, m_expression);
|
||||||
@@ -1016,7 +1005,7 @@ QAbstractItemModel *DebuggerToolTipWidget::swapModel(QAbstractItemModel *newMode
|
|||||||
QAbstractItemModel *oldModel = m_treeView->swapModel(newModel);
|
QAbstractItemModel *oldModel = m_treeView->swapModel(newModel);
|
||||||
// When looking at some 'this.m_foo.x', expand all items
|
// When looking at some 'this.m_foo.x', expand all items
|
||||||
if (newModel) {
|
if (newModel) {
|
||||||
if (const int level = m_expression.count(QLatin1Char('.'))) {
|
if (const int level = m_expression.count(QLatin1Char('.')) + 1) {
|
||||||
QModelIndex index = newModel->index(0, 0);
|
QModelIndex index = newModel->index(0, 0);
|
||||||
for (int i = 0; i < level && index.isValid(); i++, index = index.child(0, 0))
|
for (int i = 0; i < level && index.isValid(); i++, index = index.child(0, 0))
|
||||||
m_treeView->setExpanded(index, true);
|
m_treeView->setExpanded(index, true);
|
||||||
@@ -1078,7 +1067,6 @@ void DebuggerToolTipWidget::doSaveSessionData(QXmlStreamWriter &w) const
|
|||||||
{
|
{
|
||||||
w.writeStartElement(QLatin1String(treeElementC));
|
w.writeStartElement(QLatin1String(treeElementC));
|
||||||
QXmlStreamAttributes attributes;
|
QXmlStreamAttributes attributes;
|
||||||
attributes.append(QLatin1String(treeModelAttributeC), QString::number(m_debuggerModel));
|
|
||||||
attributes.append(QLatin1String(treeExpressionAttributeC), m_expression);
|
attributes.append(QLatin1String(treeExpressionAttributeC), m_expression);
|
||||||
w.writeAttributes(attributes);
|
w.writeAttributes(attributes);
|
||||||
if (QAbstractItemModel *model = m_treeView->model()) {
|
if (QAbstractItemModel *model = m_treeView->model()) {
|
||||||
@@ -1094,10 +1082,9 @@ void DebuggerToolTipWidget::doLoadSessionData(QXmlStreamReader &r)
|
|||||||
return;
|
return;
|
||||||
// Restore data to default model and show that.
|
// Restore data to default model and show that.
|
||||||
const QXmlStreamAttributes attributes = r.attributes();
|
const QXmlStreamAttributes attributes = r.attributes();
|
||||||
m_debuggerModel = attributes.value(QLatin1String(treeModelAttributeC)).toString().toInt();
|
|
||||||
m_expression = attributes.value(QLatin1String(treeExpressionAttributeC)).toString();
|
m_expression = attributes.value(QLatin1String(treeExpressionAttributeC)).toString();
|
||||||
if (debugToolTips)
|
if (debugToolTips)
|
||||||
qDebug() << "DebuggerTreeViewToolTipWidget::doLoadSessionData() " << m_debuggerModel << m_expression;
|
qDebug() << "DebuggerTreeViewToolTipWidget::doLoadSessionData() " << m_expression;
|
||||||
setObjectName(QLatin1String("DebuggerTreeViewToolTipWidget: ") + m_expression);
|
setObjectName(QLatin1String("DebuggerTreeViewToolTipWidget: ") + m_expression);
|
||||||
restoreTreeModel(r, m_defaultModel);
|
restoreTreeModel(r, m_defaultModel);
|
||||||
r.readNext(); // Skip </tree>
|
r.readNext(); // Skip </tree>
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IEditor;
|
class IEditor;
|
||||||
class IMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
@@ -65,6 +64,7 @@ namespace Debugger {
|
|||||||
class DebuggerEngine;
|
class DebuggerEngine;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class DraggableLabel;
|
class DraggableLabel;
|
||||||
class DebuggerToolTipEditor;
|
class DebuggerToolTipEditor;
|
||||||
|
|
||||||
@@ -103,8 +103,9 @@ public:
|
|||||||
QString function() const { return m_context.function; }
|
QString function() const { return m_context.function; }
|
||||||
int position() const { return m_context.position; }
|
int position() const { return m_context.position; }
|
||||||
// Check for a match at position.
|
// Check for a match at position.
|
||||||
|
|
||||||
bool matches(const QString &fileName,
|
bool matches(const QString &fileName,
|
||||||
const QString &engineType = QString(),
|
const QString &engineType,
|
||||||
const QString &function= QString()) const;
|
const QString &function= QString()) const;
|
||||||
|
|
||||||
const DebuggerToolTipContext &context() const { return m_context; }
|
const DebuggerToolTipContext &context() const { return m_context; }
|
||||||
@@ -121,8 +122,6 @@ public:
|
|||||||
|
|
||||||
static DebuggerToolTipWidget *loadSessionData(QXmlStreamReader &r);
|
static DebuggerToolTipWidget *loadSessionData(QXmlStreamReader &r);
|
||||||
|
|
||||||
int debuggerModel() const { return m_debuggerModel; }
|
|
||||||
void setDebuggerModel(int m) { m_debuggerModel = m; }
|
|
||||||
QString expression() const { return m_expression; }
|
QString expression() const { return m_expression; }
|
||||||
void setExpression(const QString &e) { m_expression = e; }
|
void setExpression(const QString &e) { m_expression = e; }
|
||||||
|
|
||||||
@@ -166,7 +165,6 @@ private:
|
|||||||
QAbstractItemModel *swapModel(QAbstractItemModel *newModel);
|
QAbstractItemModel *swapModel(QAbstractItemModel *newModel);
|
||||||
static void restoreTreeModel(QXmlStreamReader &r, QStandardItemModel *m);
|
static void restoreTreeModel(QXmlStreamReader &r, QStandardItemModel *m);
|
||||||
|
|
||||||
int m_debuggerModel;
|
|
||||||
QString m_expression;
|
QString m_expression;
|
||||||
|
|
||||||
DebuggerToolTipTreeView *m_treeView;
|
DebuggerToolTipTreeView *m_treeView;
|
||||||
|
|||||||
@@ -3744,7 +3744,6 @@ bool GdbEngine::showToolTip()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
|
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
|
||||||
tw->setDebuggerModel(TooltipsWatch);
|
|
||||||
tw->setExpression(expression);
|
tw->setExpression(expression);
|
||||||
tw->setContext(*m_toolTipContext);
|
tw->setContext(*m_toolTipContext);
|
||||||
tw->acquireEngine(this);
|
tw->acquireEngine(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user