KTextTemplate::NodeList Class

class KTextTemplate::NodeList

A list of Nodes with some convenience API for rendering them. More...

Header: #include <KTextTemplate/Node>
CMake: find_package(KF6 REQUIRED COMPONENTS TextTemplate)
target_link_libraries(mytarget PRIVATE KF6::TextTemplate)
Inherits: QList

Public Functions

NodeList()
NodeList(const QList<KTextTemplate::Node *> &list)
void append(KTextTemplate::Node *node)
void append(const QList<KTextTemplate::Node *> &nodeList)
bool containsNonText() const
QList<T> findChildren()
void render(KTextTemplate::OutputStream *stream, KTextTemplate::Context *c) const

Detailed Description

Typically, tags which have an end tag will create and later render a list of child nodes.

This class contains API such as append and render to make creating such list easily.

The findChildren method behaves similarly to the QObject::findChildren method, returning a list of nodes of a particular type from the Node objects contained in the list (and their children).

Member Function Documentation

NodeList::NodeList()

Creates an empty NodeList.

NodeList::NodeList(const QList<KTextTemplate::Node *> &list)

Convenience constructor

void NodeList::append(KTextTemplate::Node *node)

Appends node to the end of this **%NodeList**.

void NodeList::append(const QList<KTextTemplate::Node *> &nodeList)

Appends nodeList to the end of this **%NodeList**.

bool NodeList::containsNonText() const

Returns true if this **%NodeList** contains non-text nodes.

template <typename T> QList<T> NodeList::findChildren()

A recursive listing of nodes in this tree of type T.

void NodeList::render(KTextTemplate::OutputStream *stream, KTextTemplate::Context *c) const

Renders the list of Nodes in the Context @p c.