treemodel.h
author insilmaril
Mon, 06 Oct 2008 11:10:20 +0000
changeset 726 7f43b93242aa
parent 725 7ea31701156e
child 727 96402b172173
permissions -rw-r--r--
Various fixes, also from 1.12. branch
     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 *first();
    31 	TreeItem *next();
    32 
    33 protected:
    34 	QModelIndex index (TreeItem* ti);
    35 	TreeItem *LMOToItem(LinkableMapObj*);
    36     void setupModelData(TreeItem *parent);
    37 
    38     TreeItem *rootItem;
    39 	static TreeItem* itFirst;
    40 	static TreeItem* itCur;
    41 };
    42 
    43 #endif