QXmlNodeModelIndex¶
The
QXmlNodeModelIndex
class identifies a node in an XML node model subclassed fromQAbstractXmlNodeModel
. More…
Synopsis¶
Functions¶
def
__eq__
(other)def
__ne__
(other)def
additionalData
()def
data
()def
internalPointer
()def
isNull
()def
model
()
Detailed Description¶
QXmlNodeModelIndex
is an index into anXML node model
. It contains:
A pointer to an
XML node model
, which is returned bymodel()
, andSome data, which is returned by
data()
,internalPointer()
, andadditionalData()
.Because
QXmlNodeModelIndex
is intentionally a simple class, it doesn’t have member functions for accessing the properties of nodes. For example, it doesn’t have functions for getting a node’s name or its list of attributes or child nodes. If you find that you need to retrieve this kind of information from your query results, there are two ways to proceed.
Send the output of your XQuery to an
XML receiver
, orLet your XQuery do all the work to produce the desired result.
The second case is explained by example. Suppose you want to populate a list widget with the values of certain attributes from a set of result elements. You could write an XQuery to return the set of elements, and then you would write the code to iterate over the result elements, get their attributes, and extract the desired string values. But the simpler way is to just augment your XQuery to finding the desired attribute values. Then all you have to do is evaluate the XQuery using the version of
evaluateTo()
that populates aQStringList
, which you can send directly to your widget.
QXmlNodeModelIndex
doesn’t impose any restrictions on thedata
value anQXmlNodeModelIndex
should contain. The meaning of the data left to the associatednode model
. BecauseQXmlNodeModelIndex
depends on a particular subclass ofQAbstractXmlNodeModel
for its existence, the only way you can create an instance ofQXmlNodeModelIndex
is by asking the node model to create one for you withcreateIndex()
. Since that function is protected, it is usually a good idea to write a public function that creates aQXmlNodeModelIndex
from arguments that are appropriate for your particular node model.A default constructed node index is said to be null, i.e.,
isNull()
returns true.
QXmlNodeModelIndex
andQAbstractXmlNodeModel
follow the same design pattern used forQModelIndex
andQAbstractItemModel
.
- class PySide2.QtXmlPatterns.QXmlNodeModelIndex¶
PySide2.QtXmlPatterns.QXmlNodeModelIndex(other)
- param other:
Default constructor. Creates an item that is
null
.See also
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.Constants¶
Constant
Description
QXmlNodeModelIndex.ForwardAxis
All forward axes include this flag.
QXmlNodeModelIndex.ReverseAxis
All reverse axes include this flag.
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.NodeKind¶
Identifies a kind of node.
Constant
Description
QXmlNodeModelIndex.Attribute
Identifies an attribute node
QXmlNodeModelIndex.Text
Identifies a text node
QXmlNodeModelIndex.Comment
Identifies a comment node
QXmlNodeModelIndex.Document
Identifies a document node
QXmlNodeModelIndex.Element
Identifies an element node
QXmlNodeModelIndex.Namespace
Identifies a namespace node
QXmlNodeModelIndex.ProcessingInstruction
Identifies a processing instruction.
Note that the optional XML declaration at very beginning of the XML document is not a processing instruction
See also
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.DocumentOrder¶
Identifies the specific node comparison operator that should be used.
Constant
Description
QXmlNodeModelIndex.Precedes
Signifies the
\<\<
operator. Test whether the first operand precedes the second in the document.QXmlNodeModelIndex.Follows
Signifies the
\>\>
operator. Test whether the first operand follows the second in the document.QXmlNodeModelIndex.Is
Signifies the
is
operator. Test whether two nodes have the same node identity.
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.additionalData()¶
- Return type:
int
Returns the second data value. The node index holds two data values.
data()
returns the first one.See also
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.data()¶
- Return type:
int
Returns the first data value. The node index holds two data values.
additionalData()
returns the second one.See also
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.internalPointer()¶
- Return type:
void
Returns the first data value as a void* pointer.
See also
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.isNull()¶
- Return type:
bool
Returns true if this
QXmlNodeModelIndex
is a default constructed value, otherwise false.A null
QXmlNodeModelIndex
doesn’t represent any node and cannot be used in conjunction withQAbstractXmlNodeModel
.
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.model()¶
- Return type:
Returns the
QAbstractXmlNodeModel
that this node index refers to.QXmlNodeModelIndex
does not ownQAbstractXmlNodeModel
and does not keep track of its lifetime, so this pointer will dangle if theQAbstractXmlNodeModel
is deallocated first.There is no setter for the node model because instances of
QXmlNodeModelIndex
instances are only created withcreateIndex()
.
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.__ne__(other)¶
- Parameters:
- Return type:
bool
Returns true if
other
is the same node as this.
- PySide2.QtXmlPatterns.QXmlNodeModelIndex.__eq__(other)¶
- Parameters:
- Return type:
bool
Returns true if this node is the same as
other
. This operator does not compare values, children, or names of nodes. It compares node identities, i.e., whether two nodes are from the same document and are found at the exact same place.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.