@@ -78,6 +78,7 @@ QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget
78
78
// mHistoShowBands = (HistoShowBands) settings.value( "/Raster/histogram/showBands", (int) ShowAll ).toInt();
79
79
mHistoShowBands = ShowAll;
80
80
81
+ bool isInt = true ;
81
82
if ( true )
82
83
{
83
84
// band selector
@@ -87,6 +88,11 @@ QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget
87
88
++myIteratorInt )
88
89
{
89
90
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 ;
90
96
}
91
97
92
98
// histo min/max selectors
@@ -164,11 +170,20 @@ QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget
164
170
action = new QAction ( tr ( " Display" ), group );
165
171
action->setSeparator ( true );
166
172
menu->addAction ( action );
167
- action = new QAction ( tr ( " Draw as lines" ), group );
168
- action->setData ( QVariant ( " Draw lines" ) );
169
- action->setCheckable ( true );
170
173
// 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
+ }
172
187
menu->addAction ( action );
173
188
174
189
// actions
0 commit comments