1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
/************************************************************************
* 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
Py_ssize_t __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
Py_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 *
************************************************************************/
|