author | insilmaril |
Tue May 26 11:24:51 2009 +0000 (2009-05-26) | |
changeset 774 | 2f002657dada |
parent 772 | e3f722759c7e |
child 788 | 78ba80b54bc4 |
permissions | -rw-r--r-- |
insilmaril@725 | 1 |
#ifndef TREEMODEL_H |
insilmaril@725 | 2 |
#define TREEMODEL_H |
insilmaril@725 | 3 |
|
insilmaril@725 | 4 |
#include <QAbstractItemModel> |
insilmaril@725 | 5 |
#include <QModelIndex> |
insilmaril@725 | 6 |
#include <QVariant> |
insilmaril@725 | 7 |
|
insilmaril@726 | 8 |
|
insilmaril@750 | 9 |
class BranchItem; |
insilmaril@725 | 10 |
class TreeItem; |
insilmaril@726 | 11 |
class LinkableMapObj; |
insilmaril@725 | 12 |
|
insilmaril@725 | 13 |
class TreeModel : public QAbstractItemModel |
insilmaril@725 | 14 |
{ |
insilmaril@725 | 15 |
Q_OBJECT |
insilmaril@725 | 16 |
|
insilmaril@725 | 17 |
public: |
insilmaril@725 | 18 |
TreeModel(QObject *parent = 0); |
insilmaril@725 | 19 |
~TreeModel(); |
insilmaril@725 | 20 |
|
insilmaril@725 | 21 |
QVariant data(const QModelIndex &index, int role) const; |
insilmaril@725 | 22 |
Qt::ItemFlags flags(const QModelIndex &index) const; |
insilmaril@725 | 23 |
QVariant headerData(int section, Qt::Orientation orientation, |
insilmaril@725 | 24 |
int role = Qt::DisplayRole) const; |
insilmaril@725 | 25 |
QModelIndex index(int row, int column, |
insilmaril@725 | 26 |
const QModelIndex &parent = QModelIndex()) const; |
insilmaril@725 | 27 |
QModelIndex parent(const QModelIndex &index) const; |
insilmaril@725 | 28 |
int rowCount(const QModelIndex &parent = QModelIndex()) const; |
insilmaril@725 | 29 |
int columnCount(const QModelIndex &parent = QModelIndex()) const; |
insilmaril@725 | 30 |
|
insilmaril@773 | 31 |
BranchItem* next(BranchItem* ¤t, BranchItem* &previous, BranchItem* start=NULL); |
insilmaril@726 | 32 |
|
insilmaril@727 | 33 |
bool removeRows ( int row, int count, |
insilmaril@727 | 34 |
const QModelIndex & parent = QModelIndex() ); |
insilmaril@727 | 35 |
|
insilmaril@745 | 36 |
TreeItem* getItem (const QModelIndex &index) const; |
insilmaril@754 | 37 |
TreeItem* getRootItem(); |
insilmaril@726 | 38 |
QModelIndex index (TreeItem* ti); |
insilmaril@725 | 39 |
|
insilmaril@754 | 40 |
|
insilmaril@729 | 41 |
protected: |
insilmaril@725 | 42 |
TreeItem *rootItem; |
insilmaril@725 | 43 |
}; |
insilmaril@725 | 44 |
|
insilmaril@725 | 45 |
#endif |