treemodel.h
author insilmaril
Wed, 29 Apr 2009 18:46:31 +0000
changeset 760 59614eaf5fbb
parent 754 db0ec4bcf416
child 772 e3f722759c7e
permissions -rw-r--r--
started to save data like positions outside of MapObj & Co
     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, int &d0);
    32 
    33 	bool insertRows ( int row, int count, 
    34 				const QModelIndex & parent = QModelIndex() ); 
    35 	bool removeRows ( int row, int count, 
    36 				const QModelIndex & parent = QModelIndex() ); 
    37 
    38 	TreeItem* getItem (const QModelIndex &index) const;
    39 	TreeItem* getRootItem();
    40 	QModelIndex index (TreeItem* ti);
    41 
    42 
    43 protected:
    44     TreeItem *rootItem;
    45 };
    46 
    47 #endif