summaryrefslogtreecommitdiffstats
path: root/examples/widgets/doc/simpledommodel.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/doc/simpledommodel.qdoc')
-rw-r--r--examples/widgets/doc/simpledommodel.qdoc42
1 files changed, 21 insertions, 21 deletions
diff --git a/examples/widgets/doc/simpledommodel.qdoc b/examples/widgets/doc/simpledommodel.qdoc
index 2564c654fa..54e141d5d3 100644
--- a/examples/widgets/doc/simpledommodel.qdoc
+++ b/examples/widgets/doc/simpledommodel.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \example itemviews/simpledommodel
+ \example widgets/itemviews/simpledommodel
\title Simple DOM Model Example
The Simple DOM Model example shows how an existing class can be adapted for use with
@@ -69,7 +69,7 @@
Let us begin by examining the \c DomModel class:
- \snippet itemviews/simpledommodel/dommodel.h 0
+ \snippet widgets/itemviews/simpledommodel/dommodel.h 0
The class definition contains all the basic functions that are needed for a
read-only model. Only the constructor and \c document() function are specific to
@@ -82,7 +82,7 @@
The \c DomItem class is used to hold information about a specific QDomNode in
the document:
- \snippet itemviews/simpledommodel/domitem.h 0
+ \snippet widgets/itemviews/simpledommodel/domitem.h 0
Each \c DomItem provides a wrapper for a QDomNode obtained from the underlying
document which contains a reference to the node, it's location in the parent node's
@@ -105,18 +105,18 @@
The constructor simply records details of the QDomNode that needs to be wrapped:
- \snippet itemviews/simpledommodel/domitem.cpp 0
- \snippet itemviews/simpledommodel/domitem.cpp 1
+ \snippet widgets/itemviews/simpledommodel/domitem.cpp 0
+ \snippet widgets/itemviews/simpledommodel/domitem.cpp 1
As a result, functions to provide the parent wrapper, the row number occupied by
the item in its parent's list of children, and the underlying QDomNode for each item
are straightforward to write:
- \snippet itemviews/simpledommodel/domitem.cpp 4
+ \snippet widgets/itemviews/simpledommodel/domitem.cpp 4
\codeline
- \snippet itemviews/simpledommodel/domitem.cpp 6
+ \snippet widgets/itemviews/simpledommodel/domitem.cpp 6
\codeline
- \snippet itemviews/simpledommodel/domitem.cpp 3
+ \snippet widgets/itemviews/simpledommodel/domitem.cpp 3
It is necessary to maintain a collection of items which can be consistently identified
by the model. For that reason, we maintain a hash of child wrapper items that, to
@@ -125,7 +125,7 @@
of the item's QDomNode, relating the row number of each child to the newly-constructed
wrapper:
- \snippet itemviews/simpledommodel/domitem.cpp 5
+ \snippet widgets/itemviews/simpledommodel/domitem.cpp 5
If a QDomNode was previously wrapped, the cached wrapper is returned; otherwise, a
new wrapper is constructed and stored for valid children, and zero is returned for
@@ -133,7 +133,7 @@
The class's destructor deletes all the child items of the wrapper:
- \snippet itemviews/simpledommodel/domitem.cpp 2
+ \snippet widgets/itemviews/simpledommodel/domitem.cpp 2
These, in turn, will delete their children and free any QDomNode objects in use.
@@ -145,7 +145,7 @@
The constructor accepts an existing document and a parent object for the model:
- \snippet itemviews/simpledommodel/dommodel.cpp 0
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 0
A shallow copy of the document is stored for future reference, and a root item is
created to provide a wrapper around the document. We assign the root item a row
@@ -154,7 +154,7 @@
Since the model only contains information about the root item, the destructor only
needs to delete this one item:
- \snippet itemviews/simpledommodel/dommodel.cpp 1
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 1
All of the child items in the tree will be deleted by the \c DomItem destructor as
their parent items are deleted.
@@ -167,7 +167,7 @@
The number of columns exposed by the model is returned by the \c columnCount()
function:
- \snippet itemviews/simpledommodel/dommodel.cpp 2
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 2
This value is fixed, and does not depend on the location or type of the underlying
node in the document. We will use these three columns to display different kinds of
@@ -176,12 +176,12 @@
Since we only implement a read-only model, the \c flags() function is straightforward
to write:
- \snippet itemviews/simpledommodel/dommodel.cpp 5
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 5
Since the model is intended for use in a tree view, the \c headerData() function only
provides a horizontal header:
- \snippet itemviews/simpledommodel/dommodel.cpp 6
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 6
The model presents the names of nodes in the first column, element attributes in the
second, and any node values in the third.
@@ -191,7 +191,7 @@
The index() function creates a model index for the item with the given row, column,
and parent in the model:
- \snippet itemviews/simpledommodel/dommodel.cpp 7
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 7
The function first has to relate the parent index to an item that contains a node
from the underlying document. If the parent index is invalid, it refers to the root
@@ -201,7 +201,7 @@
will have been created by this function, and we store pointers to item objects in
any new indexes that we create with QAbstractItemModel::createIndex():
- \snippet itemviews/simpledommodel/dommodel.cpp 8
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 8
A child item for the given row is provided by the parent item's \c child() function.
If a suitable child item was found then we call
@@ -217,7 +217,7 @@
function, and is the number of child nodes contained by the node that corresponds to
the specified model index:
- \snippet itemviews/simpledommodel/dommodel.cpp 10
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 10
To obtain the relevant node in the underlying document, we access the item via the
internal pointer stored in the model index. If an invalid index is supplied, the
@@ -228,7 +228,7 @@
provide an implementation for the \c parent() function. This returns a model index
that corresponds to the parent of a child model index supplied as its argument:
- \snippet itemviews/simpledommodel/dommodel.cpp 9
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 9
For valid indexes other than the index corresponding to the root item, we obtain
a pointer to the relevant item using the method described in the \c index() function,
@@ -243,13 +243,13 @@
the \l{Qt::DisplayRole}{display role}, returning an invalid variant for all other
requests:
- \snippet itemviews/simpledommodel/dommodel.cpp 3
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 3
As before, we obtain an item pointer for the index supplied, and use it to obtain
the underlying document node. Depending on the column specified, the data we return
is obtained in different ways:
- \snippet itemviews/simpledommodel/dommodel.cpp 4
+ \snippet widgets/itemviews/simpledommodel/dommodel.cpp 4
For the first column, we return the node's name. For the second column, we read any
attributes that the node may have, and return a string that contains a space-separated