treemodel.h
author insilmaril
Wed, 01 Apr 2009 15:06:57 +0000
changeset 749 9ff332964015
parent 745 2d4cc445a86a
child 750 ff3b01ce0960
permissions -rw-r--r--
moved scroll functions from BranchObj to BranchItem
     1 #ifndef TREEMODEL_H
     2 #define TREEMODEL_H
     3 
     4 #include <QAbstractItemModel>
     5 #include <QModelIndex>
     6 #include <QVariant>
     7 
     8 
     9 class TreeItem;
    10 class LinkableMapObj;
    11 
    12 class TreeModel : public QAbstractItemModel
    13 {
    14     Q_OBJECT
    15 
    16 public:
    17     TreeModel(QObject *parent = 0);
    18     ~TreeModel();
    19 
    20     QVariant data(const QModelIndex &index, int role) const;
    21     Qt::ItemFlags flags(const QModelIndex &index) const;
    22     QVariant headerData(int section, Qt::Orientation orientation,
    23                         int role = Qt::DisplayRole) const;
    24     QModelIndex index(int row, int column,
    25                       const QModelIndex &parent = QModelIndex()) const;
    26     QModelIndex parent(const QModelIndex &index) const;
    27     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    28     int columnCount(const QModelIndex &parent = QModelIndex()) const;
    29 
    30 	TreeItem* next(TreeItem* &current, TreeItem* &previous, int &d0);
    31 
    32 	bool insertRows ( int row, int count, 
    33 				const QModelIndex & parent = QModelIndex() ); 
    34 	bool removeRows ( int row, int count, 
    35 				const QModelIndex & parent = QModelIndex() ); 
    36 
    37 	TreeItem* getItem (const QModelIndex &index) const;
    38 	QModelIndex index (TreeItem* ti);
    39 
    40 protected:
    41     TreeItem *rootItem;
    42 };
    43 
    44 #endif