00001 #ifndef ASTTREEMODEL_H
00002 #define ASTTREEMODEL_H
00003
00004
00005
00006 #include <QAbstractItemModel>
00007
00008 #include "AstFilters.h"
00009
00010 class SgNode;
00011
00023 class QtAstModel : public QAbstractItemModel
00024 {
00025 Q_OBJECT
00026 class ModelNode;
00027
00028 public:
00029 QtAstModel(SgNode * node, QObject * parent= 0);
00030 virtual ~QtAstModel();
00031
00032
00033 virtual Qt::ItemFlags flags (const QModelIndex & index) const;
00034 virtual QVariant data (const QModelIndex & index, int role = Qt::DisplayRole ) const;
00035 virtual QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
00036
00037 virtual int rowCount (const QModelIndex & parent = QModelIndex() ) const;
00038 virtual int columnCount (const QModelIndex & parent = QModelIndex() ) const;
00039
00040
00041 virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
00042 virtual QModelIndex parent ( const QModelIndex & index ) const;
00043
00046 virtual SgNode * getNodeFromIndex(const QModelIndex & ind);
00047
00048 public slots:
00050 void setNode(SgNode * node);
00051
00055 void setFilter(AstFilterInterface * filter);
00056
00057 protected:
00058 ModelNode * treeRoot;
00059 AstFilterInterface * filter;
00060 };
00061
00062 #endif