Skip to content

Commit

Permalink
Label property dialog: allow translation of comboboxes entries and ad…
Browse files Browse the repository at this point in the history
…d missing vertical alignment
  • Loading branch information
3nids committed Sep 1, 2015
1 parent 0512d02 commit 4e60022
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
31 changes: 16 additions & 15 deletions src/app/qgslabelpropertydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId, const
mBufferColorButton->setColor( layerSettings.bufferColor );
mMinScaleSpinBox->setValue( layerSettings.scaleMin );
mMaxScaleSpinBox->setValue( layerSettings.scaleMax );
mHaliComboBox->setCurrentIndex( mHaliComboBox->findText( "Left" ) );
mValiComboBox->setCurrentIndex( mValiComboBox->findText( "Bottom" ) );
mHaliComboBox->setCurrentIndex( mHaliComboBox->findData( "Left" ) );
mValiComboBox->setCurrentIndex( mValiComboBox->findData( "Bottom" ) );
mFontColorButton->setColorDialogTitle( tr( "Font color" ) );
mBufferColorButton->setColorDialogTitle( tr( "Buffer color" ) );

Expand Down Expand Up @@ -300,10 +300,10 @@ void QgsLabelPropertyDialog::setDataDefinedValues( const QgsPalLayerSettings &la
break;
}
case QgsPalLayerSettings::Hali:
mHaliComboBox->setCurrentIndex( mHaliComboBox->findText( result.toString(), Qt::MatchFixedString ) );
mHaliComboBox->setCurrentIndex( mHaliComboBox->findData( result.toString() ) );
break;
case QgsPalLayerSettings::Vali:
mValiComboBox->setCurrentIndex( mValiComboBox->findText( result.toString(), Qt::MatchFixedString ) );
mValiComboBox->setCurrentIndex( mValiComboBox->findData( result.toString() ) );
break;
case QgsPalLayerSettings::BufferColor:
mBufferColorButton->setColor( QColor( result.toString() ) );
Expand Down Expand Up @@ -475,17 +475,18 @@ void QgsLabelPropertyDialog::populateFontStyleComboBox()

void QgsLabelPropertyDialog::fillHaliComboBox()
{
mHaliComboBox->addItem( "Left" );
mHaliComboBox->addItem( "Center" );
mHaliComboBox->addItem( "Right" );
mHaliComboBox->addItem( tr( "Left" ), "Left" );
mHaliComboBox->addItem( tr( "Center" ), "Center" );
mHaliComboBox->addItem( tr( "Right" ), "Right" );
}

void QgsLabelPropertyDialog::fillValiComboBox()
{
mValiComboBox->addItem( "Bottom" );
mValiComboBox->addItem( "Base" );
mValiComboBox->addItem( "Half" );
mValiComboBox->addItem( "Top" );
mValiComboBox->addItem( tr( "Bottom" ), "Bottom" );
mValiComboBox->addItem( tr( "Base" ), "Base" );
mValiComboBox->addItem( tr( "Half" ), "Half" );
mValiComboBox->addItem( tr( "Cap" ), "Cap" );
mValiComboBox->addItem( tr( "Top" ), "Top" );
}

void QgsLabelPropertyDialog::on_mShowLabelChkbx_toggled( bool chkd )
Expand Down Expand Up @@ -626,14 +627,14 @@ void QgsLabelPropertyDialog::on_mBufferColorButton_colorChanged( const QColor &c
insertChangedValue( QgsPalLayerSettings::BufferColor, color.name() );
}

void QgsLabelPropertyDialog::on_mHaliComboBox_currentIndexChanged( const QString& text )
void QgsLabelPropertyDialog::on_mHaliComboBox_currentIndexChanged( const int index )
{
insertChangedValue( QgsPalLayerSettings::Hali, text );
insertChangedValue( QgsPalLayerSettings::Hali, mHaliComboBox->itemData( index ) );
}

void QgsLabelPropertyDialog::on_mValiComboBox_currentIndexChanged( const QString& text )
void QgsLabelPropertyDialog::on_mValiComboBox_currentIndexChanged( const int index )
{
insertChangedValue( QgsPalLayerSettings::Vali, text );
insertChangedValue( QgsPalLayerSettings::Vali, mValiComboBox->itemData( index ) );
}

void QgsLabelPropertyDialog::on_mLabelTextLineEdit_textChanged( const QString& text )
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgslabelpropertydialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class APP_EXPORT QgsLabelPropertyDialog: public QDialog, private Ui::QgsLabelPro
void on_mRotationSpinBox_valueChanged( double d );
void on_mFontColorButton_colorChanged( const QColor &color );
void on_mBufferColorButton_colorChanged( const QColor &color );
void on_mHaliComboBox_currentIndexChanged( const QString& text );
void on_mValiComboBox_currentIndexChanged( const QString& text );
void on_mHaliComboBox_currentIndexChanged( const int index );
void on_mValiComboBox_currentIndexChanged( const int index );
void on_mLabelTextLineEdit_textChanged( const QString& text );

private:
Expand Down

0 comments on commit 4e60022

Please sign in to comment.