104 if ( a0 < 0 || a0 > sipCpp->size() )
106 PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
111 sipCpp->insert( a0, *a1 );
121 void insert(
int index, QgsTextFragment &&fragment )
SIP_SKIP;
168 bool hasBackgrounds()
const;
173 sipRes = sipCpp->size();
192 if ( a0 < 0 || a0 >= sipCpp->size() )
194 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
199 sipRes =
new QgsTextFragment( sipCpp->at( a0 ) );
207 QgsTextFragment &operator[](
int index )
SIP_FACTORY;
210 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->size() );
214 sipRes =
new QgsTextFragment( sipCpp->operator[]( idx ) );
220 QVector< QgsTextFragment >::const_iterator begin()
const;
221 QVector< QgsTextFragment >::const_iterator end()
const;
227 QVector< QgsTextFragment > mFragments;
228 QgsTextBlockFormat mBlockFormat;
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.
const QgsTextBlockFormat & blockFormat() const
Returns the block formatting for the fragment.
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 append(const QgsTextFragment &fragment)
Appends a fragment to the block.
Stores a fragment of document along with formatting overrides to be used when rendering the fragment.