Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
QGIS Server - GetPrint request does not respect text boxes size and p…
…osition 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.
  • Loading branch information
rldhont committed Jun 3, 2013
1 parent bf9b3e3 commit fe88324
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposerlabelwidget.cpp
Expand Up @@ -60,7 +60,7 @@ void QgsComposerLabelWidget::on_mHtmlCheckBox_stateChanged( int state )

mComposerLabel->beginCommand( tr( "Label text HTML state changed" ), QgsComposerMergeCommand::ComposerLabelSetText );
mComposerLabel->blockSignals( true );
mComposerLabel->setHtmlSate( state );
mComposerLabel->setHtmlState( state );
mComposerLabel->setText( mTextEdit->toPlainText() );
mComposerLabel->update();
mComposerLabel->blockSignals( false );
Expand Down Expand Up @@ -245,7 +245,7 @@ void QgsComposerLabelWidget::setGuiElementValues()
mTextEdit->setPlainText( mComposerLabel->text() );
mTextEdit->moveCursor( QTextCursor::End, QTextCursor::MoveAnchor );
mMarginDoubleSpinBox->setValue( mComposerLabel->margin() );
mHtmlCheckBox->setChecked( mComposerLabel->htmlSate() );
mHtmlCheckBox->setChecked( mComposerLabel->htmlState() );
mTopRadioButton->setChecked( mComposerLabel->vAlign() == Qt::AlignTop );
mMiddleRadioButton->setChecked( mComposerLabel->vAlign() == Qt::AlignVCenter );
mBottomRadioButton->setChecked( mComposerLabel->vAlign() == Qt::AlignBottom );
Expand Down
4 changes: 2 additions & 2 deletions src/core/composer/qgscomposerlabel.h
Expand Up @@ -45,8 +45,8 @@ class CORE_EXPORT QgsComposerLabel: public QgsComposerItem
QString text() { return mText; }
void setText( const QString& text );

int htmlSate() { return mHtmlState; }
void setHtmlSate( int state ) {mHtmlState = state;}
int htmlState() { return mHtmlState; }
void setHtmlState( int state ) {mHtmlState = state;}

/**Returns the text as it appears on screen (with replaced data field)
@note this function was added in version 1.2*/
Expand Down
13 changes: 10 additions & 3 deletions src/mapserver/qgsconfigparser.cpp
Expand Up @@ -534,8 +534,9 @@ QgsComposition* QgsConfigParser::createPrintComposition( const QString& composer

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

currentLabel->setText( title );
currentLabel->adjustSizeToText();
/* the method adjustSizeToText has some rendering issue
* for HTML or Simple String
if ( !currentLabel->htmlState() )
{
currentLabel->adjustSizeToText();
}
*/
}

return c;
Expand Down

0 comments on commit fe88324

Please sign in to comment.