Skip to content

Commit

Permalink
Change diagram properties dialog dropdown to use id instead of transl…
Browse files Browse the repository at this point in the history
…ated text
  • Loading branch information
m-kuhn committed Aug 16, 2012
1 parent 55b5dcb commit dae596a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/app/qgsdiagramproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,11 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
on_mDisplayDiagramsGroupBox_toggled( mDisplayDiagramsGroupBox->isChecked() );
}

void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QString& itemtext )
void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int index )
{
if ( tr( "Text diagram" ) == itemtext )
QString diagramType = mDiagramTypeComboBox->itemData( index ).toString();

if ( DIAGRAM_NAME_TEXT == diagramType )
{
mLabelPlacementComboBox->show();
mLabelPlacementLabel->show();
Expand All @@ -307,7 +309,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
mLabelPlacementLabel->hide();
}

if ( tr( "Histogram" ) == itemtext )
if ( DIAGRAM_NAME_HISTOGRAM == diagramType )
{
mBarWidthLabel->show();
mBarWidthSpinBox->show();
Expand All @@ -320,7 +322,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
mOrientationFrame->hide();
}

if ( tr( "Histogram" ) == itemtext || tr( "Text diagram" ) == itemtext )
if ( DIAGRAM_NAME_HISTOGRAM == diagramType || DIAGRAM_NAME_TEXT == diagramType )
{
mDiagramPropertiesTabWidget->setTabEnabled( 3, true );
}
Expand All @@ -329,7 +331,7 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS
mDiagramPropertiesTabWidget->setTabEnabled( 3, false );
}

if ( tr( "Text diagram" ) == itemtext || tr( "Pie chart" ) == itemtext )
if ( DIAGRAM_NAME_TEXT == diagramType || DIAGRAM_NAME_PIE == diagramType )
{
mScaleDependencyComboBox->show();
mScaleDependencyLabel->show();
Expand Down Expand Up @@ -419,7 +421,7 @@ void QgsDiagramProperties::on_mDisplayDiagramsGroupBox_toggled( bool checked )
// if enabled show diagram specific options
if ( checked )
{
on_mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentText() );
on_mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentIndex() );
// Update enabled/disabled state
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdiagramproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPropertiesBas

public slots:
void apply();
void on_mDiagramTypeComboBox_currentIndexChanged( const QString& itemtext );
void on_mDiagramTypeComboBox_currentIndexChanged( int index );
void on_mTransparencySlider_valueChanged( int value );
void on_mAddCategoryPushButton_clicked();
void on_mBackgroundColorButton_clicked();
Expand Down

0 comments on commit dae596a

Please sign in to comment.