XmlTreeModel Class Reference

Data model for XML Dom Nodes in a and QTreeView. More...

#include <xmltreemodel.h>

List of all members.

Public Member Functions

 XmlTreeModel (QObject *parent=NULL)
 ~XmlTreeModel ()
bool setContent (QFile &f) throw (Exception)
 opens, parses a file using DOM, and then represents it as a TreeModel.
bool setContent (QDomNode node)
 Wraps an XmlTreeModel around an existing Dom Tree.
QDomNode indexToNode (QModelIndex ix) const
QModelIndex nodeToIndex (int row, int column, QDomNode node) const
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
ItemFlags flags (const QModelIndex &index) const
QModelIndex parent (const QModelIndex &index) const
int rowCount (const QModelIndex &parent=QModelIndex()) const
int columnCount (const QModelIndex &parent=QModelIndex()) const
 In this two-column representation, the first column is a directory tree and the second column is a "view" of the contents of the node pointed to in the first column.
bool hasChildren (const QModelIndex &parent=QModelIndex()) const
QVariant data (const QModelIndex &index, int role=DisplayRole) const
 Returns a QVariant, which might be a piece of text, or an icon representing the node.
QVariant headerData (int section, Qt::Orientation o, int role=DisplayRole) const

Protected Attributes

QDomDocument doc


Detailed Description

Data model for XML Dom Nodes in a and QTreeView.

Obsolete: See the qt examples/itemviews/simpletreeview

Definition at line 23 of file xmltreemodel.h.


Member Function Documentation

bool XmlTreeModel::setContent ( QFile &  f  )  throw (Exception)

opens, parses a file using DOM, and then represents it as a TreeModel.

Parameters:
f - the file to open

Definition at line 20 of file xmltreemodel.cpp.

bool XmlTreeModel::setContent ( QDomNode  node  ) 

Wraps an XmlTreeModel around an existing Dom Tree.

Parameters:
node an already parsed XML tree

Definition at line 15 of file xmltreemodel.cpp.

References doc.

QVariant XmlTreeModel::data ( const QModelIndex &  index,
int  role = DisplayRole 
) const

Returns a QVariant, which might be a piece of text, or an icon representing the node.

Question: For text, which contain newlines, how can we tell the View class to render it with line-wrap?

Parameters:
index - a pointer to the node for which we want to return some displayable information.
role - either DecorationRole or DisplayRole. Because this is a callback, it is used by the view for both roles.

Definition at line 169 of file xmltreemodel.cpp.

References indexToNode().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Sep 30 01:15:44 2009 for oopapidocs by  doxygen 1.5.1