forked from qt-creator/qt-creator
Debugger: Expose WatchModel signals
This opens it up to be used with Qt5 connects in the TooltipManager and simpler user code. Change-Id: Ifc6fcc3a04d325437f5a2bdf1da463d28d650ee3 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1140,14 +1140,13 @@ public:
|
|||||||
DebuggerEngine *m_currentEngine;
|
DebuggerEngine *m_currentEngine;
|
||||||
DebuggerSettings *m_debuggerSettings;
|
DebuggerSettings *m_debuggerSettings;
|
||||||
QStringList m_arguments;
|
QStringList m_arguments;
|
||||||
DebuggerToolTipManager *m_toolTipManager;
|
DebuggerToolTipManager m_toolTipManager;
|
||||||
CommonOptionsPage *m_commonOptionsPage;
|
CommonOptionsPage *m_commonOptionsPage;
|
||||||
DummyEngine *m_dummyEngine;
|
DummyEngine *m_dummyEngine;
|
||||||
const QSharedPointer<GlobalDebuggerOptions> m_globalDebuggerOptions;
|
const QSharedPointer<GlobalDebuggerOptions> m_globalDebuggerOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
|
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
|
||||||
m_toolTipManager(new DebuggerToolTipManager(this)),
|
|
||||||
m_dummyEngine(0),
|
m_dummyEngine(0),
|
||||||
m_globalDebuggerOptions(new GlobalDebuggerOptions)
|
m_globalDebuggerOptions(new GlobalDebuggerOptions)
|
||||||
{
|
{
|
||||||
@@ -2036,7 +2035,7 @@ void DebuggerPluginPrivate::setInitialState()
|
|||||||
setBusyCursor(false);
|
setBusyCursor(false);
|
||||||
m_reverseDirectionAction->setChecked(false);
|
m_reverseDirectionAction->setChecked(false);
|
||||||
m_reverseDirectionAction->setEnabled(false);
|
m_reverseDirectionAction->setEnabled(false);
|
||||||
m_toolTipManager->closeAllToolTips();
|
m_toolTipManager.closeAllToolTips();
|
||||||
|
|
||||||
m_startAndDebugApplicationAction->setEnabled(true);
|
m_startAndDebugApplicationAction->setEnabled(true);
|
||||||
m_attachToQmlPortAction->setEnabled(true);
|
m_attachToQmlPortAction->setEnabled(true);
|
||||||
@@ -2269,14 +2268,14 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode)
|
|||||||
m_mainWindow->onModeChanged(mode);
|
m_mainWindow->onModeChanged(mode);
|
||||||
|
|
||||||
if (mode->id() != Constants::MODE_DEBUG) {
|
if (mode->id() != Constants::MODE_DEBUG) {
|
||||||
m_toolTipManager->leavingDebugMode();
|
m_toolTipManager.leavingDebugMode();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IEditor *editor = EditorManager::currentEditor())
|
if (IEditor *editor = EditorManager::currentEditor())
|
||||||
editor->widget()->setFocus();
|
editor->widget()->setFocus();
|
||||||
|
|
||||||
m_toolTipManager->debugModeEntered();
|
m_toolTipManager.debugModeEntered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::showSettingsDialog()
|
void DebuggerPluginPrivate::showSettingsDialog()
|
||||||
@@ -2334,7 +2333,7 @@ void DebuggerPluginPrivate::sessionLoaded()
|
|||||||
|
|
||||||
void DebuggerPluginPrivate::aboutToUnloadSession()
|
void DebuggerPluginPrivate::aboutToUnloadSession()
|
||||||
{
|
{
|
||||||
m_toolTipManager->sessionAboutToChange();
|
m_toolTipManager.sessionAboutToChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::aboutToSaveSession()
|
void DebuggerPluginPrivate::aboutToSaveSession()
|
||||||
|
|||||||
@@ -65,31 +65,34 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
// Expire tooltips after n days on (no longer load them) in order
|
// Expire tooltips after n days on (no longer load them) in order
|
||||||
// to avoid them piling up.
|
// to avoid them piling up.
|
||||||
enum { toolTipsExpiryDays = 6 };
|
enum { toolTipsExpiryDays = 6 };
|
||||||
|
|
||||||
static const char sessionSettingsKeyC[] = "DebuggerToolTips";
|
const char sessionSettingsKeyC[] = "DebuggerToolTips";
|
||||||
static const char sessionDocumentC[] = "DebuggerToolTips";
|
const char sessionDocumentC[] = "DebuggerToolTips";
|
||||||
static const char sessionVersionAttributeC[] = "version";
|
const char sessionVersionAttributeC[] = "version";
|
||||||
static const char toolTipElementC[] = "DebuggerToolTip";
|
const char toolTipElementC[] = "DebuggerToolTip";
|
||||||
static const char toolTipClassAttributeC[] = "class";
|
const char toolTipClassAttributeC[] = "class";
|
||||||
static const char fileNameAttributeC[] = "name";
|
const char fileNameAttributeC[] = "name";
|
||||||
static const char functionAttributeC[] = "function";
|
const char functionAttributeC[] = "function";
|
||||||
static const char textPositionAttributeC[] = "position";
|
const char textPositionAttributeC[] = "position";
|
||||||
static const char textLineAttributeC[] = "line";
|
const char textLineAttributeC[] = "line";
|
||||||
static const char textColumnAttributeC[] = "column";
|
const char textColumnAttributeC[] = "column";
|
||||||
static const char offsetXAttributeC[] = "offset_x";
|
const char offsetXAttributeC[] = "offset_x";
|
||||||
static const char offsetYAttributeC[] = "offset_y";
|
const char offsetYAttributeC[] = "offset_y";
|
||||||
static const char engineTypeAttributeC[] = "engine";
|
const char engineTypeAttributeC[] = "engine";
|
||||||
static const char dateAttributeC[] = "date";
|
const char dateAttributeC[] = "date";
|
||||||
static const char treeElementC[] = "tree";
|
const char treeElementC[] = "tree";
|
||||||
static const char treeExpressionAttributeC[] = "expression";
|
const char treeExpressionAttributeC[] = "expression";
|
||||||
static const char treeInameAttributeC[] = "iname";
|
const char treeInameAttributeC[] = "iname";
|
||||||
static const char modelElementC[] = "model";
|
const char modelElementC[] = "model";
|
||||||
static const char modelColumnCountAttributeC[] = "columncount";
|
const char modelColumnCountAttributeC[] = "columncount";
|
||||||
static const char modelRowElementC[] = "row";
|
const char modelRowElementC[] = "row";
|
||||||
static const char modelItemElementC[] = "item";
|
const char modelItemElementC[] = "item";
|
||||||
|
|
||||||
// Forward a stream reader across end elements looking for the
|
// Forward a stream reader across end elements looking for the
|
||||||
// next start element of a desired type.
|
// next start element of a desired type.
|
||||||
@@ -112,19 +115,6 @@ static bool readStartElement(QXmlStreamReader &r, const char *name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void debugMode(const QAbstractItemModel *model)
|
|
||||||
{
|
|
||||||
QDebug nospace = qDebug().nospace();
|
|
||||||
nospace << model << '\n';
|
|
||||||
for (int r = 0; r < model->rowCount(); r++)
|
|
||||||
nospace << '#' << r << ' ' << model->data(model->index(r, 0)).toString() << '\n';
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Debugger {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
// A label that can be dragged to drag something else.
|
// A label that can be dragged to drag something else.
|
||||||
|
|
||||||
class DraggableLabel : public QLabel
|
class DraggableLabel : public QLabel
|
||||||
@@ -503,8 +493,6 @@ static DebuggerToolTipManagerData *d = 0;
|
|||||||
|
|
||||||
class DebuggerToolTipWidget : public QWidget
|
class DebuggerToolTipWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerToolTipWidget(const DebuggerToolTipContext &context);
|
DebuggerToolTipWidget(const DebuggerToolTipContext &context);
|
||||||
|
|
||||||
@@ -519,10 +507,13 @@ public:
|
|||||||
void releaseEngine();
|
void releaseEngine();
|
||||||
|
|
||||||
void saveSessionData(QXmlStreamWriter &w) const;
|
void saveSessionData(QXmlStreamWriter &w) const;
|
||||||
void setWatchModel(QAbstractItemModel *watchModel);
|
void setWatchModel(WatchModelBase *watchModel);
|
||||||
void handleStackFrameCompleted(const QString &frameFile, const QString &frameFunction);
|
void handleStackFrameCompleted(const QString &frameFile, const QString &frameFunction);
|
||||||
|
|
||||||
public slots:
|
void copy();
|
||||||
|
void positionShow(const TextEditorWidget *editorWidget);
|
||||||
|
void pin();
|
||||||
|
|
||||||
void handleItemIsExpanded(const QModelIndex &sourceIdx)
|
void handleItemIsExpanded(const QModelIndex &sourceIdx)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_filterModel.sourceModel() == sourceIdx.model(), return);
|
QTC_ASSERT(m_filterModel.sourceModel() == sourceIdx.model(), return);
|
||||||
@@ -531,10 +522,6 @@ public slots:
|
|||||||
m_treeView->expand(mappedIdx);
|
m_treeView->expand(mappedIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy();
|
|
||||||
void positionShow(const TextEditorWidget *editorWidget);
|
|
||||||
void pin();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool m_isPinned;
|
bool m_isPinned;
|
||||||
QToolButton *m_toolButton;
|
QToolButton *m_toolButton;
|
||||||
@@ -691,14 +678,14 @@ DebuggerToolTipWidget::DebuggerToolTipWidget(const DebuggerToolTipContext &conte
|
|||||||
connect(copyButton, &QAbstractButton::clicked, this, &DebuggerToolTipWidget::copy);
|
connect(copyButton, &QAbstractButton::clicked, this, &DebuggerToolTipWidget::copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerToolTipWidget::setWatchModel(QAbstractItemModel *watchModel)
|
void DebuggerToolTipWidget::setWatchModel(WatchModelBase *watchModel)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(watchModel, return);
|
QTC_ASSERT(watchModel, return);
|
||||||
m_filterModel.setSourceModel(watchModel);
|
m_filterModel.setSourceModel(watchModel);
|
||||||
connect(watchModel, SIGNAL(itemIsExpanded(QModelIndex)),
|
connect(watchModel, &WatchModelBase::itemIsExpanded,
|
||||||
this, SLOT(handleItemIsExpanded(QModelIndex)), Qt::UniqueConnection);
|
this, &DebuggerToolTipWidget::handleItemIsExpanded, Qt::UniqueConnection);
|
||||||
connect(watchModel, SIGNAL(columnAdjustmentRequested()),
|
connect(watchModel, &WatchModelBase::columnAdjustmentRequested,
|
||||||
m_treeView, SLOT(computeSize()), Qt::UniqueConnection);
|
m_treeView, &DebuggerToolTipTreeView::computeSize, Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerToolTipWidget::handleStackFrameCompleted(const QString &frameFile, const QString &frameFunction)
|
void DebuggerToolTipWidget::handleStackFrameCompleted(const QString &frameFile, const QString &frameFunction)
|
||||||
@@ -938,15 +925,15 @@ DebuggerToolTipTreeView::DebuggerToolTipTreeView(QWidget *parent) :
|
|||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(computeSize()),
|
connect(this, &QTreeView::collapsed, this, &DebuggerToolTipTreeView::computeSize,
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(computeSize()),
|
connect(this, &QTreeView::expanded, this, &DebuggerToolTipTreeView::computeSize,
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(this, SIGNAL(expanded(QModelIndex)),
|
connect(this, &QTreeView::expanded,
|
||||||
SLOT(expandNode(QModelIndex)));
|
this, &DebuggerToolTipTreeView::expandNode);
|
||||||
connect(this, SIGNAL(collapsed(QModelIndex)),
|
connect(this, &QTreeView::collapsed,
|
||||||
SLOT(collapseNode(QModelIndex)));
|
this, &DebuggerToolTipTreeView::collapseNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerToolTipTreeView::expandNode(const QModelIndex &idx)
|
void DebuggerToolTipTreeView::expandNode(const QModelIndex &idx)
|
||||||
@@ -1046,19 +1033,14 @@ QString DebuggerToolTipManager::treeModelClipboardContents(const QAbstractItemMo
|
|||||||
(by file name and function) acquire the engine, others release.
|
(by file name and function) acquire the engine, others release.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static DebuggerToolTipManager *m_instance = 0;
|
DebuggerToolTipManager::DebuggerToolTipManager()
|
||||||
|
|
||||||
DebuggerToolTipManager::DebuggerToolTipManager(QObject *parent) :
|
|
||||||
QObject(parent)
|
|
||||||
{
|
{
|
||||||
d = new DebuggerToolTipManagerData;
|
d = new DebuggerToolTipManagerData;
|
||||||
m_instance = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerToolTipManager::~DebuggerToolTipManager()
|
DebuggerToolTipManager::~DebuggerToolTipManager()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
m_instance = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerToolTipManager::registerEngine(DebuggerEngine *)
|
void DebuggerToolTipManager::registerEngine(DebuggerEngine *)
|
||||||
@@ -1227,33 +1209,15 @@ void DebuggerToolTipManager::slotUpdateVisibleToolTips()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerToolTipManager::slotDebuggerStateChanged(DebuggerState state)
|
|
||||||
{
|
|
||||||
const QObject *engine = sender();
|
|
||||||
QTC_ASSERT(engine, return);
|
|
||||||
|
|
||||||
// Release at earliest possible convenience.
|
|
||||||
switch (state) {
|
|
||||||
case InferiorShutdownRequested:
|
|
||||||
case EngineShutdownRequested:
|
|
||||||
case DebuggerFinished:
|
|
||||||
case EngineShutdownOk: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerToolTipManager::slotEditorOpened(IEditor *e)
|
void DebuggerToolTipManager::slotEditorOpened(IEditor *e)
|
||||||
{
|
{
|
||||||
// Move tooltip along when scrolled.
|
// Move tooltip along when scrolled.
|
||||||
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(e)) {
|
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(e)) {
|
||||||
TextEditorWidget *widget = textEditor->editorWidget();
|
TextEditorWidget *widget = textEditor->editorWidget();
|
||||||
connect(widget->verticalScrollBar(), &QScrollBar::valueChanged,
|
QObject::connect(widget->verticalScrollBar(), &QScrollBar::valueChanged,
|
||||||
this, &DebuggerToolTipManager::slotUpdateVisibleToolTips);
|
this, &DebuggerToolTipManager::slotUpdateVisibleToolTips);
|
||||||
connect(widget, &TextEditorWidget::tooltipOverrideRequested,
|
QObject::connect(widget, &TextEditorWidget::tooltipOverrideRequested,
|
||||||
this, &DebuggerToolTipManager::slotTooltipOverrideRequested);
|
this, &DebuggerToolTipManager::slotTooltipOverrideRequested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1273,7 +1237,7 @@ void DebuggerToolTipManager::debugModeEntered()
|
|||||||
slotEditorOpened(e);
|
slotEditorOpened(e);
|
||||||
// Position tooltips delayed once all the editor placeholder layouting is done.
|
// Position tooltips delayed once all the editor placeholder layouting is done.
|
||||||
if (!d->m_tooltips.isEmpty())
|
if (!d->m_tooltips.isEmpty())
|
||||||
QTimer::singleShot(0, this, SLOT(slotUpdateVisibleToolTips()));
|
QTimer::singleShot(0, this, &DebuggerToolTipManager::slotUpdateVisibleToolTips);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,5 +1322,3 @@ DebuggerToolTipContexts DebuggerToolTipManager::treeWidgetExpressions
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#include "debuggertooltipmanager.moc"
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QPointer>
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -77,20 +77,17 @@ QDebug operator<<(QDebug, const DebuggerToolTipContext &);
|
|||||||
|
|
||||||
class DebuggerToolTipTreeView : public QTreeView
|
class DebuggerToolTipTreeView : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DebuggerToolTipTreeView(QWidget *parent = 0);
|
explicit DebuggerToolTipTreeView(QWidget *parent = 0);
|
||||||
|
|
||||||
QAbstractItemModel *swapModel(QAbstractItemModel *model);
|
QAbstractItemModel *swapModel(QAbstractItemModel *model);
|
||||||
QSize sizeHint() const { return m_size; }
|
QSize sizeHint() const { return m_size; }
|
||||||
|
|
||||||
private slots:
|
|
||||||
void computeSize();
|
void computeSize();
|
||||||
void expandNode(const QModelIndex &idx);
|
|
||||||
void collapseNode(const QModelIndex &idx);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void expandNode(const QModelIndex &idx);
|
||||||
|
void collapseNode(const QModelIndex &idx);
|
||||||
int computeHeight(const QModelIndex &index) const;
|
int computeHeight(const QModelIndex &index) const;
|
||||||
|
|
||||||
QSize m_size;
|
QSize m_size;
|
||||||
@@ -98,10 +95,10 @@ private:
|
|||||||
|
|
||||||
class DebuggerToolTipManager : public QObject
|
class DebuggerToolTipManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerToolTipManager)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DebuggerToolTipManager(QObject *parent = 0);
|
DebuggerToolTipManager();
|
||||||
~DebuggerToolTipManager();
|
~DebuggerToolTipManager();
|
||||||
|
|
||||||
static void registerEngine(DebuggerEngine *engine);
|
static void registerEngine(DebuggerEngine *engine);
|
||||||
@@ -120,7 +117,6 @@ public:
|
|||||||
|
|
||||||
static QString treeModelClipboardContents(const QAbstractItemModel *model);
|
static QString treeModelClipboardContents(const QAbstractItemModel *model);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void debugModeEntered();
|
void debugModeEntered();
|
||||||
void leavingDebugMode();
|
void leavingDebugMode();
|
||||||
void sessionAboutToChange();
|
void sessionAboutToChange();
|
||||||
@@ -129,9 +125,8 @@ public slots:
|
|||||||
static void closeAllToolTips();
|
static void closeAllToolTips();
|
||||||
static void hide();
|
static void hide();
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
static void slotUpdateVisibleToolTips();
|
static void slotUpdateVisibleToolTips();
|
||||||
void slotDebuggerStateChanged(Debugger::DebuggerState);
|
|
||||||
void slotEditorOpened(Core::IEditor *);
|
void slotEditorOpened(Core::IEditor *);
|
||||||
void slotTooltipOverrideRequested(TextEditor::TextEditorWidget *editorWidget,
|
void slotTooltipOverrideRequested(TextEditor::TextEditorWidget *editorWidget,
|
||||||
const QPoint &point, int pos, bool *handled);
|
const QPoint &point, int pos, bool *handled);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ private:
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// WatchModel
|
// SeparatedView
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
SeparatedView() : QTabWidget(Internal::mainWindow())
|
SeparatedView() : QTabWidget(Internal::mainWindow())
|
||||||
{
|
{
|
||||||
setTabsClosable(true);
|
setTabsClosable(true);
|
||||||
connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)));
|
connect(this, &QTabWidget::tabCloseRequested, this, &SeparatedView::closeTab);
|
||||||
setWindowFlags(windowFlags() | Qt::Window);
|
setWindowFlags(windowFlags() | Qt::Window);
|
||||||
setWindowTitle(WatchHandler::tr("Debugger - Qt Creator"));
|
setWindowTitle(WatchHandler::tr("Debugger - Qt Creator"));
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_SLOT void closeTab(int index)
|
void closeTab(int index)
|
||||||
{
|
{
|
||||||
if (QObject *o = widget(index)) {
|
if (QObject *o = widget(index)) {
|
||||||
QByteArray iname = o->property(INameProperty).toByteArray();
|
QByteArray iname = o->property(INameProperty).toByteArray();
|
||||||
@@ -224,10 +224,14 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WatchModel : public QAbstractItemModel
|
///////////////////////////////////////////////////////////////////////
|
||||||
{
|
//
|
||||||
Q_OBJECT
|
// WatchModel
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class WatchModel : public WatchModelBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
explicit WatchModel(WatchHandler *handler);
|
explicit WatchModel(WatchHandler *handler);
|
||||||
~WatchModel();
|
~WatchModel();
|
||||||
@@ -242,11 +246,6 @@ public:
|
|||||||
static QString nameForFormat(int format);
|
static QString nameForFormat(int format);
|
||||||
TypeFormatList typeFormatList(const WatchData &value) const;
|
TypeFormatList typeFormatList(const WatchData &value) const;
|
||||||
|
|
||||||
signals:
|
|
||||||
void currentIndexRequested(const QModelIndex &idx);
|
|
||||||
void itemIsExpanded(const QModelIndex &idx);
|
|
||||||
void columnAdjustmentRequested();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariant data(const QModelIndex &idx, int role) const;
|
QVariant data(const QModelIndex &idx, int role) const;
|
||||||
bool setData(const QModelIndex &idx, const QVariant &value, int role);
|
bool setData(const QModelIndex &idx, const QVariant &value, int role);
|
||||||
@@ -272,7 +271,7 @@ private:
|
|||||||
const WatchItem *parentItem, const QModelIndex &parentIndex) const;
|
const WatchItem *parentItem, const QModelIndex &parentIndex) const;
|
||||||
|
|
||||||
void insertDataItem(const WatchData &data, bool destructive);
|
void insertDataItem(const WatchData &data, bool destructive);
|
||||||
Q_SLOT void reinsertAllData();
|
void reinsertAllData();
|
||||||
void reinsertAllDataHelper(WatchItem *item, QList<WatchData> *data);
|
void reinsertAllDataHelper(WatchItem *item, QList<WatchData> *data);
|
||||||
bool ancestorChanged(const QSet<QByteArray> &parentINames, WatchItem *item) const;
|
bool ancestorChanged(const QSet<QByteArray> &parentINames, WatchItem *item) const;
|
||||||
void insertBulkData(const QList<WatchData> &data);
|
void insertBulkData(const QList<WatchData> &data);
|
||||||
@@ -288,7 +287,7 @@ private:
|
|||||||
|
|
||||||
void dump();
|
void dump();
|
||||||
void dumpHelper(WatchItem *item);
|
void dumpHelper(WatchItem *item);
|
||||||
Q_SLOT void emitAllChanged();
|
void emitAllChanged();
|
||||||
|
|
||||||
void showInEditorHelper(QString *contents, WatchItem *item, int level);
|
void showInEditorHelper(QString *contents, WatchItem *item, int level);
|
||||||
void setCurrentItem(const QByteArray &iname);
|
void setCurrentItem(const QByteArray &iname);
|
||||||
@@ -350,12 +349,12 @@ WatchModel::WatchModel(WatchHandler *handler)
|
|||||||
m_returnRoot = createItem("return", tr("Return Value"), m_root);
|
m_returnRoot = createItem("return", tr("Return Value"), m_root);
|
||||||
m_tooltipRoot = createItem("tooltip", tr("Tooltip"), m_root);
|
m_tooltipRoot = createItem("tooltip", tr("Tooltip"), m_root);
|
||||||
|
|
||||||
connect(action(SortStructMembers), SIGNAL(valueChanged(QVariant)),
|
connect(action(SortStructMembers), &Utils::SavedAction::valueChanged,
|
||||||
SLOT(reinsertAllData()));
|
this, &WatchModel::reinsertAllData);
|
||||||
connect(action(ShowStdNamespace), SIGNAL(valueChanged(QVariant)),
|
connect(action(ShowStdNamespace), &Utils::SavedAction::valueChanged,
|
||||||
SLOT(reinsertAllData()));
|
this, &WatchModel::reinsertAllData);
|
||||||
connect(action(ShowQtNamespace), SIGNAL(valueChanged(QVariant)),
|
connect(action(ShowQtNamespace), &Utils::SavedAction::valueChanged,
|
||||||
SLOT(reinsertAllData()));
|
this, &WatchModel::reinsertAllData);
|
||||||
}
|
}
|
||||||
|
|
||||||
WatchModel::~WatchModel()
|
WatchModel::~WatchModel()
|
||||||
@@ -1987,7 +1986,7 @@ void WatchHandler::loadSessionData()
|
|||||||
watchExpression(exp);
|
watchExpression(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractItemModel *WatchHandler::model() const
|
WatchModelBase *WatchHandler::model() const
|
||||||
{
|
{
|
||||||
return m_model;
|
return m_model;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace Debugger {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class SeparatedView;
|
class SeparatedView;
|
||||||
|
class WatchModel;
|
||||||
|
|
||||||
// Special formats. Keep in sync with dumper.py.
|
// Special formats. Keep in sync with dumper.py.
|
||||||
enum DisplayFormat
|
enum DisplayFormat
|
||||||
@@ -112,8 +113,6 @@ class DebuggerEngine;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class WatchModel;
|
|
||||||
|
|
||||||
class UpdateParameters
|
class UpdateParameters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -126,6 +125,19 @@ public:
|
|||||||
|
|
||||||
typedef QHash<QString, QStringList> DumperTypeFormats; // Type name -> Dumper Formats
|
typedef QHash<QString, QStringList> DumperTypeFormats; // Type name -> Dumper Formats
|
||||||
|
|
||||||
|
class WatchModelBase : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
WatchModelBase() {}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void currentIndexRequested(const QModelIndex &idx);
|
||||||
|
void itemIsExpanded(const QModelIndex &idx);
|
||||||
|
void columnAdjustmentRequested();
|
||||||
|
};
|
||||||
|
|
||||||
class WatchHandler : public QObject
|
class WatchHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -134,7 +146,7 @@ public:
|
|||||||
explicit WatchHandler(DebuggerEngine *engine);
|
explicit WatchHandler(DebuggerEngine *engine);
|
||||||
~WatchHandler();
|
~WatchHandler();
|
||||||
|
|
||||||
QAbstractItemModel *model() const;
|
WatchModelBase *model() const;
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void watchExpression(const QString &exp, const QString &name = QString());
|
void watchExpression(const QString &exp, const QString &name = QString());
|
||||||
|
|||||||
Reference in New Issue
Block a user