00001 #ifndef TREEMODEL_H
00002 #define TREEMODEL_H
00003
00004 #include <QAbstractItemModel>
00005 #include <QModelIndex>
00006 #include <QVariant>
00007 #include <QObject>
00008 #include <QtXml>
00009
00010
00011
00012
00013 class TreeItem;
00014
00015 class TreeModel : public QAbstractItemModel
00016 {
00017 Q_OBJECT
00018
00019 public:
00020 TreeModel(QObject *parent = 0);
00021 ~TreeModel(void);
00022
00023 QVariant data(const QModelIndex &index, int role) const;
00024 QVariant headerData(int section, Qt::Orientation orientation,
00025 int role = Qt::DisplayRole) const;
00026
00027 QModelIndex index(int row, int column,
00028 const QModelIndex &parent = QModelIndex()) const;
00029 QModelIndex parent(const QModelIndex &index) const;
00030
00031 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00032 int columnCount(const QModelIndex &parent = QModelIndex()) const;
00033
00034
00035 Qt::ItemFlags flags(const QModelIndex &index) const;
00036 bool setData(const QModelIndex &index, const QVariant &value,
00037 int role = Qt::EditRole);
00038 bool setHeaderData(int section, Qt::Orientation orientation,
00039 const QVariant &value, int role = Qt::EditRole);
00040
00041 bool insertRows(int position, int rows,
00042 const QModelIndex &parent = QModelIndex());
00043 bool removeRows(int position, int rows,
00044 const QModelIndex &parent = QModelIndex());
00045
00046
00047
00048 TreeItem *getItem(const QModelIndex &index) const;
00049
00050
00051
00052 TreeItem *getItem(QStringList path) const;
00053
00054 TreeItem *rootItem;
00055 };
00056
00057 #endif