]> git.sven.stormbind.net Git - sven/vym.git/blob - treemodel.h
Import Upstream version 2.6.11
[sven/vym.git] / treemodel.h
1 #ifndef TREEMODEL_H
2 #define TREEMODEL_H
3
4 #include <QAbstractItemModel>
5 #include <QModelIndex>
6 #include <QVariant>
7
8
9 class BranchItem;
10 class TreeItem;
11 class Link;
12 class LinkableMapObj;
13
14 class TreeModel : public QAbstractItemModel
15 {
16     Q_OBJECT
17
18 public:
19     TreeModel(QObject *parent = 0);
20     ~TreeModel();
21
22     QVariant data(const QModelIndex &index, int role) const;
23     Qt::ItemFlags flags(const QModelIndex &index) const;
24     QVariant headerData(int section, Qt::Orientation orientation,
25                         int role = Qt::DisplayRole) const;
26     QModelIndex index (TreeItem* ti);
27     QModelIndex index(int row, int column,
28                       const QModelIndex &parent = QModelIndex()) const;
29     QModelIndex parent(const QModelIndex &index) const;
30     int rowCount(const QModelIndex &parent = QModelIndex()) const;
31     int columnCount(const QModelIndex &parent = QModelIndex()) const;
32
33     void nextBranch (BranchItem* &current, BranchItem* &previous, bool deepLevelsFirst=false, BranchItem* start=NULL);
34
35     bool removeRows ( int row, int count, 
36                 const QModelIndex & parent = QModelIndex() ); 
37
38     TreeItem* getItem (const QModelIndex &index) const;
39     BranchItem* getRootItem();
40
41     virtual int xlinkCount();
42     virtual Link* getXLinkNum (const int &n); 
43
44 protected:
45     BranchItem *rootItem;
46
47     QList <Link*> xlinks;
48     QList <uint> deleteLaterIDs;
49
50 };
51
52 #endif