diff options
Diffstat (limited to 'smtreemodel.h')
-rw-r--r-- | smtreemodel.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/smtreemodel.h b/smtreemodel.h index ede4b39..46f852f 100644 --- a/smtreemodel.h +++ b/smtreemodel.h @@ -19,7 +19,29 @@ class SmTreeModel : public QAbstractItemModel { explicit SmTreeModel(const QStringList &headers, QObject *parent = 0); ~SmTreeModel(); + // counts + int rowCount(const QModelIndex &parent) const; + int columnCount(const QModelIndex &parent) const; + + // index and flags + QModelIndex index(int row, int column, const QModelIndex &parent) const; + 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); + bool setRoot(SmTreeItem *rootItem); + + // row manipulation + bool insertRows(int row, int count, const QModelIndex &parent); + bool removeRows(int row, int count, const QModelIndex &parent); + bool addRow(const QList<QVariant> &data, const QModelIndex &parent); + + private: + SmTreeItem *itemAt(const QModelIndex &index) const; QStringList mHeaders; SmTreeItem *mRootItem; }; |