![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Represents a structural block element in documentation. More...
#include <contentblock.h>
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< InlineContent > | inlineContent |
| Rich inline content. | |
| QList< ContentBlock > | children |
| Nested blocks. | |
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.
Definition at line 94 of file contentblock.h.
|
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.
|
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.
| QJsonObject IR::ContentBlock::attributes |
Type-specific metadata.
Definition at line 97 of file contentblock.h.
| QList<ContentBlock> IR::ContentBlock::children |
Nested blocks.
Definition at line 99 of file contentblock.h.
| QList<InlineContent> IR::ContentBlock::inlineContent |
Rich inline content.
Definition at line 98 of file contentblock.h.
| BlockType IR::ContentBlock::type { BlockType::Paragraph } |
Definition at line 96 of file contentblock.h.