diff options
Diffstat (limited to 'smtreemodel.h')
-rw-r--r-- | smtreemodel.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/smtreemodel.h b/smtreemodel.h index 698a2ce..ae3b5ce 100644 --- a/smtreemodel.h +++ b/smtreemodel.h @@ -17,7 +17,7 @@ class SmTreeModel : public QAbstractItemModel { Q_OBJECT public: explicit SmTreeModel(const QStringList &headers, QObject *parent = 0); - ~SmTreeModel(); + virtual ~SmTreeModel(); // counts int rowCount(const QModelIndex &parent) const; @@ -26,14 +26,18 @@ class SmTreeModel : public QAbstractItemModel { // index, parent and flags QModelIndex index(int row, int column, const QModelIndex &parent) const; QModelIndex parent(const QModelIndex &child) const; - Qt::ItemFlags flags(const QModelIndex &index) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; // headers + data QVariant headerData(int section, Qt::Orientation orientation, int role) const; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role); - QVariant data(const QModelIndex &index, int role) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); + virtual QVariant data(const QModelIndex &index, int role) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role); + + // root + parent item bool setRoot(SmTreeItem *rootItem); + SmTreeItem *root() const { return mRootItem; } + SmTreeItem *parentItem(const QModelIndex &child) const; // row manipulation bool insertRows(int row, int count, const QModelIndex &parent); |