mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
Modifies the QgsTextDocument API to extract images from HTML content, and store in the associated QgsTextFragment/QgsTextCharacterFormat objects
125 lines
4.1 KiB
Plaintext
125 lines
4.1 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextfragment.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
class QgsTextFragment
|
|
{
|
|
%Docstring(signature="appended")
|
|
Stores a fragment of document along with formatting overrides to be used when rendering the fragment.
|
|
|
|
Text fragments consist of either a block of text or another atomic component of a document (such as an image).
|
|
|
|
Each fragment has an associated :py:func:`~characterFormat`, which specifies the text formatting overrides
|
|
to use when rendering the fragment. Additionally, the :py:func:`~characterFormat` may contain properties
|
|
for other fragment types, such as image paths and sizes for image fragments.
|
|
|
|
.. warning::
|
|
|
|
This API is not considered stable and may change in future QGIS versions.
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgstextfragment.h"
|
|
%End
|
|
public:
|
|
|
|
explicit QgsTextFragment( const QString &text = QString(), const QgsTextCharacterFormat &format = QgsTextCharacterFormat() );
|
|
%Docstring
|
|
Constructor for QgsTextFragment, with the specified ``text`` and optional character ``format``.
|
|
%End
|
|
|
|
explicit QgsTextFragment( const QTextFragment &fragment );
|
|
%Docstring
|
|
Constructor for QgsTextFragment, based on the specified QTextFragment ``fragment``.
|
|
%End
|
|
|
|
QString text() const;
|
|
%Docstring
|
|
Returns the text content of the fragment.
|
|
|
|
.. seealso:: :py:func:`setText`
|
|
%End
|
|
|
|
void setText( const QString &text );
|
|
%Docstring
|
|
Sets the ``text`` content of the fragment.
|
|
|
|
.. seealso:: :py:func:`text`
|
|
%End
|
|
|
|
bool isTab() const;
|
|
%Docstring
|
|
Returns ``True`` if the fragment consists of just a tab character.
|
|
|
|
.. versionadded:: 3.38
|
|
%End
|
|
|
|
bool isWhitespace() const;
|
|
%Docstring
|
|
Returns ``True`` if the fragment consists of just whitespace characters, and does not
|
|
contain any content to render.
|
|
|
|
.. versionadded:: 3.38
|
|
%End
|
|
|
|
const QgsTextCharacterFormat &characterFormat() const;
|
|
%Docstring
|
|
Returns the character formatting for the fragment.
|
|
|
|
.. seealso:: :py:func:`setCharacterFormat`
|
|
%End
|
|
|
|
void setCharacterFormat( const QgsTextCharacterFormat &format );
|
|
%Docstring
|
|
Sets the character ``format`` for the fragment.
|
|
|
|
.. seealso:: :py:func:`characterFormat`
|
|
%End
|
|
|
|
bool isImage() const;
|
|
%Docstring
|
|
Returns ``True`` if the fragment represents an image.
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
double horizontalAdvance( const QFont &font, const QgsRenderContext &context, bool fontHasBeenUpdatedForFragment = false, double scaleFactor = 1.0 ) const;
|
|
%Docstring
|
|
Returns the horizontal advance associated with this fragment, when rendered using
|
|
the specified base ``font`` within the specified render ``context``.
|
|
|
|
Set ``fontHasBeenUpdatedForFragment`` to ``True`` if ``font`` already represents the character
|
|
format for this fragment.
|
|
|
|
The optional ``scaleFactor`` parameter can specify a font size scaling factor. It is recommended to set this to
|
|
:py:func:`QgsTextRenderer.calculateScaleFactorForFormat()` and then manually calculations
|
|
based on the resultant font metrics. Failure to do so will result in poor quality text rendering
|
|
at small font sizes.
|
|
%End
|
|
|
|
void applyCapitalization( Qgis::Capitalization capitalization );
|
|
%Docstring
|
|
Applies a ``capitalization`` style to the fragment's text.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextfragment.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|