treemodel.h
author convert-repo
Fri, 23 Jul 2010 16:43:49 +0000
changeset 849 988f1908a7c4
parent 847 43268373032d
permissions -rw-r--r--
update tags
     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 Link;
    12 class LinkableMapObj;
    13 
    14 class TreeModel : public QAbstractItemModel
    15 {
    16     Q_OBJECT
    17 
    18 public:
    19     TreeModel(QObject *parent = 0);
    20     ~TreeModel();
    21 
    22     QVariant data(const QModelIndex &index, int role) const;
    23     Qt::ItemFlags flags(const QModelIndex &index) const;
    24     QVariant headerData(int section, Qt::Orientation orientation,
    25                         int role = Qt::DisplayRole) const;
    26 	QModelIndex index (TreeItem* ti);
    27     QModelIndex index(int row, int column,
    28                       const QModelIndex &parent = QModelIndex()) const;
    29     QModelIndex parent(const QModelIndex &index) const;
    30     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    31     int columnCount(const QModelIndex &parent = QModelIndex()) const;
    32 
    33 	BranchItem* nextBranch (BranchItem* &current, BranchItem* &previous, bool deepLevelsFirst=true, BranchItem* start=NULL);
    34 
    35 	bool removeRows ( int row, int count, 
    36 				const QModelIndex & parent = QModelIndex() ); 
    37 
    38 	TreeItem* getItem (const QModelIndex &index) const;
    39 	BranchItem* getRootItem();
    40 
    41 
    42 protected:
    43     BranchItem *rootItem;
    44 
    45 	QList <Link*> xlinks;
    46 	QList <Link*> xlinks_obsolete;
    47 
    48 };
    49 
    50 #endif