Skip to content
Permalink
Browse files
Pass untranslated scale bar stylename to QgsComposerScaleBar. Otherwi…
…se 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
  • Loading branch information
mhugent committed Dec 13, 2008
1 parent 8d36542 commit 2074c83c733462503f766824999fa8ba5f1b2cfa
@@ -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();
}

@@ -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 );
}
@@ -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*/

0 comments on commit 2074c83

Please sign in to comment.