-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
89c27fe
commit ce8ce0a
Showing
23 changed files
with
650 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# The following has been generated automatically from src/core/textrenderer/qgstextblockformat.h | ||
# monkey patching scoped based enum | ||
QgsTextBlockFormat.BooleanValue.NotSet.__doc__ = "Property is not set" | ||
QgsTextBlockFormat.BooleanValue.SetTrue.__doc__ = "Property is set and ``True``" | ||
QgsTextBlockFormat.BooleanValue.SetFalse.__doc__ = "Property is set and ``False``" | ||
QgsTextBlockFormat.BooleanValue.__doc__ = """Status values for boolean format properties | ||
* ``NotSet``: Property is not set | ||
* ``SetTrue``: Property is set and ``True`` | ||
* ``SetFalse``: Property is set and ``False`` | ||
""" | ||
# -- | ||
try: | ||
QgsTextBlockFormat.__group__ = ['textrenderer'] | ||
except NameError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
python/PyQt6/core/auto_generated/textrenderer/qgstextblockformat.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/************************************************************************ | ||
* 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 | ||
|
||
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 * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# The following has been generated automatically from src/core/textrenderer/qgstextblockformat.h | ||
# monkey patching scoped based enum | ||
QgsTextBlockFormat.BooleanValue.NotSet.__doc__ = "Property is not set" | ||
QgsTextBlockFormat.BooleanValue.SetTrue.__doc__ = "Property is set and ``True``" | ||
QgsTextBlockFormat.BooleanValue.SetFalse.__doc__ = "Property is set and ``False``" | ||
QgsTextBlockFormat.BooleanValue.__doc__ = """Status values for boolean format properties | ||
* ``NotSet``: Property is not set | ||
* ``SetTrue``: Property is set and ``True`` | ||
* ``SetFalse``: Property is set and ``False`` | ||
""" | ||
# -- | ||
try: | ||
QgsTextBlockFormat.__group__ = ['textrenderer'] | ||
except NameError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
python/core/auto_generated/textrenderer/qgstextblockformat.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/************************************************************************ | ||
* 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 | ||
|
||
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 * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.