Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix regression for pseudo color renderer widget
  • Loading branch information
PeterPetrik authored and wonder-sk committed Jul 13, 2018
1 parent e135b9c commit ade3325
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/gui/raster/qgscolorrampshaderwidget.cpp
Expand Up @@ -103,19 +103,16 @@ void QgsColorRampShaderWidget::initializeForUseWithRasterLayer()
void QgsColorRampShaderWidget::setRasterDataProvider( QgsRasterDataProvider *dp )
{
mRasterDataProvider = dp;
loadMinimumMaximumFromTree();
}

void QgsColorRampShaderWidget::setRasterBand( int band )
{
mBand = band;
loadMinimumMaximumFromTree();
}

void QgsColorRampShaderWidget::setExtent( const QgsRectangle &extent )
{
mExtent = extent;
loadMinimumMaximumFromTree();
}

QgsColorRampShader QgsColorRampShaderWidget::shader() const
Expand Down
13 changes: 8 additions & 5 deletions src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
Expand Up @@ -84,8 +84,8 @@ QgsSingleBandPseudoColorRendererWidget::QgsSingleBandPseudoColorRendererWidget(

setFromRenderer( layer->renderer() );

connect( mMinMaxWidget, &QgsRasterMinMaxWidget::widgetChanged, this, &QgsSingleBandPseudoColorRendererWidget::widgetChanged );
connect( mMinMaxWidget, &QgsRasterMinMaxWidget::load, this, &QgsSingleBandPseudoColorRendererWidget::loadMinMax );
connect( mMinMaxWidget, &QgsRasterMinMaxWidget::widgetChanged, this, &QgsSingleBandPseudoColorRendererWidget::widgetChanged );

// If there is currently no min/max, load default with user current default options
if ( mMinLineEdit->text().isEmpty() || mMaxLineEdit->text().isEmpty() )
Expand Down Expand Up @@ -218,11 +218,10 @@ void QgsSingleBandPseudoColorRendererWidget::loadMinMax( int bandNo, double min,
whileBlocking( mMaxLineEdit )->setText( QString::number( max ) );
}

if ( oldMin != min || oldMax != max )
if ( !qgsDoubleNear( oldMin, min ) || !qgsDoubleNear( oldMax, max ) )
{
mColorRampShaderWidget->setRasterBand( bandNo );
mColorRampShaderWidget->setMinimumMaximum( min, max );
mColorRampShaderWidget->classify();
whileBlocking( mColorRampShaderWidget )->setRasterBand( bandNo );
whileBlocking( mColorRampShaderWidget )->setMinimumMaximumAndClassify( min, max );
}
}

Expand Down Expand Up @@ -259,22 +258,26 @@ void QgsSingleBandPseudoColorRendererWidget::mMinLineEdit_textEdited( const QStr
{
minMaxModified();
whileBlocking( mColorRampShaderWidget )->setMinimumMaximumAndClassify( lineEditValue( mMinLineEdit ), lineEditValue( mMaxLineEdit ) );
emit widgetChanged();
}

void QgsSingleBandPseudoColorRendererWidget::mMaxLineEdit_textEdited( const QString & )
{
minMaxModified();
whileBlocking( mColorRampShaderWidget )->setMinimumMaximumAndClassify( lineEditValue( mMinLineEdit ), lineEditValue( mMaxLineEdit ) );
emit widgetChanged();
}

void QgsSingleBandPseudoColorRendererWidget::mMinLineEdit_textChanged( const QString & )
{
whileBlocking( mColorRampShaderWidget )->setMinimumMaximum( lineEditValue( mMinLineEdit ), lineEditValue( mMaxLineEdit ) );
emit widgetChanged();
}

void QgsSingleBandPseudoColorRendererWidget::mMaxLineEdit_textChanged( const QString & )
{
whileBlocking( mColorRampShaderWidget )->setMinimumMaximum( lineEditValue( mMinLineEdit ), lineEditValue( mMaxLineEdit ) );
emit widgetChanged();
}


Expand Down

0 comments on commit ade3325

Please sign in to comment.