@@ -295,9 +295,11 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
295
295
on_mDisplayDiagramsGroupBox_toggled ( mDisplayDiagramsGroupBox ->isChecked () );
296
296
}
297
297
298
- void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged ( const QString& itemtext )
298
+ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged ( int index )
299
299
{
300
- if ( tr ( " Text diagram" ) == itemtext )
300
+ QString diagramType = mDiagramTypeComboBox ->itemData ( index ).toString ();
301
+
302
+ if ( DIAGRAM_NAME_TEXT == diagramType )
301
303
{
302
304
mLabelPlacementComboBox ->show ();
303
305
mLabelPlacementLabel ->show ();
@@ -307,7 +309,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
307
309
mLabelPlacementLabel ->hide ();
308
310
}
309
311
310
- if ( tr ( " Histogram " ) == itemtext )
312
+ if ( DIAGRAM_NAME_HISTOGRAM == diagramType )
311
313
{
312
314
mBarWidthLabel ->show ();
313
315
mBarWidthSpinBox ->show ();
@@ -320,7 +322,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
320
322
mOrientationFrame ->hide ();
321
323
}
322
324
323
- if ( tr ( " Histogram " ) == itemtext || tr ( " Text diagram " ) == itemtext )
325
+ if ( DIAGRAM_NAME_HISTOGRAM == diagramType || DIAGRAM_NAME_TEXT == diagramType )
324
326
{
325
327
mDiagramPropertiesTabWidget ->setTabEnabled ( 3 , true );
326
328
}
@@ -329,7 +331,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
329
331
mDiagramPropertiesTabWidget ->setTabEnabled ( 3 , false );
330
332
}
331
333
332
- if ( tr ( " Text diagram " ) == itemtext || tr ( " Pie chart " ) == itemtext )
334
+ if ( DIAGRAM_NAME_TEXT == diagramType || DIAGRAM_NAME_PIE == diagramType )
333
335
{
334
336
mScaleDependencyComboBox ->show ();
335
337
mScaleDependencyLabel ->show ();
@@ -419,7 +421,7 @@ void QgsDiagramProperties::on_mDisplayDiagramsGroupBox_toggled( bool checked )
419
421
// if enabled show diagram specific options
420
422
if ( checked )
421
423
{
422
- on_mDiagramTypeComboBox_currentIndexChanged ( mDiagramTypeComboBox ->currentText () );
424
+ on_mDiagramTypeComboBox_currentIndexChanged ( mDiagramTypeComboBox ->currentIndex () );
423
425
// Update enabled/disabled state
424
426
}
425
427
}
0 commit comments