diff --git a/src/app/qgsdiagramproperties.cpp b/src/app/qgsdiagramproperties.cpp index 5082518cda1e..e635b7650f85 100644 --- a/src/app/qgsdiagramproperties.cpp +++ b/src/app/qgsdiagramproperties.cpp @@ -165,6 +165,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare mDiagramFont = settingList.at( 0 ).font; QSizeF size = settingList.at( 0 ).size; mBackgroundColorButton->setColor( settingList.at( 0 ).backgroundColor ); + mTransparencySlider->setValue( settingList.at( 0 ).transparency * 100 / 256 ); mDiagramPenColorButton->setColor( settingList.at( 0 ).penColor ); mPenWidthSpinBox->setValue( settingList.at( 0 ).penWidth ); mDiagramSizeSpinBox->setValue(( size.width() + size.height() ) / 2.0 ); @@ -281,7 +282,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare else { QMessageBox::warning( this, tr( "Unknown diagram type." ), - tr( "The diagram type '%s' is unknown. A default type is selected for you." ).arg( diagramName ), QMessageBox::Ok ); + tr( "The diagram type '%1' is unknown. A default type is selected for you." ).arg( diagramName ), QMessageBox::Ok ); mDiagramTypeComboBox->setCurrentIndex( mDiagramTypeComboBox->findText( tr( "Pie chart" ) ) ); } } @@ -337,7 +338,6 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( const QS } } - void QgsDiagramProperties::on_mIncreaseSmallDiagramsCheckBox_stateChanged( int state ) { if ( Qt::Checked == state ) @@ -352,6 +352,10 @@ void QgsDiagramProperties::on_mIncreaseSmallDiagramsCheckBox_stateChanged( int s } } +void QgsDiagramProperties::on_mTransparencySlider_valueChanged( int value ) +{ + mTransparencyLabel->setText( tr( "Transparency: %1%" ).arg( value ) ); +} void QgsDiagramProperties::on_mAddCategoryPushButton_clicked() { @@ -527,7 +531,13 @@ void QgsDiagramProperties::apply() } ds.backgroundColor = mBackgroundColorButton->color(); + ds.transparency = mTransparencySlider->value() * 255 / 100; + foreach( QColor col, ds.categoryColors ) + { + col.setAlpha( 255 - ds.transparency ); + } ds.penColor = mDiagramPenColorButton->color(); + ds.penColor.setAlpha( 255 - ds.transparency ); ds.penWidth = mPenWidthSpinBox->value(); if ( mVisibilityGroupBox->isChecked() ) { diff --git a/src/app/qgsdiagramproperties.h b/src/app/qgsdiagramproperties.h index 490073c85912..b27419a42e13 100644 --- a/src/app/qgsdiagramproperties.h +++ b/src/app/qgsdiagramproperties.h @@ -36,6 +36,7 @@ class QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPropertiesBas void apply(); void on_mDiagramTypeComboBox_currentIndexChanged( const QString& itemtext ); void on_mIncreaseSmallDiagramsCheckBox_stateChanged( int state ); + void on_mTransparencySlider_valueChanged( int value ); void on_mAddCategoryPushButton_clicked(); void on_mBackgroundColorButton_clicked(); void on_mFindMaximumValueButton_clicked(); diff --git a/src/core/diagram/qgspiediagram.cpp b/src/core/diagram/qgspiediagram.cpp index efcd0c8f12bf..2097fc2496f1 100644 --- a/src/core/diagram/qgspiediagram.cpp +++ b/src/core/diagram/qgspiediagram.cpp @@ -119,7 +119,9 @@ void QgsPieDiagram::renderDiagram( const QgsAttributeMap& att, QgsRenderContext& for ( ; valIt != values.constEnd(); ++valIt, ++colIt ) { currentAngle = *valIt / valSum * 360 * 16; - mCategoryBrush.setColor( *colIt ); + QColor col = *colIt; + col.setAlpha( 255 - s.transparency ); + mCategoryBrush.setColor( col ); p->setBrush( mCategoryBrush ); p->drawPie( baseX, baseY, w, h, totalAngle, currentAngle ); totalAngle += currentAngle; diff --git a/src/core/qgsdiagramrendererv2.h b/src/core/qgsdiagramrendererv2.h index 03114e6fe633..f191173766f7 100644 --- a/src/core/qgsdiagramrendererv2.h +++ b/src/core/qgsdiagramrendererv2.h @@ -124,6 +124,7 @@ struct CORE_EXPORT QgsDiagramSettings LabelPlacementMethod labelPlacementMethod; DiagramOrientation diagramOrientation; double barWidth; + int transparency; // 0 - 100 bool scaleByArea; //scale range (-1 if no lower / upper bound ) diff --git a/src/ui/qgsdiagrampropertiesbase.ui b/src/ui/qgsdiagrampropertiesbase.ui index 44ac00cfa5e3..5765d927aa5c 100644 --- a/src/ui/qgsdiagrampropertiesbase.ui +++ b/src/ui/qgsdiagrampropertiesbase.ui @@ -117,7 +117,7 @@ - 2 + 0 @@ -126,40 +126,77 @@ - + Background color - + Line color - - + + + + Line width + + + + + - + 0 0 + + Font... + + + + + + + Bar width + + + + + - 25 + 130 0 - + Transparency 0% - + + + + + 300 + 0 + + + + 100 + + + Qt::Horizontal + + + + @@ -178,43 +215,35 @@ - - - - Line width - - + + - - - 5 - - - 99999.990000000005239 - - - - - + - + 0 0 + + + 25 + 0 + + - Font... + - - - - - - - Bar width + + + + 5 + + + 99999.990000000005239