From 18b36cb7294cde147120cd1a7f36debc62e42b99 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 2 Dec 2024 12:31:22 +1000 Subject: [PATCH] Expose mode --- .../core/auto_generated/textrenderer/qgstextrenderer.sip.in | 4 +++- .../core/auto_generated/textrenderer/qgstextrenderer.sip.in | 4 +++- src/core/textrenderer/qgstextrenderer.cpp | 4 ++-- src/core/textrenderer/qgstextrenderer.h | 4 +++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/python/PyQt6/core/auto_generated/textrenderer/qgstextrenderer.sip.in b/python/PyQt6/core/auto_generated/textrenderer/qgstextrenderer.sip.in index 06cf6668910e..5feee7fa898a 100644 --- a/python/PyQt6/core/auto_generated/textrenderer/qgstextrenderer.sip.in +++ b/python/PyQt6/core/auto_generated/textrenderer/qgstextrenderer.sip.in @@ -138,7 +138,8 @@ Draws text at a point origin using the specified settings. const QgsTextDocumentMetrics &metrics, QgsRenderContext &context, Qgis::TextHorizontalAlignment alignment, - double rotation ); + double rotation, + Qgis::TextLayoutMode mode = Qgis::TextLayoutMode::Point ); %Docstring Draws a text document at a point origin using the specified settings. @@ -157,6 +158,7 @@ been calculated. :param context: destination render context :param alignment: horizontal alignment :param rotation: text rotation +:param mode: optional layout mode (since QGIS 3.42) .. versionadded:: 3.40 %End diff --git a/python/core/auto_generated/textrenderer/qgstextrenderer.sip.in b/python/core/auto_generated/textrenderer/qgstextrenderer.sip.in index 06cf6668910e..5feee7fa898a 100644 --- a/python/core/auto_generated/textrenderer/qgstextrenderer.sip.in +++ b/python/core/auto_generated/textrenderer/qgstextrenderer.sip.in @@ -138,7 +138,8 @@ Draws text at a point origin using the specified settings. const QgsTextDocumentMetrics &metrics, QgsRenderContext &context, Qgis::TextHorizontalAlignment alignment, - double rotation ); + double rotation, + Qgis::TextLayoutMode mode = Qgis::TextLayoutMode::Point ); %Docstring Draws a text document at a point origin using the specified settings. @@ -157,6 +158,7 @@ been calculated. :param context: destination render context :param alignment: horizontal alignment :param rotation: text rotation +:param mode: optional layout mode (since QGIS 3.42) .. versionadded:: 3.40 %End diff --git a/src/core/textrenderer/qgstextrenderer.cpp b/src/core/textrenderer/qgstextrenderer.cpp index 70efc4f7d4e3..4b3612ec667d 100644 --- a/src/core/textrenderer/qgstextrenderer.cpp +++ b/src/core/textrenderer/qgstextrenderer.cpp @@ -130,7 +130,7 @@ void QgsTextRenderer::drawText( QPointF point, double rotation, Qgis::TextHorizo drawDocument( point, lFormat, metrics.document(), metrics, context, alignment, rotation ); } -void QgsTextRenderer::drawDocument( QPointF point, const QgsTextFormat &format, const QgsTextDocument &document, const QgsTextDocumentMetrics &metrics, QgsRenderContext &context, Qgis::TextHorizontalAlignment alignment, double rotation ) +void QgsTextRenderer::drawDocument(QPointF point, const QgsTextFormat &format, const QgsTextDocument &document, const QgsTextDocumentMetrics &metrics, QgsRenderContext &context, Qgis::TextHorizontalAlignment alignment, double rotation , Qgis::TextLayoutMode mode) { Qgis::TextComponents components = Qgis::TextComponent::Text; if ( format.background().enabled() ) @@ -148,7 +148,7 @@ void QgsTextRenderer::drawDocument( QPointF point, const QgsTextFormat &format, components |= Qgis::TextComponent::Buffer; } - drawParts( point, rotation, alignment, document, metrics, context, format, components, Qgis::TextLayoutMode::Point ); + drawParts( point, rotation, alignment, document, metrics, context, format, components, mode ); } void QgsTextRenderer::drawTextOnLine( const QPolygonF &line, const QString &text, QgsRenderContext &context, const QgsTextFormat &_format, double offsetAlongLine, double offsetFromLine ) diff --git a/src/core/textrenderer/qgstextrenderer.h b/src/core/textrenderer/qgstextrenderer.h index 6714431f8f07..5969c011aa01 100644 --- a/src/core/textrenderer/qgstextrenderer.h +++ b/src/core/textrenderer/qgstextrenderer.h @@ -160,6 +160,7 @@ class CORE_EXPORT QgsTextRenderer * \param context destination render context * \param alignment horizontal alignment * \param rotation text rotation + * \param mode optional layout mode (since QGIS 3.42) * * \since QGIS 3.40 */ @@ -169,7 +170,8 @@ class CORE_EXPORT QgsTextRenderer const QgsTextDocumentMetrics &metrics, QgsRenderContext &context, Qgis::TextHorizontalAlignment alignment, - double rotation ); + double rotation, + Qgis::TextLayoutMode mode = Qgis::TextLayoutMode::Point ); /** * Draws text along a line using the specified settings.