@@ -244,29 +244,25 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
244
244
cboxTransparencyBand->addItem ( tr ( " None" ), -1 );
245
245
int nBands = provider->bandCount ();
246
246
QString bandName;
247
-
248
- if ( nBands == 1 )
249
- {
250
- /* Color interpretation name only makes sense for 1-band rasters */
251
- bandName = provider->colorInterpretationName ( 1 );
252
- if ( bandName == " Undefined" )
253
- bandName = provider->generateBandName ( 1 );
254
- cboxTransparencyBand->addItem ( bandName, 1 );
255
- }
256
- else if ( nBands > 1 )
247
+ for ( int i = 1 ; i <= nBands; ++i ) // band numbering seem to start at 1
257
248
{
258
- for ( int i = 1 ; i <= nBands; ++i ) // band numbering seem to start at 1
249
+ bandName = provider->generateBandName ( i );
250
+
251
+ QString colorInterp = provider->colorInterpretationName ( i );
252
+ if ( colorInterp != " Undefined" )
259
253
{
260
- bandName = provider->generateBandName ( i );
261
- cboxTransparencyBand->addItem ( bandName, i );
254
+ bandName.append ( QString ( " (%1)" ).arg ( colorInterp ) );
262
255
}
256
+ cboxTransparencyBand->addItem ( bandName, i );
263
257
}
258
+
264
259
if ( renderer )
265
260
{
266
261
cboxTransparencyBand->setCurrentIndex ( cboxTransparencyBand->findData ( renderer->alphaBand () ) );
267
262
}
268
263
}
269
264
265
+
270
266
// insert renderer widgets into registry
271
267
QgsRasterRendererRegistry::instance ()->insertWidgetFunction ( " paletted" , QgsPalettedRendererWidget::create );
272
268
QgsRasterRendererRegistry::instance ()->insertWidgetFunction ( " multibandcolor" , QgsMultiBandColorRendererWidget::create );
0 commit comments