forked from qt-creator/qt-creator
debugger: use an expandable tree in the debugger tooltip
This commit is contained in:
@@ -27,6 +27,7 @@ HEADERS += \
|
|||||||
debuggeroutputwindow.h \
|
debuggeroutputwindow.h \
|
||||||
debuggerplugin.h \
|
debuggerplugin.h \
|
||||||
debuggerrunner.h \
|
debuggerrunner.h \
|
||||||
|
debuggertooltip.h \
|
||||||
disassemblerhandler.h \
|
disassemblerhandler.h \
|
||||||
disassemblerwindow.h \
|
disassemblerwindow.h \
|
||||||
watchutils.h \
|
watchutils.h \
|
||||||
@@ -55,6 +56,7 @@ SOURCES += \
|
|||||||
debuggeroutputwindow.cpp \
|
debuggeroutputwindow.cpp \
|
||||||
debuggerplugin.cpp \
|
debuggerplugin.cpp \
|
||||||
debuggerrunner.cpp \
|
debuggerrunner.cpp \
|
||||||
|
debuggertooltip.cpp \
|
||||||
disassemblerhandler.cpp \
|
disassemblerhandler.cpp \
|
||||||
disassemblerwindow.cpp \
|
disassemblerwindow.cpp \
|
||||||
watchutils.cpp \
|
watchutils.cpp \
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
#include <QtCore/QTime>
|
#include <QtCore/QTime>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QDockWidget>
|
#include <QtGui/QDockWidget>
|
||||||
@@ -75,16 +76,34 @@
|
|||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QPlainTextEdit>
|
#include <QtGui/QPlainTextEdit>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
#include <QtGui/QStatusBar>
|
#include <QtGui/QStatusBar>
|
||||||
#include <QtGui/QTextBlock>
|
#include <QtGui/QTextBlock>
|
||||||
#include <QtGui/QTextCursor>
|
#include <QtGui/QTextCursor>
|
||||||
#include <QtGui/QToolBar>
|
#include <QtGui/QToolBar>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
#include <QtGui/QPushButton>
|
|
||||||
#include <QtGui/QToolTip>
|
#include <QtGui/QToolTip>
|
||||||
|
|
||||||
|
|
||||||
|
// The creation functions take a list of options pages they can add to.
|
||||||
|
// This allows for having a "enabled" toggle on the page indepently
|
||||||
|
// of the engine.
|
||||||
|
using namespace Debugger::Internal;
|
||||||
|
|
||||||
|
IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
||||||
|
IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineEnabled */, QList<Core::IOptionsPage*> *)
|
||||||
|
#ifdef CDB_ENABLED
|
||||||
|
;
|
||||||
|
#else
|
||||||
|
{ return 0; }
|
||||||
|
#endif
|
||||||
|
IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
||||||
|
IDebuggerEngine *createTcfEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
||||||
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
|
QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
|
||||||
{
|
{
|
||||||
QDebug nospace = str.nospace();
|
QDebug nospace = str.nospace();
|
||||||
@@ -100,12 +119,8 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
|
|||||||
<< " toolchain=" << p.toolChainType << '\n';
|
<< " toolchain=" << p.toolChainType << '\n';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Debugger
|
|
||||||
|
|
||||||
using namespace Debugger;
|
using namespace Constants;
|
||||||
using namespace Debugger::Internal;
|
|
||||||
using namespace Debugger::Constants;
|
|
||||||
|
|
||||||
static const QString tooltipIName = "tooltip";
|
static const QString tooltipIName = "tooltip";
|
||||||
|
|
||||||
@@ -131,36 +146,15 @@ static const char *stateName(int s)
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DebuggerManager
|
// DebuggerStartParameters
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static IDebuggerEngine *gdbEngine = 0;
|
DebuggerStartParameters::DebuggerStartParameters()
|
||||||
static IDebuggerEngine *winEngine = 0;
|
: attachPID(-1),
|
||||||
static IDebuggerEngine *scriptEngine = 0;
|
|
||||||
static IDebuggerEngine *tcfEngine = 0;
|
|
||||||
|
|
||||||
// The creation functions take a list of options pages they can add to.
|
|
||||||
// This allows for having a "enabled" toggle on the page indepently
|
|
||||||
// of the engine.
|
|
||||||
IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
|
||||||
IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineEnabled */, QList<Core::IOptionsPage*> *)
|
|
||||||
#ifdef CDB_ENABLED
|
|
||||||
;
|
|
||||||
#else
|
|
||||||
{ return 0; }
|
|
||||||
#endif
|
|
||||||
IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
|
||||||
IDebuggerEngine *createTcfEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
|
||||||
|
|
||||||
// ---------------- DebuggerStartParameters
|
|
||||||
|
|
||||||
DebuggerStartParameters::DebuggerStartParameters() :
|
|
||||||
attachPID(-1),
|
|
||||||
useTerminal(false),
|
useTerminal(false),
|
||||||
toolChainType(ProjectExplorer::ToolChain::UNKNOWN)
|
toolChainType(ProjectExplorer::ToolChain::UNKNOWN)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerStartParameters::clear()
|
void DebuggerStartParameters::clear()
|
||||||
{
|
{
|
||||||
@@ -179,9 +173,20 @@ void DebuggerStartParameters::clear()
|
|||||||
toolChainType = ProjectExplorer::ToolChain::UNKNOWN;
|
toolChainType = ProjectExplorer::ToolChain::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------- DebuggerManager
|
|
||||||
DebuggerManager::DebuggerManager() :
|
///////////////////////////////////////////////////////////////////////
|
||||||
m_startParameters(new DebuggerStartParameters),
|
//
|
||||||
|
// DebuggerManager
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static IDebuggerEngine *gdbEngine = 0;
|
||||||
|
static IDebuggerEngine *winEngine = 0;
|
||||||
|
static IDebuggerEngine *scriptEngine = 0;
|
||||||
|
static IDebuggerEngine *tcfEngine = 0;
|
||||||
|
|
||||||
|
DebuggerManager::DebuggerManager()
|
||||||
|
: m_startParameters(new DebuggerStartParameters),
|
||||||
m_inferiorPid(0)
|
m_inferiorPid(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@@ -228,8 +233,6 @@ void DebuggerManager::init()
|
|||||||
m_localsWindow = new WatchWindow(WatchWindow::LocalsType);
|
m_localsWindow = new WatchWindow(WatchWindow::LocalsType);
|
||||||
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
||||||
//m_tooltipWindow = new WatchWindow(WatchWindow::TooltipType);
|
//m_tooltipWindow = new WatchWindow(WatchWindow::TooltipType);
|
||||||
//m_watchersWindow = new QTreeView;
|
|
||||||
m_tooltipWindow = new QTreeView;
|
|
||||||
m_statusTimer = new QTimer(this);
|
m_statusTimer = new QTimer(this);
|
||||||
|
|
||||||
m_mainWindow = new QMainWindow;
|
m_mainWindow = new QMainWindow;
|
||||||
@@ -334,8 +337,8 @@ void DebuggerManager::init()
|
|||||||
this, SLOT(assignValueInDebugger()), Qt::QueuedConnection);
|
this, SLOT(assignValueInDebugger()), Qt::QueuedConnection);
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
QTreeView *tooltipView = qobject_cast<QTreeView *>(m_tooltipWindow);
|
//QTreeView *tooltipView = qobject_cast<QTreeView *>(m_tooltipWindow);
|
||||||
tooltipView->setModel(m_watchHandler->model(TooltipsWatch));
|
//tooltipView->setModel(m_watchHandler->model(TooltipsWatch));
|
||||||
|
|
||||||
connect(m_watchHandler, SIGNAL(watchDataUpdateNeeded(WatchData)),
|
connect(m_watchHandler, SIGNAL(watchDataUpdateNeeded(WatchData)),
|
||||||
this, SLOT(updateWatchData(WatchData)));
|
this, SLOT(updateWatchData(WatchData)));
|
||||||
@@ -461,8 +464,10 @@ void DebuggerManager::init()
|
|||||||
localsAndWatchers->setWindowTitle(m_localsWindow->windowTitle());
|
localsAndWatchers->setWindowTitle(m_localsWindow->windowTitle());
|
||||||
localsAndWatchers->addWidget(m_localsWindow);
|
localsAndWatchers->addWidget(m_localsWindow);
|
||||||
localsAndWatchers->addWidget(m_watchersWindow);
|
localsAndWatchers->addWidget(m_watchersWindow);
|
||||||
|
//localsAndWatchers->addWidget(m_tooltipWindow);
|
||||||
localsAndWatchers->setStretchFactor(0, 3);
|
localsAndWatchers->setStretchFactor(0, 3);
|
||||||
localsAndWatchers->setStretchFactor(1, 1);
|
localsAndWatchers->setStretchFactor(1, 1);
|
||||||
|
localsAndWatchers->setStretchFactor(2, 1);
|
||||||
m_watchDock = createDockForWidget(localsAndWatchers);
|
m_watchDock = createDockForWidget(localsAndWatchers);
|
||||||
|
|
||||||
setStatus(DebuggerProcessNotReady);
|
setStatus(DebuggerProcessNotReady);
|
||||||
@@ -710,7 +715,7 @@ void DebuggerManager::shutdown()
|
|||||||
doDelete(m_stackWindow);
|
doDelete(m_stackWindow);
|
||||||
doDelete(m_sourceFilesWindow);
|
doDelete(m_sourceFilesWindow);
|
||||||
doDelete(m_threadsWindow);
|
doDelete(m_threadsWindow);
|
||||||
doDelete(m_tooltipWindow);
|
//doDelete(m_tooltipWindow);
|
||||||
doDelete(m_watchersWindow);
|
doDelete(m_watchersWindow);
|
||||||
doDelete(m_localsWindow);
|
doDelete(m_localsWindow);
|
||||||
|
|
||||||
@@ -1275,7 +1280,7 @@ void DebuggerManager::setBusyCursor(bool busy)
|
|||||||
m_stackWindow->setCursor(cursor);
|
m_stackWindow->setCursor(cursor);
|
||||||
m_sourceFilesWindow->setCursor(cursor);
|
m_sourceFilesWindow->setCursor(cursor);
|
||||||
m_threadsWindow->setCursor(cursor);
|
m_threadsWindow->setCursor(cursor);
|
||||||
m_tooltipWindow->setCursor(cursor);
|
//m_tooltipWindow->setCursor(cursor);
|
||||||
m_watchersWindow->setCursor(cursor);
|
m_watchersWindow->setCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1561,3 +1566,7 @@ void DebuggerManager::runTest(const QString &fileName)
|
|||||||
m_startParameters->workingDir.clear();
|
m_startParameters->workingDir.clear();
|
||||||
//startNewDebugger(StartInternal);
|
//startNewDebugger(StartInternal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class QAbstractItemModel;
|
|||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QMainWindow;
|
class QMainWindow;
|
||||||
|
class QModelIndex;
|
||||||
class QPoint;
|
class QPoint;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
@@ -70,16 +71,16 @@ class DebuggerPlugin;
|
|||||||
class DebugMode;
|
class DebugMode;
|
||||||
|
|
||||||
class BreakHandler;
|
class BreakHandler;
|
||||||
|
class BreakpointData;
|
||||||
class DisassemblerHandler;
|
class DisassemblerHandler;
|
||||||
class ModulesHandler;
|
class ModulesHandler;
|
||||||
class RegisterHandler;
|
class RegisterHandler;
|
||||||
class StackHandler;
|
|
||||||
class ThreadsHandler;
|
|
||||||
class WatchHandler;
|
|
||||||
class SourceFilesWindow;
|
class SourceFilesWindow;
|
||||||
class WatchData;
|
class StackHandler;
|
||||||
class BreakpointData;
|
|
||||||
class Symbol;
|
class Symbol;
|
||||||
|
class ThreadsHandler;
|
||||||
|
class WatchData;
|
||||||
|
class WatchHandler;
|
||||||
|
|
||||||
// Note: the Debugger process itself is referred to as 'Debugger',
|
// Note: the Debugger process itself is referred to as 'Debugger',
|
||||||
// whereas the debugged process is referred to as 'Inferior' or 'Debuggee'.
|
// whereas the debugged process is referred to as 'Inferior' or 'Debuggee'.
|
||||||
@@ -104,7 +105,6 @@ class Symbol;
|
|||||||
// [N] : Step, Next
|
// [N] : Step, Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum DebuggerStatus
|
enum DebuggerStatus
|
||||||
{
|
{
|
||||||
DebuggerProcessNotReady, // Debugger not started
|
DebuggerProcessNotReady, // Debugger not started
|
||||||
@@ -483,7 +483,7 @@ private:
|
|||||||
QWidget *m_localsWindow;
|
QWidget *m_localsWindow;
|
||||||
QWidget *m_registerWindow;
|
QWidget *m_registerWindow;
|
||||||
QWidget *m_modulesWindow;
|
QWidget *m_modulesWindow;
|
||||||
QWidget *m_tooltipWindow;
|
//QWidget *m_tooltipWindow;
|
||||||
QWidget *m_stackWindow;
|
QWidget *m_stackWindow;
|
||||||
QWidget *m_threadsWindow;
|
QWidget *m_threadsWindow;
|
||||||
QWidget *m_watchersWindow;
|
QWidget *m_watchersWindow;
|
||||||
|
|||||||
211
src/plugins/debugger/debuggertooltip.cpp
Normal file
211
src/plugins/debugger/debuggertooltip.cpp
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** Commercial Usage
|
||||||
|
**
|
||||||
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
|
** accordance with the Qt Commercial License Agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** If you are unsure which license is appropriate for your use, please
|
||||||
|
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "debuggertooltip.h"
|
||||||
|
|
||||||
|
#include <QtCore/QPointer>
|
||||||
|
#include <QtCore/QtDebug>
|
||||||
|
|
||||||
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QHBoxLayout>
|
||||||
|
#include <QtGui/QHeaderView>
|
||||||
|
#include <QtGui/QKeyEvent>
|
||||||
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QTreeView>
|
||||||
|
#include <QtGui/QVBoxLayout>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TooltipTreeView
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class ToolTipTreeView : public QTreeView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ToolTipTreeView(QWidget *parent = 0) : QTreeView(parent) {}
|
||||||
|
|
||||||
|
/*
|
||||||
|
QSize sizeHint() const {
|
||||||
|
qDebug() << viewport()->size()
|
||||||
|
<< viewport()->size().boundedTo(QSize(500, 300));
|
||||||
|
return viewport()->size().boundedTo(QSize(100, 100));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TooltipWidget
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class ToolTipWidget : public QTreeView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ToolTipWidget(QWidget *parent);
|
||||||
|
|
||||||
|
void done();
|
||||||
|
void run(const QPoint &point, QAbstractItemModel *model,
|
||||||
|
const QModelIndex &index, const QString &msg);
|
||||||
|
bool eventFilter(QObject *ob, QEvent *ev);
|
||||||
|
|
||||||
|
QSize sizeHint() const { return m_size; }
|
||||||
|
|
||||||
|
int computeHeight(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
int s = rowHeight(index);
|
||||||
|
for (int i = 0; i < model()->rowCount(index); ++i)
|
||||||
|
s += computeHeight(model()->index(i, 0, index));
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_SLOT void computeSize()
|
||||||
|
{
|
||||||
|
int columns = 0;
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
resizeColumnToContents(i);
|
||||||
|
columns += sizeHintForColumn(i);
|
||||||
|
}
|
||||||
|
int rows = computeHeight(QModelIndex());
|
||||||
|
m_size = QSize(columns + 5, rows + 5);
|
||||||
|
setMinimumSize(m_size);
|
||||||
|
setMaximumSize(m_size);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
QSize m_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
static QPointer<ToolTipWidget> theToolTipWidget;
|
||||||
|
|
||||||
|
|
||||||
|
ToolTipWidget::ToolTipWidget(QWidget *parent)
|
||||||
|
: QTreeView(parent)
|
||||||
|
{
|
||||||
|
setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||||
|
setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
|
header()->hide();
|
||||||
|
|
||||||
|
setUniformRowHeights(true);
|
||||||
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(computeSize()),
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(computeSize()),
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
|
qApp->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ToolTipWidget::eventFilter(QObject *ob, QEvent *ev)
|
||||||
|
{
|
||||||
|
Q_UNUSED(ob);
|
||||||
|
switch (ev->type()) {
|
||||||
|
case QEvent::ShortcutOverride:
|
||||||
|
if (static_cast<QKeyEvent *>(ev)->key() == Qt::Key_Escape)
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case QEvent::KeyPress:
|
||||||
|
if (static_cast<QKeyEvent *>(ev)->key() == Qt::Key_Escape) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case QEvent::KeyRelease:
|
||||||
|
if (static_cast<QKeyEvent *>(ev)->key() == Qt::Key_Escape) {
|
||||||
|
done();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case QEvent::WindowDeactivate:
|
||||||
|
case QEvent::FocusOut:
|
||||||
|
done();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToolTipWidget::done()
|
||||||
|
{
|
||||||
|
qApp->removeEventFilter(this);
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToolTipWidget::run(const QPoint &point, QAbstractItemModel *model,
|
||||||
|
const QModelIndex &index, const QString &msg)
|
||||||
|
{
|
||||||
|
move(point);
|
||||||
|
setModel(model);
|
||||||
|
setRootIndex(index.parent());
|
||||||
|
computeSize();
|
||||||
|
setRootIsDecorated(model->hasChildren(index));
|
||||||
|
// FIXME: use something more sensible
|
||||||
|
QPalette pal = palette();
|
||||||
|
QColor bg = pal.color(QPalette::Base);
|
||||||
|
bg.setAlpha(20);
|
||||||
|
pal.setColor(QPalette::Base, bg);
|
||||||
|
setPalette(pal);
|
||||||
|
//viewport()->setPalette(pal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showDebuggerToolTip(const QPoint &point, QAbstractItemModel *model,
|
||||||
|
const QModelIndex &index, const QString &msg)
|
||||||
|
{
|
||||||
|
if (model) {
|
||||||
|
if (!theToolTipWidget)
|
||||||
|
theToolTipWidget = new ToolTipWidget(0);
|
||||||
|
theToolTipWidget->run(point, model, index, msg);
|
||||||
|
theToolTipWidget->show();
|
||||||
|
} else if (theToolTipWidget) {
|
||||||
|
theToolTipWidget->done();
|
||||||
|
theToolTipWidget = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void hideDebuggerToolTip(int delay)
|
||||||
|
{
|
||||||
|
Q_UNUSED(delay)
|
||||||
|
if (theToolTipWidget)
|
||||||
|
theToolTipWidget->done();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
#include "debuggertooltip.moc"
|
||||||
53
src/plugins/debugger/debuggertooltip.h
Normal file
53
src/plugins/debugger/debuggertooltip.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** Commercial Usage
|
||||||
|
**
|
||||||
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
|
** accordance with the Qt Commercial License Agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** If you are unsure which license is appropriate for your use, please
|
||||||
|
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DEBUGGER_DEBUGGERTOOLTIP_H
|
||||||
|
#define DEBUGGER_DEBUGGERTOOLTIP_H
|
||||||
|
|
||||||
|
#include <qglobal.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QAbstractItemModel;
|
||||||
|
class QModelIndex;
|
||||||
|
class QPoint;
|
||||||
|
class QString;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
void showDebuggerToolTip(const QPoint &point, QAbstractItemModel *model,
|
||||||
|
const QModelIndex &rootIndex, const QString &msg);
|
||||||
|
|
||||||
|
void hideDebuggerToolTip(int delay = 0);
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
#endif // DEBUGGER_DEBUGGERTOOLTIP_H
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
|
#include "debuggertooltip.h"
|
||||||
#include "gdbmi.h"
|
#include "gdbmi.h"
|
||||||
#include "procinterrupt.h"
|
#include "procinterrupt.h"
|
||||||
|
|
||||||
@@ -65,7 +66,6 @@
|
|||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QToolTip>
|
|
||||||
#include <QtGui/QDialogButtonBox>
|
#include <QtGui/QDialogButtonBox>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@@ -103,8 +103,6 @@ static int ¤tToken()
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QString tooltipIName = _("tooltip");
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// GdbEngine
|
// GdbEngine
|
||||||
@@ -2610,18 +2608,42 @@ bool GdbEngine::supportsThreads() const
|
|||||||
return m_gdbVersion > 60500;
|
return m_gdbVersion > 60500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Tooltip specific stuff
|
// Tooltip specific stuff
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static WatchData m_toolTip;
|
|
||||||
static QString m_toolTipExpression;
|
static QString m_toolTipExpression;
|
||||||
static QPoint m_toolTipPos;
|
static QPoint m_toolTipPos;
|
||||||
static QMap<QString, WatchData> m_toolTipCache;
|
|
||||||
|
|
||||||
void GdbEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos)
|
static QString tooltipINameForExpression(const QString &exp)
|
||||||
|
{
|
||||||
|
// FIXME: 'exp' can contain illegal characters
|
||||||
|
//return QLatin1String("tooltip.") + exp;
|
||||||
|
Q_UNUSED(exp);
|
||||||
|
return QLatin1String("tooltip.x");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GdbEngine::showToolTip()
|
||||||
|
{
|
||||||
|
WatchHandler *handler = qq->watchHandler();
|
||||||
|
WatchModel *model = handler->model(TooltipsWatch);
|
||||||
|
QString iname = tooltipINameForExpression(m_toolTipExpression);
|
||||||
|
model->setActiveData(iname);
|
||||||
|
WatchItem *item = model->findItem(iname, model->dummyRoot());
|
||||||
|
if (!item) {
|
||||||
|
hideDebuggerToolTip();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QModelIndex index = model->watchIndex(item);
|
||||||
|
showDebuggerToolTip(m_toolTipPos, model, index, m_toolTipExpression);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||||
|
TextEditor::ITextEditor *editor, int cursorPos)
|
||||||
{
|
{
|
||||||
if (q->status() != DebuggerInferiorStopped || !isCppEditor(editor)) {
|
if (q->status() != DebuggerInferiorStopped || !isCppEditor(editor)) {
|
||||||
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED/Non Cpp editor";
|
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED/Non Cpp editor";
|
||||||
@@ -2635,30 +2657,21 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEd
|
|||||||
|
|
||||||
m_toolTipPos = mousePos;
|
m_toolTipPos = mousePos;
|
||||||
int line, column;
|
int line, column;
|
||||||
m_toolTipExpression = cppExpressionAt(editor, cursorPos, &line, &column);
|
QString exp = cppExpressionAt(editor, cursorPos, &line, &column);
|
||||||
QString exp = m_toolTipExpression;
|
m_toolTipExpression = exp;
|
||||||
/*
|
|
||||||
if (m_toolTip.isTypePending()) {
|
// FIXME: enable caching
|
||||||
qDebug() << "suppressing duplicated tooltip creation";
|
//if (showToolTip())
|
||||||
return;
|
// return;
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (m_toolTipCache.contains(exp)) {
|
|
||||||
const WatchData & data = m_toolTipCache[exp];
|
|
||||||
// FIXME: qq->watchHandler()->collapseChildren(data.iname);
|
|
||||||
insertData(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolTip::hideText();
|
|
||||||
if (exp.isEmpty() || exp.startsWith(_c('#'))) {
|
if (exp.isEmpty() || exp.startsWith(_c('#'))) {
|
||||||
QToolTip::hideText();
|
//QToolTip::hideText();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasLetterOrNumber(exp)) {
|
if (!hasLetterOrNumber(exp)) {
|
||||||
QToolTip::showText(m_toolTipPos,
|
//QToolTip::showText(m_toolTipPos,
|
||||||
tr("'%1' contains no identifier").arg(exp));
|
// tr("'%1' contains no identifier").arg(exp));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2666,7 +2679,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEd
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (exp.startsWith(_c('"')) && exp.endsWith(_c('"'))) {
|
if (exp.startsWith(_c('"')) && exp.endsWith(_c('"'))) {
|
||||||
QToolTip::showText(m_toolTipPos, tr("String literal %1").arg(exp));
|
//QToolTip::showText(m_toolTipPos, tr("String literal %1").arg(exp));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2680,9 +2693,9 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEd
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (hasSideEffects(exp)) {
|
if (hasSideEffects(exp)) {
|
||||||
QToolTip::showText(m_toolTipPos,
|
//QToolTip::showText(m_toolTipPos,
|
||||||
tr("Cowardly refusing to evaluate expression '%1' "
|
// tr("Cowardly refusing to evaluate expression '%1' "
|
||||||
"with potential side effects").arg(exp));
|
// "with potential side effects").arg(exp));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2703,19 +2716,12 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEd
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//if (m_manager->status() != DebuggerInferiorStopped)
|
WatchData toolTip;
|
||||||
// return;
|
toolTip.exp = exp;
|
||||||
|
toolTip.name = exp;
|
||||||
// FIXME: 'exp' can contain illegal characters
|
toolTip.iname = tooltipINameForExpression(exp);
|
||||||
m_toolTip = WatchData();
|
qq->watchHandler()->removeData(toolTip.iname);
|
||||||
//m_toolTip.level = 0;
|
qq->watchHandler()->insertData(toolTip);
|
||||||
// m_toolTip.row = 0;
|
|
||||||
// m_toolTip.parentIndex = 2;
|
|
||||||
m_toolTip.exp = exp;
|
|
||||||
m_toolTip.name = exp;
|
|
||||||
m_toolTip.iname = tooltipIName;
|
|
||||||
insertData(m_toolTip);
|
|
||||||
//updateWatchModel2();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3073,18 +3079,7 @@ void GdbEngine::rebuildModel()
|
|||||||
emit gdbInputAvailable(LogStatus, _("<Rebuild Watchmodel>"));
|
emit gdbInputAvailable(LogStatus, _("<Rebuild Watchmodel>"));
|
||||||
q->showStatusMessage(tr("Finished retrieving data."), 400);
|
q->showStatusMessage(tr("Finished retrieving data."), 400);
|
||||||
qq->watchHandler()->endCycle();
|
qq->watchHandler()->endCycle();
|
||||||
|
showToolTip();
|
||||||
if (!m_toolTipExpression.isEmpty()) {
|
|
||||||
WatchData *item = qq->watchHandler()->findItem(tooltipIName);
|
|
||||||
if (item) {
|
|
||||||
//m_toolTipCache[data->exp] = *data;
|
|
||||||
QToolTip::showText(m_toolTipPos,
|
|
||||||
_c('(') + item->type + _(") ") + item->exp + _(" = ") + item->value);
|
|
||||||
} else {
|
|
||||||
QToolTip::showText(m_toolTipPos,
|
|
||||||
tr("Cannot evaluate expression: %1").arg(m_toolTipExpression));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleQueryDebuggingHelper(const GdbResultRecord &record, const QVariant &)
|
void GdbEngine::handleQueryDebuggingHelper(const GdbResultRecord &record, const QVariant &)
|
||||||
@@ -3465,7 +3460,7 @@ void GdbEngine::updateLocals()
|
|||||||
m_pendingRequests = 0;
|
m_pendingRequests = 0;
|
||||||
|
|
||||||
PENDING_DEBUG("\nRESET PENDING");
|
PENDING_DEBUG("\nRESET PENDING");
|
||||||
m_toolTipCache.clear();
|
//m_toolTipCache.clear();
|
||||||
m_toolTipExpression.clear();
|
m_toolTipExpression.clear();
|
||||||
qq->watchHandler()->beginCycle();
|
qq->watchHandler()->beginCycle();
|
||||||
|
|
||||||
@@ -3596,44 +3591,6 @@ void GdbEngine::insertData(const WatchData &data0)
|
|||||||
qq->watchHandler()->insertData(data);
|
qq->watchHandler()->insertData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleTypeContents(const QString &output)
|
|
||||||
{
|
|
||||||
// output.startsWith("type = ") == true
|
|
||||||
// "type = int"
|
|
||||||
// "type = class QString {"
|
|
||||||
// "type = class QStringList : public QList<QString> {"
|
|
||||||
QString tip;
|
|
||||||
QString className;
|
|
||||||
if (output.startsWith(__("type = class"))) {
|
|
||||||
int posBrace = output.indexOf(_c('{'));
|
|
||||||
QString head = output.mid(13, posBrace - 13 - 1);
|
|
||||||
int posColon = head.indexOf(__(": public"));
|
|
||||||
if (posColon == -1)
|
|
||||||
posColon = head.indexOf(__(": protected"));
|
|
||||||
if (posColon == -1)
|
|
||||||
posColon = head.indexOf(__(": private"));
|
|
||||||
if (posColon == -1) {
|
|
||||||
className = head;
|
|
||||||
tip = _("class ") + className + _(" { ... }");
|
|
||||||
} else {
|
|
||||||
className = head.left(posColon - 1);
|
|
||||||
tip = _("class ") + head + _(" { ... }");
|
|
||||||
}
|
|
||||||
//qDebug() << "posColon:" << posColon;
|
|
||||||
//qDebug() << "posBrace:" << posBrace;
|
|
||||||
//qDebug() << "head:" << head;
|
|
||||||
} else {
|
|
||||||
className = output.mid(7);
|
|
||||||
tip = className;
|
|
||||||
}
|
|
||||||
//qDebug() << "output:" << output.left(100) + "...";
|
|
||||||
//qDebug() << "className:" << className;
|
|
||||||
//qDebug() << "tip:" << tip;
|
|
||||||
//m_toolTip.type = className;
|
|
||||||
m_toolTip.type.clear();
|
|
||||||
m_toolTip.value = tip;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::handleVarListChildrenHelper(const GdbMi &item,
|
void GdbEngine::handleVarListChildrenHelper(const GdbMi &item,
|
||||||
const WatchData &parent)
|
const WatchData &parent)
|
||||||
{
|
{
|
||||||
@@ -3775,6 +3732,7 @@ void GdbEngine::handleVarListChildren(const GdbResultRecord &record,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void GdbEngine::handleToolTip(const GdbResultRecord &record,
|
void GdbEngine::handleToolTip(const GdbResultRecord &record,
|
||||||
const QVariant &cookie)
|
const QVariant &cookie)
|
||||||
{
|
{
|
||||||
@@ -3826,6 +3784,7 @@ void GdbEngine::handleToolTip(const GdbResultRecord &record,
|
|||||||
QTimer::singleShot(0, this, SLOT(updateWatchModel2()));
|
QTimer::singleShot(0, this, SLOT(updateWatchModel2()));
|
||||||
qDebug() << "HANDLE TOOLTIP END";
|
qDebug() << "HANDLE TOOLTIP END";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void GdbEngine::handleChangedItem(QStandardItem *item)
|
void GdbEngine::handleChangedItem(QStandardItem *item)
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ private:
|
|||||||
void handleSetTargetAsync(const GdbResultRecord &, const QVariant &);
|
void handleSetTargetAsync(const GdbResultRecord &, const QVariant &);
|
||||||
void handleTargetRemote(const GdbResultRecord &, const QVariant &);
|
void handleTargetRemote(const GdbResultRecord &, const QVariant &);
|
||||||
void debugMessage(const QString &msg);
|
void debugMessage(const QString &msg);
|
||||||
|
bool showToolTip();
|
||||||
|
|
||||||
const bool m_dumperInjectionLoad;
|
const bool m_dumperInjectionLoad;
|
||||||
|
|
||||||
@@ -327,7 +328,6 @@ private:
|
|||||||
void sendWatchParameters(const QByteArray ¶ms0);
|
void sendWatchParameters(const QByteArray ¶ms0);
|
||||||
void createGdbVariable(const WatchData &data);
|
void createGdbVariable(const WatchData &data);
|
||||||
|
|
||||||
void handleTypeContents(const QString &output);
|
|
||||||
void maybeHandleInferiorPidChanged(const QString &pid);
|
void maybeHandleInferiorPidChanged(const QString &pid);
|
||||||
|
|
||||||
void tryLoadDebuggingHelpers();
|
void tryLoadDebuggingHelpers();
|
||||||
@@ -344,8 +344,8 @@ private:
|
|||||||
void handleVarAssign(const GdbResultRecord &, const QVariant &);
|
void handleVarAssign(const GdbResultRecord &, const QVariant &);
|
||||||
void handleEvaluateExpression(const GdbResultRecord &record,
|
void handleEvaluateExpression(const GdbResultRecord &record,
|
||||||
const QVariant &cookie);
|
const QVariant &cookie);
|
||||||
void handleToolTip(const GdbResultRecord &record,
|
//void handleToolTip(const GdbResultRecord &record,
|
||||||
const QVariant &cookie);
|
// const QVariant &cookie);
|
||||||
void handleQueryDebuggingHelper(const GdbResultRecord &record, const QVariant &);
|
void handleQueryDebuggingHelper(const GdbResultRecord &record, const QVariant &);
|
||||||
void handleDebuggingHelperValue1(const GdbResultRecord &record,
|
void handleDebuggingHelperValue1(const GdbResultRecord &record,
|
||||||
const QVariant &cookie);
|
const QVariant &cookie);
|
||||||
|
|||||||
@@ -54,8 +54,8 @@
|
|||||||
|
|
||||||
// creates debug output regarding pending watch data results
|
// creates debug output regarding pending watch data results
|
||||||
//#define DEBUG_PENDING 1
|
//#define DEBUG_PENDING 1
|
||||||
//// creates debug output for accesses to the itemmodel
|
// creates debug output for accesses to the model
|
||||||
#define DEBUG_MODEL 1
|
//#define DEBUG_MODEL 1
|
||||||
|
|
||||||
#if DEBUG_MODEL
|
#if DEBUG_MODEL
|
||||||
# define MODEL_DEBUG(s) qDebug() << s
|
# define MODEL_DEBUG(s) qDebug() << s
|
||||||
@@ -612,6 +612,10 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
|
|||||||
return m_handler->m_expandedINames.contains(data.iname);
|
return m_handler->m_expandedINames.contains(data.iname);
|
||||||
//FIXME return node < 4 || m_expandedINames.contains(data.iname);
|
//FIXME return node < 4 || m_expandedINames.contains(data.iname);
|
||||||
|
|
||||||
|
case ActiveDataRole:
|
||||||
|
qDebug() << "ASK FOR" << data.iname;
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -848,7 +852,7 @@ void WatchHandler::cleanup()
|
|||||||
|
|
||||||
void WatchHandler::insertData(const WatchData &data)
|
void WatchHandler::insertData(const WatchData &data)
|
||||||
{
|
{
|
||||||
//MODEL_DEBUG("INSERTDATA: " << data.toString());
|
MODEL_DEBUG("INSERTDATA: " << data.toString());
|
||||||
QTC_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
if (data.isSomethingNeeded()) {
|
if (data.isSomethingNeeded()) {
|
||||||
emit watchDataUpdateNeeded(data);
|
emit watchDataUpdateNeeded(data);
|
||||||
@@ -859,6 +863,16 @@ void WatchHandler::insertData(const WatchData &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchHandler::removeData(const QString &iname)
|
||||||
|
{
|
||||||
|
WatchModel *model = modelForIName(iname);
|
||||||
|
if (!model)
|
||||||
|
return;
|
||||||
|
WatchItem *item = model->findItem(iname, model->m_root);
|
||||||
|
if (item)
|
||||||
|
model->removeItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
void WatchHandler::watchExpression()
|
void WatchHandler::watchExpression()
|
||||||
{
|
{
|
||||||
if (QAction *action = qobject_cast<QAction *>(sender()))
|
if (QAction *action = qobject_cast<QAction *>(sender()))
|
||||||
@@ -1058,7 +1072,7 @@ WatchModel *WatchHandler::modelForIName(const QString &iname) const
|
|||||||
return m_locals;
|
return m_locals;
|
||||||
if (iname.startsWith(QLatin1String("watch.")))
|
if (iname.startsWith(QLatin1String("watch.")))
|
||||||
return m_watchers;
|
return m_watchers;
|
||||||
if (iname.startsWith(QLatin1String("tooltip.")))
|
if (iname.startsWith(QLatin1String("tooltip")))
|
||||||
return m_tooltips;
|
return m_tooltips;
|
||||||
QTC_ASSERT(false, /**/);
|
QTC_ASSERT(false, /**/);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1076,5 +1090,6 @@ QString WatchHandler::watcherEditPlaceHolder()
|
|||||||
static const QString rc = tr("<Edit>");
|
static const QString rc = tr("<Edit>");
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -135,7 +135,13 @@ public:
|
|||||||
bool changed;
|
bool changed;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { INameRole = Qt::UserRole, ExpressionRole, ExpandedRole };
|
enum WatchRoles
|
||||||
|
{
|
||||||
|
INameRole = Qt::UserRole,
|
||||||
|
ExpressionRole,
|
||||||
|
ExpandedRole,
|
||||||
|
ActiveDataRole, // used for tooltip
|
||||||
|
};
|
||||||
|
|
||||||
class WatchModel : public QAbstractItemModel
|
class WatchModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
@@ -158,6 +164,8 @@ private:
|
|||||||
void fetchMore(const QModelIndex &parent);
|
void fetchMore(const QModelIndex &parent);
|
||||||
|
|
||||||
friend class WatchHandler;
|
friend class WatchHandler;
|
||||||
|
friend class GdbEngine;
|
||||||
|
|
||||||
WatchItem *watchItem(const QModelIndex &) const;
|
WatchItem *watchItem(const QModelIndex &) const;
|
||||||
QModelIndex watchIndex(const WatchItem *needle) const;
|
QModelIndex watchIndex(const WatchItem *needle) const;
|
||||||
QModelIndex watchIndexHelper(const WatchItem *needle,
|
QModelIndex watchIndexHelper(const WatchItem *needle,
|
||||||
@@ -170,11 +178,13 @@ private:
|
|||||||
void removeOutdatedHelper(WatchItem *item);
|
void removeOutdatedHelper(WatchItem *item);
|
||||||
WatchItem *dummyRoot() const;
|
WatchItem *dummyRoot() const;
|
||||||
void removeItem(WatchItem *item);
|
void removeItem(WatchItem *item);
|
||||||
|
void setActiveData(const QString &data) { m_activeData = data; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WatchHandler *m_handler;
|
WatchHandler *m_handler;
|
||||||
WatchType m_type;
|
WatchType m_type;
|
||||||
WatchItem *m_root;
|
WatchItem *m_root;
|
||||||
|
QString m_activeData;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WatchHandler : public QObject
|
class WatchHandler : public QObject
|
||||||
@@ -198,6 +208,7 @@ public:
|
|||||||
void showEditValue(const WatchData &data);
|
void showEditValue(const WatchData &data);
|
||||||
|
|
||||||
void insertData(const WatchData &data);
|
void insertData(const WatchData &data);
|
||||||
|
void removeData(const QString &iname);
|
||||||
WatchData *findItem(const QString &iname) const;
|
WatchData *findItem(const QString &iname) const;
|
||||||
|
|
||||||
void loadSessionData();
|
void loadSessionData();
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
#include <QtGui/QLineEdit>
|
#include <QtGui/QLineEdit>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QResizeEvent>
|
#include <QtGui/QResizeEvent>
|
||||||
#include <QtGui/QSplitter>
|
|
||||||
|
|
||||||
using namespace Debugger::Internal;
|
using namespace Debugger::Internal;
|
||||||
|
|
||||||
|
|||||||
@@ -335,11 +335,6 @@ void testQList()
|
|||||||
lu.append(102);
|
lu.append(102);
|
||||||
lu.append(102);
|
lu.append(102);
|
||||||
lu.append(102);
|
lu.append(102);
|
||||||
lu.append(102);
|
|
||||||
lu.append(102);
|
|
||||||
lu.append(102);
|
|
||||||
lu.append(102);
|
|
||||||
lu.append(102);
|
|
||||||
|
|
||||||
QList<uint> i;
|
QList<uint> i;
|
||||||
i.append(42);
|
i.append(42);
|
||||||
@@ -347,6 +342,18 @@ void testQList()
|
|||||||
i.append(44);
|
i.append(44);
|
||||||
i.append(45);
|
i.append(45);
|
||||||
|
|
||||||
|
QList<ushort> ls;
|
||||||
|
ls.append(42);
|
||||||
|
ls.append(43);
|
||||||
|
ls.append(44);
|
||||||
|
ls.append(45);
|
||||||
|
|
||||||
|
QList<QChar> lc;
|
||||||
|
lc.append(QChar('a'));
|
||||||
|
lc.append(QChar('b'));
|
||||||
|
lc.append(QChar('c'));
|
||||||
|
lc.append(QChar('d'));
|
||||||
|
|
||||||
QList<qulonglong> l;
|
QList<qulonglong> l;
|
||||||
l.append(42);
|
l.append(42);
|
||||||
l.append(43);
|
l.append(43);
|
||||||
|
|||||||
Reference in New Issue
Block a user