treemodel.h
changeset 725 7ea31701156e
child 726 7f43b93242aa
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/treemodel.h	Tue Aug 05 07:36:53 2008 +0000
     1.3 @@ -0,0 +1,34 @@
     1.4 +#ifndef TREEMODEL_H
     1.5 +#define TREEMODEL_H
     1.6 +
     1.7 +#include <QAbstractItemModel>
     1.8 +#include <QModelIndex>
     1.9 +#include <QVariant>
    1.10 +
    1.11 +class TreeItem;
    1.12 +
    1.13 +class TreeModel : public QAbstractItemModel
    1.14 +{
    1.15 +    Q_OBJECT
    1.16 +
    1.17 +public:
    1.18 +    TreeModel(QObject *parent = 0);
    1.19 +    ~TreeModel();
    1.20 +
    1.21 +    QVariant data(const QModelIndex &index, int role) const;
    1.22 +    Qt::ItemFlags flags(const QModelIndex &index) const;
    1.23 +    QVariant headerData(int section, Qt::Orientation orientation,
    1.24 +                        int role = Qt::DisplayRole) const;
    1.25 +    QModelIndex index(int row, int column,
    1.26 +                      const QModelIndex &parent = QModelIndex()) const;
    1.27 +    QModelIndex parent(const QModelIndex &index) const;
    1.28 +    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    1.29 +    int columnCount(const QModelIndex &parent = QModelIndex()) const;
    1.30 +
    1.31 +private:
    1.32 +    void setupModelData(TreeItem *parent);
    1.33 +
    1.34 +    TreeItem *rootItem;
    1.35 +};
    1.36 +
    1.37 +#endif