JsonTreeModel Implementation
v0.1.0
A Qt tree model for visualizing and manipulating a JSON document.
|
JsonTreeModelListNode represents a JSON structure (namely an array or an object) and provides the backbone of the tree model. More...
#include <jsontreemodel.h>
Public Member Functions | |
JsonTreeModelListNode (JsonTreeModelNode *parent) | |
Constructs an empty JsonTreeModelListNode under the specified parent. More... | |
JsonTreeModelListNode (const QJsonArray &array, JsonTreeModelNode *parent) | |
Constructs a node under the specified parent to represent the specified JSON array. More... | |
~JsonTreeModelListNode () override | |
JsonTreeModelNode * | childAt (int i) const |
Returns the child node at index i. More... | |
int | childCount () const |
Returns the number of child nodes under this row. More... | |
int | childPosition (JsonTreeModelNode *child) const |
Returns index number of the specified child, or -1 if the child does not belong to this node. More... | |
Type | type () const override |
Returns JsonTreeModelNode::Array. More... | |
QJsonValue | value () const override |
Returns the JSON structure (array or object) represented by this node. More... | |
![]() | |
JsonTreeModelNode (JsonTreeModelNode *parent) | |
Constructs a new node with the given parent. More... | |
virtual | ~JsonTreeModelNode () |
Frees the memory held by this node and its children. More... | |
JsonTreeModelNode * | parent () const |
Returns this node's parent. More... | |
void | setParent (JsonTreeModelNode *parent) |
Makes this node a child of parent. More... | |
Protected Member Functions | |
void | registerChild (JsonTreeModelNode *child) |
Puts the child node under this node's hierarchy. More... | |
void | deregisterChild (JsonTreeModelNode *child) |
Removes the child node from this node's hierarchy. More... | |
Additional Inherited Members | |
![]() | |
enum | Type { Scalar, Object, Array } |
This enum describes the type of data represented by a JsonTreeModelNode. More... | |
JsonTreeModelListNode represents a JSON structure (namely an array or an object) and provides the backbone of the tree model.
This class can have children. Child nodes manifest as child rows in the JsonTreeModel.
JSON objects are best represented as a JsonTreeModelNamedListNode.
|
inline |
Constructs an empty JsonTreeModelListNode under the specified parent.
The new node can be populated later.
JsonTreeModelListNode::JsonTreeModelListNode | ( | const QJsonArray & | array, |
JsonTreeModelNode * | parent | ||
) |
Constructs a node under the specified parent to represent the specified JSON array.
All array elements will be placed within child nodes and registered.
|
inlineoverride |
|
inline |
Returns the child node at index i.
|
inline |
Returns the number of child nodes under this row.
This is equivalent to the number of rows in the JsonTreeModel where this node is the parent QModelIndex.
|
inline |
Returns index number of the specified child, or -1 if the child does not belong to this node.
|
protected |
Removes the child node from this node's hierarchy.
|
protected |
Puts the child node under this node's hierarchy.
|
inlineoverridevirtual |
Returns JsonTreeModelNode::Array.
Implements JsonTreeModelNode.
Reimplemented in JsonTreeModelNamedListNode.
|
overridevirtual |
Returns the JSON structure (array or object) represented by this node.
Implements JsonTreeModelNode.
Reimplemented in JsonTreeModelWrapperNode, and JsonTreeModelNamedListNode.