Skip to content
Permalink
Browse files

Expose some more classes to Python, but mark as unstable API

  • Loading branch information
nyalldawson committed May 11, 2020
1 parent 0e13999 commit cb1e8445d3b5895dbff9e2c4df881b17addae0b6
@@ -0,0 +1,7 @@
# The following has been generated automatically from src/core/textrenderer/qgstextcharacterformat.h
# monkey patching scoped based enum
QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ = "Property is not set"
QgsTextCharacterFormat.BooleanValue.True.__doc__ = "Property is set and ``True``"
QgsTextCharacterFormat.BooleanValue.False.__doc__ = "Property is set and ``False``"
QgsTextCharacterFormat.BooleanValue.__doc__ = 'Status values for boolean format properties\n\n' + '* ``NotSet``: ' + QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ + '\n' + '* ``True``: ' + QgsTextCharacterFormat.BooleanValue.True.__doc__ + '\n' + '* ``False``: ' + QgsTextCharacterFormat.BooleanValue.False.__doc__
# --
@@ -0,0 +1,122 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgstextcharacterformat.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsTextCharacterFormat
{
%Docstring
Stores information relating to individual character formatting.

These options encapsulate formatting options which override the default
settings from a QgsTextFormat for individual characters (or sets of characters).

.. warning::

This API is not considered stable and may change in future QGIS versions.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstextcharacterformat.h"
%End
public:

QgsTextCharacterFormat();

QgsTextCharacterFormat( const QTextCharFormat &format );
%Docstring
Constructor for QgsTextCharacterFormat, based on the specified QTextCharFormat ``format``.
%End

enum class BooleanValue
{
NotSet,
True,
False,
};

QColor textColor() const;
%Docstring
Returns the character's text color, or an invalid color if no color override
is set and the default format color should be used.

.. seealso:: :py:func:`setTextColor`
%End

void setTextColor( const QColor &textColor );
%Docstring
Sets the character's text ``color``.

Set ``color`` to an invalid color if no color override
is desired and the default format color should be used.

.. seealso:: :py:func:`textColor`
%End


BooleanValue strikeOut() const;
%Docstring
Returns whether the format has strikethrough enabled.

.. seealso:: :py:func:`setStrikeOut`
%End

void setStrikeOut( BooleanValue enabled );
%Docstring
Sets whether the format has strikethrough ``enabled``.

.. seealso:: :py:func:`strikeOut`
%End

BooleanValue underline() const;
%Docstring
Returns whether the format has underline enabled.

.. seealso:: :py:func:`setUnderline`
%End

void setUnderline( BooleanValue enabled );
%Docstring
Sets whether the format has underline ``enabled``.

.. seealso:: :py:func:`underline`
%End

BooleanValue overline() const;
%Docstring
Returns whether the format has overline enabled.

.. seealso:: :py:func:`setUnderline`
%End

void setOverline( BooleanValue enabled );
%Docstring
Sets whether the format has overline ``enabled``.

.. seealso:: :py:func:`overline`
%End

void updateFontForFormat( QFont &font ) const;
%Docstring
Updates the specified ``font`` in place, applying character formatting options which
are applicable on a font level.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgstextcharacterformat.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,84 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgstextfragment.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsTextFragment
{
%Docstring
Stores a fragment of text along with formatting overrides to be used when rendering the fragment.

.. 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, 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

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

double horizontalAdvance( const QFont &font, bool fontHasBeenUpdatedForFragment = false ) const;
%Docstring
Returns the horizontal advance associated with this fragment, when rendered using
the specified base ``font``.

Set ``fontHasBeenUpdatedForFragment`` to ``True`` if ``font`` already represents the character
format for this fragment.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgstextfragment.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -548,8 +548,10 @@
%Include auto_generated/textrenderer/qgstextbackgroundsettings.sip
%Include auto_generated/textrenderer/qgstextblock.sip
%Include auto_generated/textrenderer/qgstextbuffersettings.sip
%Include auto_generated/textrenderer/qgstextcharacterformat.sip
%Include auto_generated/textrenderer/qgstextdocument.sip
%Include auto_generated/textrenderer/qgstextformat.sip
%Include auto_generated/textrenderer/qgstextfragment.sip
%Include auto_generated/textrenderer/qgstextmasksettings.sip
%Include auto_generated/textrenderer/qgstextrenderer.sip
%Include auto_generated/textrenderer/qgstextrendererutils.sip
@@ -24,8 +24,6 @@

class QTextCharFormat;

#define SIP_NO_FILE

/**
* \class QgsTextCharacterFormat
* \ingroup core
@@ -34,6 +32,8 @@ class QTextCharFormat;
* These options encapsulate formatting options which override the default
* settings from a QgsTextFormat for individual characters (or sets of characters).
*
* \warning This API is not considered stable and may change in future QGIS versions.
*
* \since QGIS 3.14
*/
class CORE_EXPORT QgsTextCharacterFormat
@@ -22,13 +22,13 @@

class QTextFragment;

#define SIP_NO_FILE

/**
* \class QgsTextFragment
* \ingroup core
* Stores a fragment of text along with formatting overrides to be used when rendering the fragment.
*
* \warning This API is not considered stable and may change in future QGIS versions.
*
* \since QGIS 3.14
*/
class CORE_EXPORT QgsTextFragment

0 comments on commit cb1e844

Please sign in to comment.
You can’t perform that action at this time.