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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgstextblockformat.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsTextBlockFormat
{
%Docstring(signature="appended")
Stores information relating to individual block formatting.
These options encapsulate formatting options which override the default
settings from a :py:class:`QgsTextFormat` for individual text blocks.
.. warning::
This API is not considered stable and may change in future QGIS versions.
.. versionadded:: 3.40
%End
%TypeHeaderCode
#include "qgstextblockformat.h"
%End
public:
QgsTextBlockFormat();
QgsTextBlockFormat( const QTextBlockFormat &format );
%Docstring
Constructor for QgsTextBlockFormat, based on the specified
QTextBlockFormat ``format``.
%End
enum class BooleanValue
{
NotSet,
SetTrue,
SetFalse,
};
void overrideWith( const QgsTextBlockFormat &other );
%Docstring
Override all the default/unset properties of the current block format
with the settings from another format.
This will replace any default/unset existing settings with the settings
from ``other``.
Any settings which are default/unset in ``other`` will be left
unchanged.
:param other: The format to override with.
%End
bool hasHorizontalAlignmentSet() const;
%Docstring
Returns ``True`` if the format has an explicit horizontal alignment set.
If ``False`` is returned then the horizontal alignment will be
inherited.
.. seealso:: :py:func:`setHasHorizontalAlignmentSet`
.. seealso:: :py:func:`horizontalAlignment`
%End
void setHasHorizontalAlignmentSet( bool set );
%Docstring
Sets whether the format has an explicit horizontal alignment ``set``.
If ``set`` is ``False`` then the horizontal alignment will be inherited.
.. seealso:: :py:func:`hasHorizontalAlignmentSet`
.. seealso:: :py:func:`setHorizontalAlignment`
%End
Qgis::TextHorizontalAlignment horizontalAlignment() const;
%Docstring
Returns the format horizontal alignment.
This property is only respected if
:py:func:`~QgsTextBlockFormat.hasHorizontalAlignmentSet` is ``True``.
.. seealso:: :py:func:`hasHorizontalAlignmentSet`
.. seealso:: :py:func:`setHorizontalAlignment`
%End
void setHorizontalAlignment( Qgis::TextHorizontalAlignment alignment );
%Docstring
Sets the format horizontal ``alignment``.
This property is only respected if
:py:func:`~QgsTextBlockFormat.hasHorizontalAlignmentSet` is ``True``.
.. seealso:: :py:func:`hasHorizontalAlignmentSet`
.. seealso:: :py:func:`horizontalAlignment`
%End
double lineHeight() const;
%Docstring
Returns the line height in points, or NaN if the line height is not set
and should be auto calculated.
.. note::
A format should have either :py:func:`~QgsTextBlockFormat.lineHeight` or :py:func:`~QgsTextBlockFormat.lineHeightPercentage` set, not both.
.. seealso:: :py:func:`lineHeightPercentage`
.. seealso:: :py:func:`setLineHeight`
.. versionadded:: 3.42
%End
void setLineHeight( double height );
%Docstring
Sets the font line ``height``, in points.
Set ``height`` to NaN if the line height is not set and should be auto
calculated.
.. note::
A format should have either :py:func:`~QgsTextBlockFormat.lineHeight` or :py:func:`~QgsTextBlockFormat.lineHeightPercentage` set, not both.
.. seealso:: :py:func:`lineHeight`
.. seealso:: :py:func:`setLineHeightPercentage`
.. versionadded:: 3.42
%End
double lineHeightPercentage() const;
%Docstring
Returns the line height percentage size (as fraction of font size from
0.0 to 1.0), or NaN if the line height percentage is not set.
.. note::
A format should have either :py:func:`~QgsTextBlockFormat.lineHeight` or :py:func:`~QgsTextBlockFormat.lineHeightPercentage` set, not both.
.. seealso:: :py:func:`lineHeight`
.. seealso:: :py:func:`setLineHeightPercentage`
.. versionadded:: 3.42
%End
void setLineHeightPercentage( double height );
%Docstring
Sets the line height percentage ``height`` (as fraction of font size
from 0.0 to 1.0).
Set ``height`` to NaN if the line height percentange is not set.
.. note::
A format should have either :py:func:`~QgsTextBlockFormat.lineHeight` or :py:func:`~QgsTextBlockFormat.lineHeightPercentage` set, not both.
.. seealso:: :py:func:`lineHeightPercentage`
.. seealso:: :py:func:`setLineHeight`
.. versionadded:: 3.42
%End
QgsMargins margins() const;
%Docstring
Returns the block margins, in points.
.. seealso:: :py:func:`setMargins`
.. versionadded:: 3.42
%End
void setMargins( const QgsMargins &margins );
%Docstring
Sets the block margins, in points.
.. seealso:: :py:func:`margins`
.. versionadded:: 3.42
%End
bool hasBackground() const;
%Docstring
Returns ``True`` if the block has a background set.
.. seealso:: :py:func:`backgroundBrush`
.. versionadded:: 3.42
%End
QBrush backgroundBrush() const;
%Docstring
Returns the brush used for rendering the background of the block.
Alternatively, the format may have a
:py:func:`~QgsTextBlockFormat.backgroundBrush` set.
.. seealso:: :py:func:`hasBackground`
.. seealso:: :py:func:`setBackgroundBrush`
.. versionadded:: 3.42
%End
void setBackgroundBrush( const QBrush &brush );
%Docstring
Sets the ``brush`` used for rendering the background of the block.
Alternatively, the format may have a
:py:func:`~QgsTextBlockFormat.backgroundBrush` set.
.. seealso:: :py:func:`backgroundBrush`
.. versionadded:: 3.42
%End
QString backgroundImagePath() const;
%Docstring
Returns the path for the image to be used for rendering the background
of the fragment.
Alternatively, the format may have a
:py:func:`~QgsTextBlockFormat.backgroundBrush` set.
.. seealso:: :py:func:`hasBackground`
.. seealso:: :py:func:`setBackgroundImagePath`
.. versionadded:: 3.42
%End
void setBackgroundImagePath( const QString &path );
%Docstring
Sets the ``path`` for the image to be used for rendering the background
of the fragment.
Alternatively, the format may have a
:py:func:`~QgsTextBlockFormat.backgroundBrush` set.
.. seealso:: :py:func:`backgroundImagePath`
.. versionadded:: 3.42
%End
void updateFontForFormat( QFont &font, const QgsRenderContext &context, double scaleFactor = 1.0 ) const;
%Docstring
Updates the specified ``font`` in place, applying block formatting
options which are applicable on a font level when rendered in the given
``context``.
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
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgstextblockformat.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|