Skip to content

Commit fe88324

Browse files
committed
QGIS Server - GetPrint request does not respect text boxes size and position if dynamic content passed
This commit brings some correction for the issue #7894 Firstly the use of adjustSizeToText has been inactivate Secondly if a composerLabel is not in the parameterMap the default value is conserved.
1 parent bf9b3e3 commit fe88324

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/app/composer/qgscomposerlabelwidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void QgsComposerLabelWidget::on_mHtmlCheckBox_stateChanged( int state )
6060

6161
mComposerLabel->beginCommand( tr( "Label text HTML state changed" ), QgsComposerMergeCommand::ComposerLabelSetText );
6262
mComposerLabel->blockSignals( true );
63-
mComposerLabel->setHtmlSate( state );
63+
mComposerLabel->setHtmlState( state );
6464
mComposerLabel->setText( mTextEdit->toPlainText() );
6565
mComposerLabel->update();
6666
mComposerLabel->blockSignals( false );
@@ -245,7 +245,7 @@ void QgsComposerLabelWidget::setGuiElementValues()
245245
mTextEdit->setPlainText( mComposerLabel->text() );
246246
mTextEdit->moveCursor( QTextCursor::End, QTextCursor::MoveAnchor );
247247
mMarginDoubleSpinBox->setValue( mComposerLabel->margin() );
248-
mHtmlCheckBox->setChecked( mComposerLabel->htmlSate() );
248+
mHtmlCheckBox->setChecked( mComposerLabel->htmlState() );
249249
mTopRadioButton->setChecked( mComposerLabel->vAlign() == Qt::AlignTop );
250250
mMiddleRadioButton->setChecked( mComposerLabel->vAlign() == Qt::AlignVCenter );
251251
mBottomRadioButton->setChecked( mComposerLabel->vAlign() == Qt::AlignBottom );

src/core/composer/qgscomposerlabel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class CORE_EXPORT QgsComposerLabel: public QgsComposerItem
4545
QString text() { return mText; }
4646
void setText( const QString& text );
4747

48-
int htmlSate() { return mHtmlState; }
49-
void setHtmlSate( int state ) {mHtmlState = state;}
48+
int htmlState() { return mHtmlState; }
49+
void setHtmlState( int state ) {mHtmlState = state;}
5050

5151
/**Returns the text as it appears on screen (with replaced data field)
5252
@note this function was added in version 1.2*/

src/mapserver/qgsconfigparser.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,9 @@ QgsComposition* QgsConfigParser::createPrintComposition( const QString& composer
534534

535535
if ( title.isEmpty() )
536536
{
537-
//remove exported labels not referenced in the request
538-
if ( !currentLabel->id().isEmpty() )
537+
//remove exported labels referenced in the request
538+
//but with empty string
539+
if ( parameterMap.contains( currentLabel->id().toUpper() ) )
539540
{
540541
c->removeItem( currentLabel );
541542
delete currentLabel;
@@ -544,7 +545,13 @@ QgsComposition* QgsConfigParser::createPrintComposition( const QString& composer
544545
}
545546

546547
currentLabel->setText( title );
547-
currentLabel->adjustSizeToText();
548+
/* the method adjustSizeToText has some rendering issue
549+
* for HTML or Simple String
550+
if ( !currentLabel->htmlState() )
551+
{
552+
currentLabel->adjustSizeToText();
553+
}
554+
*/
548555
}
549556

550557
return c;

0 commit comments

Comments
 (0)