Skip to content

Commit

Permalink
[raster] improve multiband color widget's band selection
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 6, 2016
1 parent 5db654b commit a52a1e9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/gui/raster/qgsmultibandcolorrendererwidget.cpp
Expand Up @@ -306,9 +306,19 @@ void QgsMultiBandColorRendererWidget::setFromRenderer( const QgsRasterRenderer*
}
else
{
mRedBandComboBox->setCurrentIndex( mRedBandComboBox->findText( tr( "Red" ) ) );
mGreenBandComboBox->setCurrentIndex( mGreenBandComboBox->findText( tr( "Green" ) ) );
mBlueBandComboBox->setCurrentIndex( mBlueBandComboBox->findText( tr( "Blue" ) ) );
if ( mRedBandComboBox->findText( tr( "Red" ) ) > -1 && mRedBandComboBox->findText( tr( "Green" ) ) > -1 &&
mRedBandComboBox->findText( tr( "Blue" ) ) > -1 )
{
mRedBandComboBox->setCurrentIndex( mRedBandComboBox->findText( tr( "Red" ) ) );
mGreenBandComboBox->setCurrentIndex( mGreenBandComboBox->findText( tr( "Green" ) ) );
mBlueBandComboBox->setCurrentIndex( mBlueBandComboBox->findText( tr( "Blue" ) ) );
}
else
{
mRedBandComboBox->setCurrentIndex( mRedBandComboBox->count() > 1 ? 1 : 0 );
mGreenBandComboBox->setCurrentIndex( mRedBandComboBox->count() > 2 ? 2 : 0 );
mBlueBandComboBox->setCurrentIndex( mRedBandComboBox->count() > 3 ? 3 : 0 );
}
}
}

Expand Down

0 comments on commit a52a1e9

Please sign in to comment.