13 #ifndef MAGICSMOKE_DOMMODEL_H
14 #define MAGICSMOKE_DOMMODEL_H
16 #include <QAbstractItemModel>
49 virtual QDomDocument domDocument()
const;
52 static const int DomNodeRole=Qt::UserRole;
55 virtual int columnCount(
const QModelIndex&parent=QModelIndex())
const;
58 virtual QVariant data(
const QModelIndex&index,
int role=Qt::DisplayRole)
const;
64 virtual QModelIndex index(
int row,
int column,
const QModelIndex&parent=QModelIndex())
const;
66 virtual QModelIndex parent(
const QModelIndex&index)
const;
68 virtual int rowCount(
const QModelIndex&parent=QModelIndex())
const;
71 virtual QSet<QDomNode::NodeType> shownNodeTypes()
const;
74 virtual QDomNode node(
const QModelIndex&index)
const;
77 bool setHeaderData(
int section, Qt::Orientation orientation,
const QVariant & value,
int role = Qt::EditRole);
79 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
84 virtual void setDomDocument(
const QDomDocument&);
89 void showNodeTypes(
const QSet<QDomNode::NodeType>&);
92 void addShowNodeType(QDomNode::NodeType);
95 void addShowNodeTypes(
const QSet<QDomNode::NodeType>&);
98 void showAllNodeTypes();
105 void showElementProperties(
int maxattr,
int maxtext);
108 void showTypeLabel(
bool show=
true);
111 virtual void setNode(
const QModelIndex&index,
const QDomNode&);
113 virtual void insertNode(
const QDomNode&newnode,
const QModelIndex&parent,
int row=-1);
115 virtual void insertNodes(
const QDomNodeList&newnodes,
const QModelIndex&parent,
int row=-1);
117 virtual void insertNodes(
const QList<QDomNode>&newnodes,
const QModelIndex&parent,
int row=-1);
119 virtual bool removeRows(
int row,
int count,
const QModelIndex&parent=QModelIndex());
121 virtual void removeNode(
const QModelIndex&);
130 virtual void clear(){setDomDocument(QDomDocument());}
134 QVariant displayFromNode(
const QDomNode&)
const;
#define MAGICSMOKE_COMMON_EXPORT
Definition: commonexport.h:7
virtual void clear()
resets the model to an invalid/empty QDomDocument
Definition: dommodel.h:130
This is a specialized model type that shows and allows to manipulate a DOM tree.
Definition: dommodel.h:35
Q_DECLARE_METATYPE(QDomNode)
std::function< QVariant(const QDomNode &)> MDomModelFunctor
Special functor that can be used to customize MDomItemModel.
Definition: dommodel.h:25