QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Member Functions | List of all members
QgsTextBlock Class Reference

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. More...
 
 QgsTextBlock (const QgsTextFragment &fragment)
 Constructor for a QgsTextBlock consisting of a single text fragment. More...
 
void append (const QgsTextFragment &fragment)
 Appends a fragment to the block. More...
 
void append (QgsTextFragment &&fragment)
 Appends a fragment to the block. More...
 
void applyCapitalization (QgsStringUtils::Capitalization capitalization)
 Applies a capitalization style to the block's text. More...
 
const QgsTextFragmentat (int index) const
 Returns the fragment at the specified index. More...
 
void clear ()
 Clears the block, removing all its contents. More...
 
bool empty () const
 Returns true if the block is empty. More...
 
QgsTextFragmentoperator[] (int index)
 Returns the fragment at the specified index. More...
 
int size () const
 Returns the number of fragments in the block. More...
 
QString toPlainText () const
 Converts the block to plain text. More...
 

Detailed Description

Represents a block of text consisting of one or more QgsTextFragment objects.

Warning
This API is not considered stable and may change in future QGIS versions.
Since
QGIS 3.14

Definition at line 35 of file qgstextblock.h.

Constructor & Destructor Documentation

◆ QgsTextBlock() [1/2]

QgsTextBlock::QgsTextBlock ( )
default

Constructor for an empty text block.

◆ QgsTextBlock() [2/2]

QgsTextBlock::QgsTextBlock ( const QgsTextFragment fragment)
explicit

Constructor for a QgsTextBlock consisting of a single text fragment.

Definition at line 19 of file qgstextblock.cpp.

Member Function Documentation

◆ append() [1/2]

void QgsTextBlock::append ( const QgsTextFragment fragment)

Appends a fragment to the block.

Definition at line 34 of file qgstextblock.cpp.

◆ append() [2/2]

void QgsTextBlock::append ( QgsTextFragment &&  fragment)

Appends a fragment to the block.

Definition at line 39 of file qgstextblock.cpp.

◆ applyCapitalization()

void QgsTextBlock::applyCapitalization ( QgsStringUtils::Capitalization  capitalization)

Applies a capitalization style to the block's text.

Since
QGIS 3.16

Definition at line 59 of file qgstextblock.cpp.

◆ at()

const QgsTextFragment & QgsTextBlock::at ( int  index) const

Returns the fragment at the specified index.

Definition at line 67 of file qgstextblock.cpp.

◆ clear()

void QgsTextBlock::clear ( )

Clears the block, removing all its contents.

Definition at line 44 of file qgstextblock.cpp.

◆ empty()

bool QgsTextBlock::empty ( ) const

Returns true if the block is empty.

Definition at line 49 of file qgstextblock.cpp.

◆ operator[]()

QgsTextFragment & QgsTextBlock::operator[] ( int  index)

Returns the fragment at the specified index.

Definition at line 72 of file qgstextblock.cpp.

◆ size()

int QgsTextBlock::size ( ) const

Returns the number of fragments in the block.

Definition at line 54 of file qgstextblock.cpp.

◆ toPlainText()

QString QgsTextBlock::toPlainText ( ) const

Converts the block to plain text.

Since
QGIS 3.16

Definition at line 24 of file qgstextblock.cpp.


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