![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Represents inline content within a documentation block. More...
#include <contentblock.h>
Classes | |
| struct | LinkData |
Public Member Functions | |
| QJsonObject | toJson () const |
| Converts the InlineContent to a QJsonObject for template rendering. | |
| QString | plainText () const |
| Returns the concatenated plain text of this inline element and all its children, recursively. | |
Public Attributes | |
| InlineType | type { InlineType::Text } |
| QString | text |
| Text content. | |
| QString | href |
| Link target or image source. | |
| QString | title |
| Link tooltip or image alt text. | |
| QList< InlineContent > | children |
| Nested inline content. | |
| QJsonObject | attributes |
| Type-specific metadata. | |
| std::optional< LinkData > | link |
Represents inline content within a documentation block.
InlineContent is a format-agnostic representation of inline content such as text, code, links, and formatting. Instances nest recursively to represent formatting like bold text containing a link.
Each element is either a leaf (has text, no children) or a container (has children, no text). This invariant is enforced by Q_ASSERT in debug builds. Typically, content-bearing types such as Text, Code, and Image are leaves, while formatting types such as Bold, Italic, and Link are containers whose children carry the text.
The href and title fields are metadata that can be set on either leaf or container elements (e.g., Link uses href with children; Image uses href as a leaf).
This is a pure value type with no dependencies on QDoc's core infrastructure. It belongs in QDocLib.
Definition at line 49 of file contentblock.h.
|
nodiscard |
Returns the concatenated plain text of this inline element and all its children, recursively.
For leaf elements (Text, Code, Keyword, Target, Parameter, Image), returns the text field. For LineBreak, returns a newline character. For container elements (Bold, Italic, Link, etc.), concatenates the plain text of all children.
Definition at line 225 of file contentblock.cpp.
|
nodiscard |
Converts the InlineContent to a QJsonObject for template rendering.
The JSON uses kebab-case type IDs matching the convention in IR::Document classification. Every element includes a text key: leaf elements use their text field directly, while container elements produce a flattened plain-text concatenation of their children. This ensures templates can always access text without checking whether the element is a leaf or container.
Optional fields (href, title) are omitted when empty. The children array is omitted when empty.
Definition at line 192 of file contentblock.cpp.
| QJsonObject IR::InlineContent::attributes |
Type-specific metadata.
Definition at line 56 of file contentblock.h.
| QList<InlineContent> IR::InlineContent::children |
Nested inline content.
Definition at line 55 of file contentblock.h.
| QString IR::InlineContent::href |
Link target or image source.
Definition at line 53 of file contentblock.h.
| std::optional<LinkData> IR::InlineContent::link |
Definition at line 62 of file contentblock.h.
| QString IR::InlineContent::text |
Text content.
Definition at line 52 of file contentblock.h.
| QString IR::InlineContent::title |
Link tooltip or image alt text.
Definition at line 54 of file contentblock.h.
| InlineType IR::InlineContent::type { InlineType::Text } |
Definition at line 51 of file contentblock.h.