![]() | Home · All Classes · Modules |
The QXmlNodeModelIndex class is used to represent a node in a node model. More...
The QXmlNodeModelIndex class is used to represent a node in a node model.
QXmlNodeModelIndex is used as an index into QAbstractXmlNodeModel. It contains two things:
QXmlNodeModelIndex is intentionally a simple class. For instance it doesn't have a function for getting a node's name or the list of its attributes. Therefore, QXmlNodeModelIndex is primarily useful if you are using your own node model, but falls short if you to some degree want to spectate the nodes as ordinary XML nodes. Typically the best way to achieve the latter is to either send the result out to a QAbstractXmlReceiver or to put more of the logic inside the query.
For instance, let's say you want to populate a list widget with the values of a set of attributes. Instead of letting the query return a set of elements and then iterate over the their attributes and extract the string values, let the query do all this directly and then evaluate it using QXmlQuery.evaluateTo() and pass a pointer to QStringList.
QXmlNodeModelIndex does not impose restrictions on what data QXmlNodeModelIndex should contain, that is entirely up to the associated QAbstractXmlNodeModel.
Conceptually, QXmlNodeModelIndex can be seen as being one of the two types of items in XQuery: namely nodes. When the XQuery engine handles nodes, it uses QXmlNodeModelIndex in order to delegate the actual functionality to the associated QAbstractXmlNodeModel.
Since QXmlNodeModelIndex is dependent on a particular QAbstractXmlNodeModel subclass, there is no way to create instances, except for via QAbstractXmlNodeModel.createIndex(). Since that function is protected, it can probably be good to create a function that creates node indexes from arguments that fits the particular node model.
A default constructed node index null, and isNull() will return true.
QXmlNodeModelIndex and QAbstractXmlNodeModel follows the same design pattern that QModelIndex QAbstractItemModel do.
Identifies what specific node comparison operator that should be used.
Constant | Value | Description |
---|---|---|
QXmlNodeModelIndex.Precedes | -1 | Signifies the \<\< operator. Whether the first operand precedes the second operand in document order. |
QXmlNodeModelIndex.Follows | 1 | Signifies the \>\> operator. Whether the first operand follows the second operand in document order. |
QXmlNodeModelIndex.Is | 0 | Signifies the is operator. Whether two nodes have the same node identity. |
Identifies the kind of a node.
Constant | Value | Description |
---|---|---|
QXmlNodeModelIndex.Attribute | 1 | Identifies an attribute node |
QXmlNodeModelIndex.Text | 64 | Identifies a text node |
QXmlNodeModelIndex.Comment | 2 | Identifies a comment node |
QXmlNodeModelIndex.Document | 4 | Identifies a document node |
QXmlNodeModelIndex.Element | 8 | Identifies an element node |
QXmlNodeModelIndex.Namespace | 16 | Identifies a namespace node |
QXmlNodeModelIndex.ProcessingInstruction | 32 | Identifies a processing instruction. Not that the optional XML declaration at very beginning of the XML document is not a processing instruction |
See also QAbstractXmlNodeModel.kind().
Default constructor. Creates an item that is null.
See also isNull().
Standard copy constructor. Creates a QXmlNodeModelIndex instance that is a copy of other.
Returns the second data section that this node index carries.
See also data().
Returns the first data section that this node index carries.
See also additionalData().
Returns the first data section typed as a void * pointer.
See also additionalData().
Returns true if this QXmlNodeModelIndex is a default constructed value, otherwise false.
A null QXmlNodeModelIndex instance doesn't represent any node and cannot be used in conjunction with QAbstractXmlNodeModel.
Returns the QAbstractXmlNodeModel that this node index belongs to. QXmlNodeModelIndex does not own QAbstractXmlNodeModel nor keep track of its lifetime, so this pointer will dangle whenthe QAbstractXmlNodeModel is deallocated.
There is no setter for this, QXmlNodeModelIndex instances are created with QAbstractXmlNodeModel.createIndex().
PyQt 4.4.2 for X11 | Copyright © Riverbank Computing Ltd and Trolltech AS 2008 | Qt 4.4.0 |