Pass untranslated scale bar stylename to QgsComposerScaleBar. Otherwise it is a problem if the translation is not consistent in QgsComposerScaleBarWidget and QgsComposerScaleBar

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9779 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2008-12-13 08:34:45 +00:00
parent 8d36542e9c
commit 2074c83c73
3 changed files with 38 additions and 9 deletions

View File

@ -282,7 +282,36 @@ void QgsComposerScaleBarWidget::on_mStyleComboBox_currentIndexChanged( const QSt
return;
}
mComposerScaleBar->setStyle( text );
QString untranslatedStyleName;
if(text == tr("Single Box"))
{
untranslatedStyleName = "Single Box";
}
else if(text == tr("Double Box"))
{
untranslatedStyleName = "Double Box";
}
else if(text == tr( "Line Ticks Middle" ))
{
untranslatedStyleName = "Line Ticks Middle";
}
else if(text == tr("Line Ticks Middle"))
{
untranslatedStyleName = "Line Ticks Middle";
}
else if(text == tr( "Line Ticks Down" ))
{
untranslatedStyleName = "Line Ticks Down";
}
else if(text == tr( "Line Ticks Up"))
{
untranslatedStyleName = "Line Ticks Up";
}
else if(text == tr( "Numeric"))
{
untranslatedStyleName = "Numeric";
}
mComposerScaleBar->setStyle(untranslatedStyleName);
mComposerScaleBar->update();
}

View File

@ -197,32 +197,32 @@ void QgsComposerScaleBar::setStyle( const QString& styleName )
mStyle = 0;
//switch depending on style name
if ( styleName == tr( "Single Box" ) )
if ( styleName == "Single Box")
{
mStyle = new QgsSingleBoxScaleBarStyle( this );
}
else if ( styleName == tr( "Double Box" ) )
else if ( styleName == "Double Box")
{
mStyle = new QgsDoubleBoxScaleBarStyle( this );
}
else if ( styleName == tr( "Line Ticks Middle" ) || styleName == tr( "Line Ticks Down" ) || styleName == tr( "Line Ticks Up" ) )
else if ( styleName == "Line Ticks Middle" || styleName == "Line Ticks Down" || styleName == "Line Ticks Up" )
{
QgsTicksScaleBarStyle* tickStyle = new QgsTicksScaleBarStyle( this );
if ( styleName == tr( "Line Ticks Middle" ) )
if ( styleName == "Line Ticks Middle")
{
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksMiddle );
}
else if ( styleName == tr( "Line Ticks Down" ) )
else if ( styleName == "Line Ticks Down")
{
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksDown );
}
else if ( styleName == tr( "Line Ticks Up" ) )
else if ( styleName == "Line Ticks Up")
{
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksUp );
}
mStyle = tickStyle;
}
else if ( styleName == tr( "Numeric" ) )
else if ( styleName == "Numeric")
{
mStyle = new QgsNumericScaleBarStyle( this );
}

View File

@ -83,7 +83,7 @@ class CORE_EXPORT QgsComposerScaleBar: public QObject, public QgsComposerItem
void applyDefaultSettings();
/**Sets style by name
possibilities are: */
@param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up', 'Numeric'*/
void setStyle( const QString& styleName );
/**Returns style name*/