Skip to content
Permalink
Browse files

Transparency test...

  • Loading branch information
m-kuhn committed Aug 14, 2012
1 parent 3ab9580 commit 194b0f2479ea98c7c92978a34fc6822bb8f7dac3
@@ -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() )
{
@@ -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();
@@ -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;
@@ -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 )
@@ -117,7 +117,7 @@
<item>
<widget class="QTabWidget" name="mDiagramPropertiesTabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@@ -126,40 +126,77 @@
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0" rowspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLabel" name="mBackgroundColorLabel">
<property name="text">
<string>Background color</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLabel" name="mPenColorLabel">
<property name="text">
<string>Line color</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QgsColorButton" name="mDiagramPenColorButton">
<item row="5" column="1">
<widget class="QLabel" name="mPenWidthLabel">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="mDiagramFontButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Font...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="mBarWidthLabel">
<property name="text">
<string>Bar width</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="mTransparencyLabel">
<property name="minimumSize">
<size>
<width>25</width>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
<string>Transparency 0%</string>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="2" column="2" colspan="2">
<widget class="QSlider" name="mTransparencySlider">
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -178,43 +215,35 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="mPenWidthLabel">
<property name="text">
<string>Line width</string>
</property>
</widget>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="mBarWidthSpinBox"/>
</item>
<item row="4" column="2">
<widget class="QDoubleSpinBox" name="mPenWidthSpinBox">
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="mDiagramFontButton">
<widget class="QgsColorButton" name="mDiagramPenColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Font...</string>
<string/>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="mBarWidthSpinBox"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="mBarWidthLabel">
<property name="text">
<string>Bar width</string>
<item row="5" column="2">
<widget class="QDoubleSpinBox" name="mPenWidthSpinBox">
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
</widget>
</item>

0 comments on commit 194b0f2

Please sign in to comment.
You can’t perform that action at this time.