Skip to content

Commit dae596a

Browse files
committedAug 16, 2012
Change diagram properties dialog dropdown to use id instead of translated text
1 parent 55b5dcb commit dae596a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed
 

‎src/app/qgsdiagramproperties.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,11 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
295295
on_mDisplayDiagramsGroupBox_toggled( mDisplayDiagramsGroupBox->isChecked() );
296296
}
297297

298-
void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QString& itemtext )
298+
void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int index )
299299
{
300-
if ( tr( "Text diagram" ) == itemtext )
300+
QString diagramType = mDiagramTypeComboBox->itemData( index ).toString();
301+
302+
if ( DIAGRAM_NAME_TEXT == diagramType )
301303
{
302304
mLabelPlacementComboBox->show();
303305
mLabelPlacementLabel->show();
@@ -307,7 +309,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
307309
mLabelPlacementLabel->hide();
308310
}
309311

310-
if ( tr( "Histogram" ) == itemtext )
312+
if ( DIAGRAM_NAME_HISTOGRAM == diagramType )
311313
{
312314
mBarWidthLabel->show();
313315
mBarWidthSpinBox->show();
@@ -320,7 +322,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
320322
mOrientationFrame->hide();
321323
}
322324

323-
if ( tr( "Histogram" ) == itemtext || tr( "Text diagram" ) == itemtext )
325+
if ( DIAGRAM_NAME_HISTOGRAM == diagramType || DIAGRAM_NAME_TEXT == diagramType )
324326
{
325327
mDiagramPropertiesTabWidget->setTabEnabled( 3, true );
326328
}
@@ -329,7 +331,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
329331
mDiagramPropertiesTabWidget->setTabEnabled( 3, false );
330332
}
331333

332-
if ( tr( "Text diagram" ) == itemtext || tr( "Pie chart" ) == itemtext )
334+
if ( DIAGRAM_NAME_TEXT == diagramType || DIAGRAM_NAME_PIE == diagramType )
333335
{
334336
mScaleDependencyComboBox->show();
335337
mScaleDependencyLabel->show();
@@ -419,7 +421,7 @@ void QgsDiagramProperties::on_mDisplayDiagramsGroupBox_toggled( bool checked )
419421
// if enabled show diagram specific options
420422
if ( checked )
421423
{
422-
on_mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentText() );
424+
on_mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentIndex() );
423425
// Update enabled/disabled state
424426
}
425427
}

‎src/app/qgsdiagramproperties.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPropertiesBas
3434

3535
public slots:
3636
void apply();
37-
void on_mDiagramTypeComboBox_currentIndexChanged( const QString& itemtext );
37+
void on_mDiagramTypeComboBox_currentIndexChanged( int index );
3838
void on_mTransparencySlider_valueChanged( int value );
3939
void on_mAddCategoryPushButton_clicked();
4040
void on_mBackgroundColorButton_clicked();

0 commit comments

Comments
 (0)
Please sign in to comment.