treemodel.h

Go to the documentation of this file.
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 // TreeModel - это вспомогательный класс. От него наследуется knowtreemodel
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     // Возвращение указателя на Item-элемент с указанным index
00047     // Где index - это индекс объекта в терминах структуры модель-вид
00048     TreeItem *getItem(const QModelIndex &index) const;
00049 
00050     // Возвращение указателя на Item-элемент с указанным путем
00051     // в виде последовательности идентификаторов
00052     TreeItem *getItem(QStringList path) const;
00053     
00054     TreeItem *rootItem; // Ссылка на первый (корневой) item-объект
00055 };
00056 
00057 #endif

Generated on Mon Feb 2 00:25:34 2009 for mytetra by  doxygen 1.5.1