diff options
author | hjk <hjk@theqtcompany.com> | 2015-01-09 10:49:18 +0100 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-01-12 14:35:04 +0100 |
commit | ac77a8d10e351050e66a838040a144717b22a377 (patch) | |
tree | 383758fee82c585ec349704600fb188f7d76718f /src/plugins/debugger/breakhandler.h | |
parent | 2f17b74753a18f7c4dd277d0d9c870e7fbbbb658 (diff) | |
download | qt-creator-ac77a8d10e351050e66a838040a144717b22a377.tar.gz |
Debugger: Use Utils::TreeModel for breakpoints
Change-Id: I7f62f9d64daf7624794aa82495d4b2c8d97b33df
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger/breakhandler.h')
-rw-r--r-- | src/plugins/debugger/breakhandler.h | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 2ac1ff93c5..6b3e08fc63 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -33,7 +33,7 @@ #include "breakpoint.h" -#include <QAbstractTableModel> +#include <utils/treemodel.h> ////////////////////////////////////////////////////////////////// // @@ -47,13 +47,12 @@ namespace Internal { class BreakpointMarker; class DebuggerEngine; -class BreakHandler : public QAbstractItemModel +class BreakHandler : public Utils::TreeModel { Q_OBJECT public: BreakHandler(); - ~BreakHandler(); void loadSessionData(); void saveSessionData(); @@ -69,7 +68,6 @@ public: BreakpointModelIds allBreakpointIds() const; BreakpointModelIds engineBreakpointIds(DebuggerEngine *engine) const; BreakpointModelIds unclaimedBreakpointIds() const; - int size() const { return m_storage.size(); } QStringList engineBreakpointPaths(DebuggerEngine *engine) const; // Find a breakpoint matching approximately the data in needle. @@ -166,20 +164,10 @@ public: void setWatchpointAtAddress(quint64 address, unsigned size); void setWatchpointAtExpression(const QString &exp); +signals: + void requestExpansion(QModelIndex); + private: - // QAbstractItemModel implementation. - int columnCount(const QModelIndex &parent) const; - int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - QModelIndex index(int row, int col, const QModelIndex &parent) const; - QModelIndex parent(const QModelIndex &parent) const; - QModelIndex createIndex(int row, int column, quint32 id) const; - QModelIndex createIndex(int row, int column, void *ptr) const; - - int indexOf(BreakpointModelId id) const; - BreakpointModelId at(int index) const; bool isEngineRunning(BreakpointModelId id) const; void setState(BreakpointModelId id, BreakpointState state); void loadBreakpoints(); @@ -188,32 +176,42 @@ private: void appendBreakpointInternal(const BreakpointParameters &data); Q_SLOT void changeLineNumberFromMarkerHelper(Debugger::Internal::BreakpointModelId id, int lineNumber); - struct BreakpointItem + struct BreakpointItem : public Utils::TreeItem { BreakpointItem(); + ~BreakpointItem(); + + int columnCount() const { return 8; } + QVariant data(int column, int role) const; void destroyMarker(); bool needsChange() const; bool isLocatedAt(const QString &fileName, int lineNumber, bool useMarkerPosition) const; - void updateMarker(BreakpointModelId id); + void updateMarker(); void updateMarkerIcon(); QString toToolTip() const; QString markerFileName() const; int markerLineNumber() const; QIcon icon() const; - BreakpointParameters data; + BreakpointModelId id; + BreakpointParameters params; BreakpointState state; // Current state of breakpoint. DebuggerEngine *engine; // Engine currently handling the breakpoint. BreakpointResponse response; BreakpointMarker *marker; - QList<BreakpointResponse> subItems; }; - typedef QHash<BreakpointModelId, BreakpointItem> BreakpointStorage; - typedef BreakpointStorage::ConstIterator ConstIterator; - typedef BreakpointStorage::Iterator Iterator; - BreakpointStorage m_storage; + + struct LocationItem : public Utils::TreeItem + { + int columnCount() const { return 8; } + QVariant data(int column, int role) const; + + BreakpointResponse params; + }; + + BreakpointItem *breakpointById(BreakpointModelId id) const; void scheduleSynchronization(); void timerEvent(QTimerEvent *event); |