treemodel.h
author insilmaril
Fri Oct 02 13:24:55 2009 +0000 (2009-10-02)
changeset 802 f076fdec767d
parent 788 78ba80b54bc4
child 804 14f2b1b15242
permissions -rw-r--r--
More fixes for using proxy
insilmaril@725
     1
#ifndef TREEMODEL_H
insilmaril@725
     2
#define TREEMODEL_H
insilmaril@725
     3
insilmaril@725
     4
#include <QAbstractItemModel>
insilmaril@725
     5
#include <QModelIndex>
insilmaril@725
     6
#include <QVariant>
insilmaril@725
     7
insilmaril@726
     8
insilmaril@750
     9
class BranchItem;
insilmaril@725
    10
class TreeItem;
insilmaril@726
    11
class LinkableMapObj;
insilmaril@725
    12
insilmaril@725
    13
class TreeModel : public QAbstractItemModel
insilmaril@725
    14
{
insilmaril@725
    15
    Q_OBJECT
insilmaril@725
    16
insilmaril@725
    17
public:
insilmaril@725
    18
    TreeModel(QObject *parent = 0);
insilmaril@725
    19
    ~TreeModel();
insilmaril@725
    20
insilmaril@725
    21
    QVariant data(const QModelIndex &index, int role) const;
insilmaril@725
    22
    Qt::ItemFlags flags(const QModelIndex &index) const;
insilmaril@725
    23
    QVariant headerData(int section, Qt::Orientation orientation,
insilmaril@725
    24
                        int role = Qt::DisplayRole) const;
insilmaril@788
    25
	QModelIndex index (TreeItem* ti);
insilmaril@725
    26
    QModelIndex index(int row, int column,
insilmaril@725
    27
                      const QModelIndex &parent = QModelIndex()) const;
insilmaril@725
    28
    QModelIndex parent(const QModelIndex &index) const;
insilmaril@725
    29
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
insilmaril@725
    30
    int columnCount(const QModelIndex &parent = QModelIndex()) const;
insilmaril@725
    31
insilmaril@773
    32
	BranchItem* next(BranchItem* &current, BranchItem* &previous, BranchItem* start=NULL);
insilmaril@726
    33
insilmaril@727
    34
	bool removeRows ( int row, int count, 
insilmaril@727
    35
				const QModelIndex & parent = QModelIndex() ); 
insilmaril@727
    36
insilmaril@745
    37
	TreeItem* getItem (const QModelIndex &index) const;
insilmaril@793
    38
	BranchItem* getRootItem();
insilmaril@725
    39
insilmaril@754
    40
insilmaril@729
    41
protected:
insilmaril@793
    42
    BranchItem *rootItem;
insilmaril@725
    43
};
insilmaril@725
    44
insilmaril@725
    45
#endif