treemodel.h
author insilmaril
Wed, 20 May 2009 15:40:14 +0000
changeset 772 e3f722759c7e
parent 754 db0ec4bcf416
child 773 340bc29da9a0
permissions -rw-r--r--
Fixed segfault when closing a map
     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 /*
    34 	bool insertRows ( int row, int count, 
    35 				const QModelIndex & parent = QModelIndex() ); 
    36 */				
    37 	bool removeRows ( int row, int count, 
    38 				const QModelIndex & parent = QModelIndex() ); 
    39 
    40 	TreeItem* getItem (const QModelIndex &index) const;
    41 	TreeItem* getRootItem();
    42 	QModelIndex index (TreeItem* ti);
    43 
    44 
    45 protected:
    46     TreeItem *rootItem;
    47 };
    48 
    49 #endif