treemodel.h
author insilmaril
Tue, 05 Aug 2008 07:36:53 +0000
changeset 725 7ea31701156e
child 726 7f43b93242aa
permissions -rw-r--r--
Preview: Added QTreeView to mainwindow (not yet functional)
     1 #ifndef TREEMODEL_H
     2 #define TREEMODEL_H
     3 
     4 #include <QAbstractItemModel>
     5 #include <QModelIndex>
     6 #include <QVariant>
     7 
     8 class TreeItem;
     9 
    10 class TreeModel : public QAbstractItemModel
    11 {
    12     Q_OBJECT
    13 
    14 public:
    15     TreeModel(QObject *parent = 0);
    16     ~TreeModel();
    17 
    18     QVariant data(const QModelIndex &index, int role) const;
    19     Qt::ItemFlags flags(const QModelIndex &index) const;
    20     QVariant headerData(int section, Qt::Orientation orientation,
    21                         int role = Qt::DisplayRole) const;
    22     QModelIndex index(int row, int column,
    23                       const QModelIndex &parent = QModelIndex()) const;
    24     QModelIndex parent(const QModelIndex &index) const;
    25     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    26     int columnCount(const QModelIndex &parent = QModelIndex()) const;
    27 
    28 private:
    29     void setupModelData(TreeItem *parent);
    30 
    31     TreeItem *rootItem;
    32 };
    33 
    34 #endif