Skip to content
Permalink
Browse files

Fix regression - lost "load from raster band" button in raster GUI

  • Loading branch information
wonder-sk committed Aug 16, 2018
1 parent 805e7ec commit 2f5ef8e0f8e353625077a558df90b234be9e9edf
@@ -97,12 +97,12 @@ void QgsColorRampShaderWidget::initializeForUseWithRasterLayer()
{
Q_ASSERT( mClassificationModeComboBox->findData( QgsColorRampShader::Quantile < 0 ) );
mClassificationModeComboBox->addItem( tr( "Quantile" ), QgsColorRampShader::Quantile );
mLoadFromBandButton->setVisible( bool( mRasterDataProvider ) ); // only for raster version
}

void QgsColorRampShaderWidget::setRasterDataProvider( QgsRasterDataProvider *dp )
{
mRasterDataProvider = dp;
mLoadFromBandButton->setVisible( bool( mRasterDataProvider ) ); // only for raster version
}

void QgsColorRampShaderWidget::setRasterBand( int band )
@@ -143,25 +143,14 @@ void QgsSingleBandPseudoColorRendererWidget::setMapCanvas( QgsMapCanvas *canvas
mColorRampShaderWidget->setExtent( mMinMaxWidget->extent() );
}

void QgsSingleBandPseudoColorRendererWidget::mLoadFromBandButton_clicked()
{
if ( !mRasterLayer || !mRasterLayer->dataProvider() )
{
return;
}

int bandIndex = mBandComboBox->currentBand();
mColorRampShaderWidget->setRasterBand( bandIndex );
emit widgetChanged();
}

void QgsSingleBandPseudoColorRendererWidget::setFromRenderer( const QgsRasterRenderer *r )
{
const QgsSingleBandPseudoColorRenderer *pr = dynamic_cast<const QgsSingleBandPseudoColorRenderer *>( r );
if ( pr )
{
mBandComboBox->setBand( pr->band() );
mMinMaxWidget->setBands( QList< int >() << pr->band() );
mColorRampShaderWidget->setRasterBand( pr->band() );

const QgsRasterShader *rasterShader = pr->shader();
if ( rasterShader )
@@ -66,7 +66,6 @@ class GUI_EXPORT QgsSingleBandPseudoColorRendererWidget: public QgsRasterRendere
void loadMinMaxFromTree( double min, double max );

private slots:
void mLoadFromBandButton_clicked();
void bandChanged();
void mMinLineEdit_textChanged( const QString & );
void mMaxLineEdit_textChanged( const QString & );

0 comments on commit 2f5ef8e

Please sign in to comment.
You can’t perform that action at this time.