@@ -78,6 +78,7 @@ QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget
7878 // mHistoShowBands = (HistoShowBands) settings.value( "/Raster/histogram/showBands", (int) ShowAll ).toInt();
7979 mHistoShowBands = ShowAll;
8080
81+ bool isInt = true ;
8182 if ( true )
8283 {
8384 // band selector
@@ -87,6 +88,11 @@ QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget
8788 ++myIteratorInt )
8889 {
8990 cboHistoBand->addItem ( mRasterLayer ->bandName ( myIteratorInt ) );
91+ QGis::DataType mySrcDataType = mRasterLayer ->dataProvider ()->srcDataType ( myIteratorInt );
92+ if ( !( mySrcDataType == QGis::Byte ||
93+ mySrcDataType == QGis::Int16 || mySrcDataType == QGis::Int32 ||
94+ mySrcDataType == QGis::UInt16 || mySrcDataType == QGis::UInt32 ) )
95+ isInt = false ;
9096 }
9197
9298 // histo min/max selectors
@@ -164,11 +170,20 @@ QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget
164170 action = new QAction ( tr ( " Display" ), group );
165171 action->setSeparator ( true );
166172 menu->addAction ( action );
167- action = new QAction ( tr ( " Draw as lines" ), group );
168- action->setData ( QVariant ( " Draw lines" ) );
169- action->setCheckable ( true );
170173 // should we plot as histogram instead of line plot? (int data only)
171- action->setChecked ( mHistoDrawLines );
174+ action = new QAction ( " " , group );
175+ action->setData ( QVariant ( " Draw lines" ) );
176+ if ( isInt )
177+ {
178+ action->setText ( tr ( " Draw as lines" ) );
179+ action->setCheckable ( true );
180+ action->setChecked ( mHistoDrawLines );
181+ }
182+ else
183+ {
184+ action->setText ( tr ( " Draw as lines (only int layers)" ) );
185+ action->setEnabled ( false );
186+ }
172187 menu->addAction ( action );
173188
174189 // actions
0 commit comments