mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
182 lines
4.4 KiB
Plaintext
182 lines
4.4 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextblock.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
class QgsTextBlock
|
|
{
|
|
%Docstring(signature="appended")
|
|
Represents a block of text consisting of one or more
|
|
:py:class:`QgsTextFragment` objects.
|
|
|
|
.. warning::
|
|
|
|
This API is not considered stable and may change in future QGIS versions.
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgstextblock.h"
|
|
%End
|
|
public:
|
|
|
|
QgsTextBlock();
|
|
%Docstring
|
|
Constructor for an empty text block.
|
|
%End
|
|
|
|
explicit QgsTextBlock( const QgsTextFragment &fragment );
|
|
%Docstring
|
|
Constructor for a QgsTextBlock consisting of a single text ``fragment``.
|
|
%End
|
|
|
|
static QgsTextBlock fromPlainText( const QString &text, const QgsTextCharacterFormat &format = QgsTextCharacterFormat() );
|
|
%Docstring
|
|
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.
|
|
|
|
.. versionadded:: 3.38
|
|
%End
|
|
|
|
QString toPlainText() const;
|
|
%Docstring
|
|
Converts the block to plain text.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
void reserve( int count );
|
|
%Docstring
|
|
Reserves the specified ``count`` of fragments for optimised fragment
|
|
appending.
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
void append( const QgsTextFragment &fragment );
|
|
%Docstring
|
|
Appends a ``fragment`` to the block.
|
|
%End
|
|
|
|
void insert( int index, const QgsTextFragment &fragment );
|
|
%Docstring
|
|
Inserts a ``fragment`` into the block, at the specified index.
|
|
|
|
:raises IndexError: if no fragment exists at the specified index.
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
%MethodCode
|
|
if ( a0 < 0 || a0 > sipCpp->size() )
|
|
{
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
sipIsErr = 1;
|
|
}
|
|
else
|
|
{
|
|
sipCpp->insert( a0, *a1 );
|
|
}
|
|
%End
|
|
|
|
|
|
void clear();
|
|
%Docstring
|
|
Clears the block, removing all its contents.
|
|
%End
|
|
|
|
bool empty() const;
|
|
%Docstring
|
|
Returns ``True`` if the block is empty.
|
|
%End
|
|
|
|
int size() const;
|
|
%Docstring
|
|
Returns the number of fragments in the block.
|
|
%End
|
|
|
|
const QgsTextBlockFormat &blockFormat() const;
|
|
%Docstring
|
|
Returns the block formatting for the fragment.
|
|
|
|
.. seealso:: :py:func:`setBlockFormat`
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
void setBlockFormat( const QgsTextBlockFormat &format );
|
|
%Docstring
|
|
Sets the block ``format`` for the fragment.
|
|
|
|
.. seealso:: :py:func:`blockFormat`
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
void applyCapitalization( Qgis::Capitalization capitalization );
|
|
%Docstring
|
|
Applies a ``capitalization`` style to the block's text.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
bool hasBackgrounds() const;
|
|
%Docstring
|
|
Returns ``True`` if the block or any of the fragments in the block have
|
|
background brushes set.
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
int __len__() const;
|
|
%MethodCode
|
|
sipRes = sipCpp->size();
|
|
%End
|
|
|
|
|
|
const QgsTextFragment &at( int index ) const /Factory/;
|
|
%Docstring
|
|
Returns the fragment at the specified ``index``.
|
|
|
|
:raises KeyError: if no fragment exists at the specified index.
|
|
%End
|
|
%MethodCode
|
|
if ( a0 < 0 || a0 >= sipCpp->size() )
|
|
{
|
|
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
|
|
sipIsErr = 1;
|
|
}
|
|
else
|
|
{
|
|
sipRes = new QgsTextFragment( sipCpp->at( a0 ) );
|
|
}
|
|
%End
|
|
|
|
QgsTextFragment &operator[]( int index ) /Factory/;
|
|
%MethodCode
|
|
SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->size() );
|
|
if ( idx < 0 )
|
|
sipIsErr = 1;
|
|
else
|
|
sipRes = new QgsTextFragment( sipCpp->operator[]( idx ) );
|
|
%End
|
|
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextblock.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|