From f4c0f4c4c108d8fcc7536e8aa38c69ac1758c917 Mon Sep 17 00:00:00 2001 From: VitorVieiraZ Date: Fri, 31 May 2024 19:19:00 -0300 Subject: [PATCH] in progress - solving map tip image bug --- app/attributes/attributepreviewcontroller.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/attributes/attributepreviewcontroller.cpp b/app/attributes/attributepreviewcontroller.cpp index 912a5f08b..f7e2a6656 100644 --- a/app/attributes/attributepreviewcontroller.cpp +++ b/app/attributes/attributepreviewcontroller.cpp @@ -115,16 +115,22 @@ QVector> AttributePreviewController::mapTipFields( ) return lst; } -QString AttributePreviewController::mapTipImage( ) +QString AttributePreviewController::mapTipImage() { QgsExpressionContext context( globalProjectLayerScopes( mFeatureLayerPair.layer() ) ); context.setFeature( mFeatureLayerPair.feature() ); QString mapTip = mFeatureLayerPair.layer()->mapTipTemplate(); QStringList lst = mapTip.split( '\n' ); // first line is "# image" + if ( lst.count() >= 2 ) - return QgsExpression::replaceExpressionText( lst[1], &context ); + { + QString expression = lst.mid( 1 ).join( '\n' ); + return QgsExpression::replaceExpressionText( expression, &context ); + } else + { return QString(); + } } QString AttributePreviewController::mapTipHtml( )