diff options
author | hjk <[email protected]> | 2019-06-24 12:28:07 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2019-06-24 12:54:23 +0000 |
commit | 0d49c2cd2c78ab3eda4722559a8387aebd752537 (patch) | |
tree | 04fd3b0658bf9b00e2f4afc0ce66f0101b98c3a5 /src/plugins/debugger/stackhandler.h | |
parent | 33fde35c1938691e17a5254650e492f1d8b7835c (diff) |
Debugger: Use Utils::TreeModel as base for StackHandler
Change-Id: I3fcc1b3a149f15cf414a1560d91145b623e40c63
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins/debugger/stackhandler.h')
-rw-r--r-- | src/plugins/debugger/stackhandler.h | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h index 02268e400af..5d846235c0b 100644 --- a/src/plugins/debugger/stackhandler.h +++ b/src/plugins/debugger/stackhandler.h @@ -27,9 +27,8 @@ #include "stackframe.h" -#include <QAbstractItemModel> - -namespace Utils { class ItemViewEvent; } +#include <utils/basetreeview.h> +#include <utils/treemodel.h> namespace Debugger { namespace Internal { @@ -46,7 +45,19 @@ enum StackColumns StackColumnCount }; -class StackHandler : public QAbstractTableModel +class StackFrameItem : public Utils::TreeItem +{ +public: + StackFrameItem(); + explicit StackFrameItem(const StackFrame &frame) : frame(frame) {} + +public: + StackFrame frame; +}; + +using StackHandlerModel = Utils::TreeModel<Utils::TypedTreeItem<StackFrameItem>, StackFrameItem>; + +class StackHandler : public StackHandlerModel { Q_OBJECT @@ -58,14 +69,14 @@ public: void setFramesAndCurrentIndex(const GdbMi &frames, bool isFull); int updateTargetFrame(bool isFull); void prependFrames(const StackFrames &frames); - const StackFrames &frames() const; + bool isSpecialFrame(int index) const; void setCurrentIndex(int index); int currentIndex() const { return m_currentIndex; } int firstUsableIndex() const; StackFrame currentFrame() const; - const StackFrame &frameAt(int index) const { return m_stackFrames.at(index); } - int stackSize() const { return m_stackFrames.size(); } - quint64 topAddress() const { return m_stackFrames.at(0).address; } + StackFrame frameAt(int index) const; + int stackSize() const; + quint64 topAddress() const; // Called from StackHandler after a new stack list has been received void removeAll(); @@ -80,10 +91,7 @@ signals: void currentIndexChanged(); private: - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - int columnCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; Qt::ItemFlags flags(const QModelIndex &index) const override; bool setData(const QModelIndex &idx, const QVariant &data, int role) override; @@ -93,7 +101,6 @@ private: void saveTaskFile(); DebuggerEngine *m_engine; - StackFrames m_stackFrames; int m_currentIndex = -1; bool m_canExpand = false; bool m_resetLocationScheduled = false; |