Skip to content

Commit cb1e844

Browse files
committedMay 12, 2020
Expose some more classes to Python, but mark as unstable API
1 parent 0e13999 commit cb1e844

File tree

6 files changed

+219
-4
lines changed

6 files changed

+219
-4
lines changed
 
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The following has been generated automatically from src/core/textrenderer/qgstextcharacterformat.h
2+
# monkey patching scoped based enum
3+
QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ = "Property is not set"
4+
QgsTextCharacterFormat.BooleanValue.True.__doc__ = "Property is set and ``True``"
5+
QgsTextCharacterFormat.BooleanValue.False.__doc__ = "Property is set and ``False``"
6+
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__
7+
# --
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/textrenderer/qgstextcharacterformat.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
class QgsTextCharacterFormat
14+
{
15+
%Docstring
16+
Stores information relating to individual character formatting.
17+
18+
These options encapsulate formatting options which override the default
19+
settings from a QgsTextFormat for individual characters (or sets of characters).
20+
21+
.. warning::
22+
23+
This API is not considered stable and may change in future QGIS versions.
24+
25+
.. versionadded:: 3.14
26+
%End
27+
28+
%TypeHeaderCode
29+
#include "qgstextcharacterformat.h"
30+
%End
31+
public:
32+
33+
QgsTextCharacterFormat();
34+
35+
QgsTextCharacterFormat( const QTextCharFormat &format );
36+
%Docstring
37+
Constructor for QgsTextCharacterFormat, based on the specified QTextCharFormat ``format``.
38+
%End
39+
40+
enum class BooleanValue
41+
{
42+
NotSet,
43+
True,
44+
False,
45+
};
46+
47+
QColor textColor() const;
48+
%Docstring
49+
Returns the character's text color, or an invalid color if no color override
50+
is set and the default format color should be used.
51+
52+
.. seealso:: :py:func:`setTextColor`
53+
%End
54+
55+
void setTextColor( const QColor &textColor );
56+
%Docstring
57+
Sets the character's text ``color``.
58+
59+
Set ``color`` to an invalid color if no color override
60+
is desired and the default format color should be used.
61+
62+
.. seealso:: :py:func:`textColor`
63+
%End
64+
65+
66+
BooleanValue strikeOut() const;
67+
%Docstring
68+
Returns whether the format has strikethrough enabled.
69+
70+
.. seealso:: :py:func:`setStrikeOut`
71+
%End
72+
73+
void setStrikeOut( BooleanValue enabled );
74+
%Docstring
75+
Sets whether the format has strikethrough ``enabled``.
76+
77+
.. seealso:: :py:func:`strikeOut`
78+
%End
79+
80+
BooleanValue underline() const;
81+
%Docstring
82+
Returns whether the format has underline enabled.
83+
84+
.. seealso:: :py:func:`setUnderline`
85+
%End
86+
87+
void setUnderline( BooleanValue enabled );
88+
%Docstring
89+
Sets whether the format has underline ``enabled``.
90+
91+
.. seealso:: :py:func:`underline`
92+
%End
93+
94+
BooleanValue overline() const;
95+
%Docstring
96+
Returns whether the format has overline enabled.
97+
98+
.. seealso:: :py:func:`setUnderline`
99+
%End
100+
101+
void setOverline( BooleanValue enabled );
102+
%Docstring
103+
Sets whether the format has overline ``enabled``.
104+
105+
.. seealso:: :py:func:`overline`
106+
%End
107+
108+
void updateFontForFormat( QFont &font ) const;
109+
%Docstring
110+
Updates the specified ``font`` in place, applying character formatting options which
111+
are applicable on a font level.
112+
%End
113+
114+
};
115+
116+
/************************************************************************
117+
* This file has been generated automatically from *
118+
* *
119+
* src/core/textrenderer/qgstextcharacterformat.h *
120+
* *
121+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
122+
************************************************************************/
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/textrenderer/qgstextfragment.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsTextFragment
13+
{
14+
%Docstring
15+
Stores a fragment of text along with formatting overrides to be used when rendering the fragment.
16+
17+
.. warning::
18+
19+
This API is not considered stable and may change in future QGIS versions.
20+
21+
.. versionadded:: 3.14
22+
%End
23+
24+
%TypeHeaderCode
25+
#include "qgstextfragment.h"
26+
%End
27+
public:
28+
29+
explicit QgsTextFragment( const QString &text, const QgsTextCharacterFormat &format = QgsTextCharacterFormat() );
30+
%Docstring
31+
Constructor for QgsTextFragment, with the specified ``text`` and optional character ``format``.
32+
%End
33+
34+
explicit QgsTextFragment( const QTextFragment &fragment );
35+
%Docstring
36+
Constructor for QgsTextFragment, based on the specified QTextFragment ``fragment``.
37+
%End
38+
39+
QString text() const;
40+
%Docstring
41+
Returns the text content of the fragment.
42+
43+
.. seealso:: :py:func:`setText`
44+
%End
45+
46+
void setText( const QString &text );
47+
%Docstring
48+
Sets the ``text`` content of the fragment.
49+
50+
.. seealso:: :py:func:`text`
51+
%End
52+
53+
const QgsTextCharacterFormat &characterFormat() const;
54+
%Docstring
55+
Returns the character formatting for the fragment.
56+
57+
.. seealso:: :py:func:`setCharacterFormat`
58+
%End
59+
60+
void setCharacterFormat( const QgsTextCharacterFormat &format );
61+
%Docstring
62+
Sets the character ``format`` for the fragment.
63+
64+
.. seealso:: :py:func:`characterFormat`
65+
%End
66+
67+
double horizontalAdvance( const QFont &font, bool fontHasBeenUpdatedForFragment = false ) const;
68+
%Docstring
69+
Returns the horizontal advance associated with this fragment, when rendered using
70+
the specified base ``font``.
71+
72+
Set ``fontHasBeenUpdatedForFragment`` to ``True`` if ``font`` already represents the character
73+
format for this fragment.
74+
%End
75+
76+
};
77+
78+
/************************************************************************
79+
* This file has been generated automatically from *
80+
* *
81+
* src/core/textrenderer/qgstextfragment.h *
82+
* *
83+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
84+
************************************************************************/

‎python/core/core_auto.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,10 @@
548548
%Include auto_generated/textrenderer/qgstextbackgroundsettings.sip
549549
%Include auto_generated/textrenderer/qgstextblock.sip
550550
%Include auto_generated/textrenderer/qgstextbuffersettings.sip
551+
%Include auto_generated/textrenderer/qgstextcharacterformat.sip
551552
%Include auto_generated/textrenderer/qgstextdocument.sip
552553
%Include auto_generated/textrenderer/qgstextformat.sip
554+
%Include auto_generated/textrenderer/qgstextfragment.sip
553555
%Include auto_generated/textrenderer/qgstextmasksettings.sip
554556
%Include auto_generated/textrenderer/qgstextrenderer.sip
555557
%Include auto_generated/textrenderer/qgstextrendererutils.sip

‎src/core/textrenderer/qgstextcharacterformat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
class QTextCharFormat;
2626

27-
#define SIP_NO_FILE
28-
2927
/**
3028
* \class QgsTextCharacterFormat
3129
* \ingroup core
@@ -34,6 +32,8 @@ class QTextCharFormat;
3432
* These options encapsulate formatting options which override the default
3533
* settings from a QgsTextFormat for individual characters (or sets of characters).
3634
*
35+
* \warning This API is not considered stable and may change in future QGIS versions.
36+
*
3737
* \since QGIS 3.14
3838
*/
3939
class CORE_EXPORT QgsTextCharacterFormat

‎src/core/textrenderer/qgstextfragment.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
class QTextFragment;
2424

25-
#define SIP_NO_FILE
26-
2725
/**
2826
* \class QgsTextFragment
2927
* \ingroup core
3028
* Stores a fragment of text along with formatting overrides to be used when rendering the fragment.
3129
*
30+
* \warning This API is not considered stable and may change in future QGIS versions.
31+
*
3232
* \since QGIS 3.14
3333
*/
3434
class CORE_EXPORT QgsTextFragment

0 commit comments

Comments
 (0)
Please sign in to comment.