Skip to content

Commit e887d07

Browse files
committedDec 4, 2014
Correctly set band number for pseudocolor renderer widget
Previously the band was always reset to the first band when opening the raster layer properties.
1 parent 486d408 commit e887d07

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed
 

‎python/core/raster/qgssinglebandpseudocolorrenderer.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class QgsSingleBandPseudoColorRenderer: QgsRasterRenderer
2424

2525
QList<int> usesBands() const;
2626

27+
/**Returns the band used by the renderer
28+
* @note added in QGIS 2.7
29+
*/
30+
int band() const;
31+
2732
double classificationMin() const;
2833
double classificationMax() const;
2934
void setClassificationMin( double min );

‎src/core/raster/qgssinglebandpseudocolorrenderer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ class CORE_EXPORT QgsSingleBandPseudoColorRenderer: public QgsRasterRenderer
4949

5050
QList<int> usesBands() const;
5151

52+
/**Returns the band used by the renderer
53+
* @note added in QGIS 2.7
54+
*/
55+
int band() const { return mBand; }
56+
5257
double classificationMin() const { return mClassificationMin; }
5358
double classificationMax() const { return mClassificationMax; }
5459
void setClassificationMin( double min ) { mClassificationMin = min; }

‎src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ void QgsSingleBandPseudoColorRendererWidget::setFromRenderer( const QgsRasterRen
561561
const QgsSingleBandPseudoColorRenderer* pr = dynamic_cast<const QgsSingleBandPseudoColorRenderer*>( r );
562562
if ( pr )
563563
{
564+
mBandComboBox->setCurrentIndex( mBandComboBox->findData( pr->band() ) );
565+
564566
const QgsRasterShader* rasterShader = pr->shader();
565567
if ( rasterShader )
566568
{

0 commit comments

Comments
 (0)
Please sign in to comment.