Nyall Dawson a492cb22fb [feature] Support horizontal alignment in HTML labels
For multi-line labels, this allows use of either:

- HTML <p align="xxx"> attributes
- CSS "text-align: xxx"
- HTML <center>some text</center> tags

Supported alignments are left, right, center and justify

Horizontal alignment can be used in all contexts where
HTML text is rendered, EXCEPT for curved labels (since they
are restricted to single-line text)

Sponsored by City of Freiburg im Breisgau
2024-09-16 17:26:24 +10:00

145 lines
3.7 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 append( const QgsTextFragment &fragment );
%Docstring
Appends a ``fragment`` to the block.
%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
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 *
************************************************************************/