Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
IR::ContentBlock Struct Reference

Represents a structural block element in documentation. More...

#include <contentblock.h>

Collaboration diagram for IR::ContentBlock:

Public Member Functions

QJsonObject toJson () const
 Converts the ContentBlock to a QJsonObject for template rendering.
QString plainText () const
 Returns the concatenated plain text of this block's content, recursively.

Public Attributes

BlockType type { BlockType::Paragraph }
QJsonObject attributes
 Type-specific metadata.
QList< InlineContentinlineContent
 Rich inline content.
QList< ContentBlockchildren
 Nested blocks.

Detailed Description

Represents a structural block element in documentation.

ContentBlock is a format-agnostic representation of documentation structure. Most blocks are either {leaf blocks} (with inlineContent) or {container blocks} (with children). Some atom chains produce blocks that mix both — serialization and plainText() handle this gracefully.

The attributes field holds type-specific metadata as a QJsonObject. Attribute keys use camelCase for compatibility with Inja dot notation in templates (e.g., {block.attributes.listType}). Type IDs in the type field use kebab-case (e.g., {"code-block"}).

This is a pure value type with no dependencies on QDoc's core infrastructure. It belongs in QDocLib. Multiple renderers can read the same ContentBlock concurrently — the frozen IR design supports parallel rendering per output format.

See also
InlineContent, InlineType

Definition at line 94 of file contentblock.h.

Member Function Documentation

◆ plainText()

QString IR::ContentBlock::plainText ( ) const
nodiscard

Returns the concatenated plain text of this block's content, recursively.

Collects inline text first, then child block text. Blocks may have both inline content and children when the atom chain mixes inline and block-level elements within the same container.

Definition at line 288 of file contentblock.cpp.

◆ toJson()

QJsonObject IR::ContentBlock::toJson ( ) const
nodiscard

Converts the ContentBlock to a QJsonObject for template rendering.

The JSON uses kebab-case type IDs. A computed text key contains the concatenated plain text of all inline content or children. Empty collections (inlines, children, attributes) are omitted.

Definition at line 249 of file contentblock.cpp.

Member Data Documentation

◆ attributes

QJsonObject IR::ContentBlock::attributes

Type-specific metadata.

Definition at line 97 of file contentblock.h.

◆ children

QList<ContentBlock> IR::ContentBlock::children

Nested blocks.

Definition at line 99 of file contentblock.h.

◆ inlineContent

QList<InlineContent> IR::ContentBlock::inlineContent

Rich inline content.

Definition at line 98 of file contentblock.h.

◆ type

BlockType IR::ContentBlock::type { BlockType::Paragraph }

Definition at line 96 of file contentblock.h.


The documentation for this struct was generated from the following files: