From e710b1ff68c29f5a2331cc36b5fdf6d67f4b1c63 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 6 Jun 2010 16:26:58 +0200 Subject: Finished SmTreeModel, started SmUberModel kinda finished the treemodel. Don't really know if it's complete yet. More programming will show :) --- smtreemodel.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'smtreemodel.h') 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 &data, const QModelIndex &parent); + + private: + SmTreeItem *itemAt(const QModelIndex &index) const; QStringList mHeaders; SmTreeItem *mRootItem; }; -- cgit v1.2.3-70-g09d2