treemodel.h
author insilmaril
Tue, 26 May 2009 11:23:44 +0000
changeset 773 340bc29da9a0
parent 772 e3f722759c7e
child 788 78ba80b54bc4
permissions -rw-r--r--
Various fixes and simplifications
     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(int row, int column,
    26                       const QModelIndex &parent = QModelIndex()) const;
    27     QModelIndex parent(const QModelIndex &index) const;
    28     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    29     int columnCount(const QModelIndex &parent = QModelIndex()) const;
    30 
    31 	BranchItem* next(BranchItem* &current, BranchItem* &previous, BranchItem* start=NULL);
    32 
    33 	bool removeRows ( int row, int count, 
    34 				const QModelIndex & parent = QModelIndex() ); 
    35 
    36 	TreeItem* getItem (const QModelIndex &index) const;
    37 	TreeItem* getRootItem();
    38 	QModelIndex index (TreeItem* ti);
    39 
    40 
    41 protected:
    42     TreeItem *rootItem;
    43 };
    44 
    45 #endif