QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Represents a block of text consisting of one or more QgsTextFragment objects. More...
#include <qgstextblock.h>
Public Member Functions | |
QgsTextBlock ()=default | |
Constructor for an empty text block. | |
QgsTextBlock (const QgsTextFragment &fragment) | |
Constructor for a QgsTextBlock consisting of a single text fragment. | |
void | append (const QgsTextFragment &fragment) |
Appends a fragment to the block. | |
void | append (QgsTextFragment &&fragment) |
Appends a fragment to the block. | |
void | applyCapitalization (Qgis::Capitalization capitalization) |
Applies a capitalization style to the block's text. | |
const QgsTextFragment & | at (int index) const |
Returns the fragment at the specified index. | |
const QgsTextBlockFormat & | blockFormat () const |
Returns the block formatting for the fragment. | |
void | clear () |
Clears the block, removing all its contents. | |
bool | empty () const |
Returns true if the block is empty. | |
void | insert (int index, const QgsTextFragment &fragment) |
Inserts a fragment into the block, at the specified index. | |
void | insert (int index, QgsTextFragment &&fragment) |
Inserts a fragment into the block, at the specified index. | |
QgsTextFragment & | operator[] (int index) |
Returns the fragment at the specified index. | |
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. | |
int | size () const |
Returns the number of fragments in the block. | |
QString | toPlainText () const |
Converts the block to plain text. | |
Static Public Member Functions | |
static QgsTextBlock | fromPlainText (const QString &text, const QgsTextCharacterFormat &format=QgsTextCharacterFormat()) |
Constructor for QgsTextBlock consisting of a plain text, and optional character format. | |
Represents a block of text consisting of one or more QgsTextFragment objects.
Definition at line 36 of file qgstextblock.h.
|
default |
Constructor for an empty text block.
|
explicit |
Constructor for a QgsTextBlock consisting of a single text fragment.
Definition at line 21 of file qgstextblock.cpp.
void QgsTextBlock::append | ( | const QgsTextFragment & | fragment | ) |
Appends a fragment to the block.
Definition at line 69 of file qgstextblock.cpp.
void QgsTextBlock::append | ( | QgsTextFragment && | fragment | ) |
Appends a fragment to the block.
Definition at line 74 of file qgstextblock.cpp.
void QgsTextBlock::applyCapitalization | ( | Qgis::Capitalization | capitalization | ) |
Applies a capitalization style to the block's text.
Definition at line 109 of file qgstextblock.cpp.
const QgsTextFragment & QgsTextBlock::at | ( | int | index | ) | const |
Returns the fragment at the specified index.
Definition at line 117 of file qgstextblock.cpp.
|
inline |
Returns the block formatting for the fragment.
Definition at line 144 of file qgstextblock.h.
void QgsTextBlock::clear | ( | ) |
Clears the block, removing all its contents.
Definition at line 89 of file qgstextblock.cpp.
bool QgsTextBlock::empty | ( | ) | const |
Returns true
if the block is empty.
Definition at line 94 of file qgstextblock.cpp.
|
static |
Constructor for QgsTextBlock consisting of a plain text, and optional character format.
If text contains tab characters they will be appended as separate text fragments within the block, consisting of just the tab character.
Definition at line 26 of file qgstextblock.cpp.
void QgsTextBlock::insert | ( | int | index, |
const QgsTextFragment & | fragment | ||
) |
Inserts a fragment into the block, at the specified index.
Definition at line 79 of file qgstextblock.cpp.
void QgsTextBlock::insert | ( | int | index, |
QgsTextFragment && | fragment | ||
) |
Inserts a fragment into the block, at the specified index.
Definition at line 84 of file qgstextblock.cpp.
QgsTextFragment & QgsTextBlock::operator[] | ( | int | index | ) |
Returns the fragment at the specified index.
Definition at line 122 of file qgstextblock.cpp.
void QgsTextBlock::reserve | ( | int | count | ) |
Reserves the specified count of fragments for optimised fragment appending.
Definition at line 64 of file qgstextblock.cpp.
void QgsTextBlock::setBlockFormat | ( | const QgsTextBlockFormat & | format | ) |
Sets the block format for the fragment.
Definition at line 104 of file qgstextblock.cpp.
int QgsTextBlock::size | ( | ) | const |
Returns the number of fragments in the block.
Definition at line 99 of file qgstextblock.cpp.
QString QgsTextBlock::toPlainText | ( | ) | const |