Represents a block of text consisting of one or more QgsTextFragment objects.
int size() const
Returns the number of fragments in the block.
void applyCapitalization(Qgis::Capitalization capitalization)
Applies a capitalization style to the block's text.
void insert(int index, const QgsTextFragment &fragment)
Inserts a fragment into the block, at the specified index.
QString toPlainText() const
Converts the block to plain text.
QgsTextFragment & operator[](int index)
Returns the fragment at the specified index.
void clear()
Clears the block, removing all its contents.
static QgsTextBlock fromPlainText(const QString &text, const QgsTextCharacterFormat &format=QgsTextCharacterFormat())
Constructor for QgsTextBlock consisting of a plain text, and optional character format.
QgsTextBlock()=default
Constructor for an empty text block.
void reserve(int count)
Reserves the specified count of fragments for optimised fragment appending.
void setBlockFormat(const QgsTextBlockFormat &format)
Sets the block format for the fragment.
void append(const QgsTextFragment &fragment)
Appends a fragment to the block.
const QgsTextFragment & at(int index) const
Returns the fragment at the specified index.
bool empty() const
Returns true if the block is empty.
Stores a fragment of document along with formatting overrides to be used when rendering the fragment.