www.pudn.com > TreeView.rar > treemodel.h, change:2014-12-15,size:1088b


#ifndef TREEMODEL_H 
#define TREEMODEL_H 
 
#include <QAbstractItemModel> 
#include <QModelIndex> 
#include <QVariant> 
#include "util.h" 
 
class TreeItem; 
 
class TreeModel : public QAbstractItemModel 
{ 
    Q_OBJECT 
 
public: 
    explicit TreeModel(QObject *parent = 0); 
    ~TreeModel(); 
 
    QVariant data(const QModelIndex &index, int role) const; 
    Qt::ItemFlags flags(const QModelIndex &index) const; 
    QVariant headerData(int section, Qt::Orientation orientation, 
                        int role = Qt::DisplayRole) const; 
    QModelIndex index(int row, int column, 
                      const QModelIndex &parent = QModelIndex()) const; 
    QModelIndex parent(const QModelIndex &index) const; 
    int rowCount(const QModelIndex &parent = QModelIndex()) const; 
    int columnCount(const QModelIndex &parent = QModelIndex()) const; 
    void setXML(QString xmlFile); 
 
private: 
    void setupModelData(TreeItem *parent); 
    TreeItem *item(TreeItem *item, ToolUtil tool); 
    TreeItem *rootItem; 
    QList<ToolUtil> toolList; 
}; 
 
#endif // TREEMODEL_H