treemodel.h
author insilmaril
Fri, 09 Apr 2010 14:24:04 +0000
changeset 846 f0fe7c36ec5c
parent 804 14f2b1b15242
child 847 43268373032d
permissions -rw-r--r--
Version 1.13.3 and added treeeditor.png
     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 LinkableMapObj;
    12 
    13 class TreeModel : public QAbstractItemModel
    14 {
    15     Q_OBJECT
    16 
    17 public:
    18     TreeModel(QObject *parent = 0);
    19     ~TreeModel();
    20 
    21     QVariant data(const QModelIndex &index, int role) const;
    22     Qt::ItemFlags flags(const QModelIndex &index) const;
    23     QVariant headerData(int section, Qt::Orientation orientation,
    24                         int role = Qt::DisplayRole) const;
    25 	QModelIndex index (TreeItem* ti);
    26     QModelIndex index(int row, int column,
    27                       const QModelIndex &parent = QModelIndex()) const;
    28     QModelIndex parent(const QModelIndex &index) const;
    29     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    30     int columnCount(const QModelIndex &parent = QModelIndex()) const;
    31 
    32 	BranchItem* nextBranch (BranchItem* &current, BranchItem* &previous, bool deepLevelsFirst=true, BranchItem* start=NULL);
    33 
    34 	bool removeRows ( int row, int count, 
    35 				const QModelIndex & parent = QModelIndex() ); 
    36 
    37 	TreeItem* getItem (const QModelIndex &index) const;
    38 	BranchItem* getRootItem();
    39 
    40 
    41 protected:
    42     BranchItem *rootItem;
    43 };
    44 
    45 #endif