treemodel.h
author insilmaril
Fri, 11 Sep 2009 12:56:15 +0000
changeset 794 d922fb6ea482
parent 793 cac93797c580
child 804 14f2b1b15242
permissions -rw-r--r--
more fixes for collisions
     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* next(BranchItem* &current, BranchItem* &previous, 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