00001 #ifndef __TREENODE_H__
00002 #define __TREENODE_H__
00003
00004 #include <QAbstractItemModel>
00005 #include <QModelIndex>
00006 #include <QVariant>
00007 #include <QObject>
00008 #include <QtXml>
00009
00010 #include "treemodel.h"
00011
00012 class knowtreemodel : public TreeModel
00013 {
00014 Q_OBJECT
00015
00016 public:
00017 knowtreemodel(const QStringList &headers, QDomDocument dommodel, QObject *parent = 0);
00018 ~knowtreemodel();
00019
00020 QDomElement export_fullmodeldata_to_dom(TreeItem *root);
00021
00022
00023 void add_new_child_branch(const QModelIndex &index, QString id, QString name);
00024
00025
00026 void add_new_sibling_branch(const QModelIndex &index, QString id, QString name);
00027
00028
00029 void add_new_branch(TreeItem *parent, QString id, QString name);
00030
00031
00032 QModelIndex move_up_branch(const QModelIndex &index);
00033 QModelIndex move_dn_branch(const QModelIndex &index);
00034
00035
00036 QModelIndex indexChildren(const QModelIndex &parent, int n) const;
00037
00038 QModelIndex get_item_index(TreeItem *item);
00039
00040 private:
00041
00042 void setupModelData(QDomDocument dommodel, TreeItem *parent);
00043
00044
00045 void parsenodeelement(QDomElement n, TreeItem *parent);
00046
00047
00048 void parsetreetodom(QDomElement *xmldata,TreeItem *curritem);
00049
00050
00051 QModelIndex move_updn_branch(const QModelIndex &index,int direction);
00052
00053 QModelIndex get_item_index_recurse(QModelIndex currindex, TreeItem *finditem, int mode);
00054 };
00055
00056 #endif // __TREENODE_H__