Skip to content
Permalink
Browse files
replaced "opacity" by "transparency" in the composer GUI
  • Loading branch information
olivierdalang authored and dakcarto committed Feb 19, 2013
1 parent a882208 commit bb57cf4b2bcc389ba7e2f94ed9e5e8664294ce05
Showing with 41 additions and 41 deletions.
  1. +21 −21 src/app/composer/qgscomposeritemwidget.cpp
  2. +3 −3 src/app/composer/qgscomposeritemwidget.h
  3. +17 −17 src/ui/qgscomposeritemwidgetbase.ui
@@ -97,7 +97,7 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_clicked()
}

mItem->beginCommand( tr( "Background color changed" ) );
newBackgroundColor.setAlpha( mOpacitySlider->value() );
newBackgroundColor.setAlpha( mTransparencySlider->value() );
mItem->setBrush( QBrush( QColor( newBackgroundColor ), Qt::SolidPattern ) );
//if the item is a composer map, we need to regenerate the map image
//because it usually is cached
@@ -110,38 +110,38 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_clicked()
mItem->endCommand();
}

void QgsComposerItemWidget::on_mOpacitySpinBox_valueChanged( int value )
void QgsComposerItemWidget::on_mTransparencySpinBox_valueChanged( int value )
{
if ( !mItem )
{
return;
}

mOpacitySlider->blockSignals( true );
mOpacitySlider->setValue( value );
mOpacitySlider->blockSignals( false );
changeItemOpacity( value );
mTransparencySlider->blockSignals( true );
mTransparencySlider->setValue( value );
mTransparencySlider->blockSignals( false );
changeItemTransparency( value );
}

void QgsComposerItemWidget::on_mOpacitySlider_sliderReleased()
void QgsComposerItemWidget::on_mTransparencySlider_sliderReleased()
{
if ( !mItem )
{
return;
}
int value = mOpacitySlider->value();
mOpacitySpinBox->blockSignals( true );
mOpacitySpinBox->setValue( value );
mOpacitySpinBox->blockSignals( false );
changeItemOpacity( value );
int value = mTransparencySlider->value();
mTransparencySpinBox->blockSignals( true );
mTransparencySpinBox->setValue( value );
mTransparencySpinBox->blockSignals( false );
changeItemTransparency( value );
}

void QgsComposerItemWidget::changeItemOpacity( int value )
void QgsComposerItemWidget::changeItemTransparency( int value )
{
mItem->beginCommand( tr( "Item opacity changed" ) );
mItem->beginCommand( tr( "Item Transparency changed" ) );
QBrush itemBrush = mItem->brush();
QColor brushColor = itemBrush.color();
brushColor.setAlpha( value );
brushColor.setAlpha( 255-value );
mItem->setBrush( QBrush( brushColor ) );
mItem->update();
mItem->endCommand();
@@ -347,26 +347,26 @@ void QgsComposerItemWidget::setValuesForGuiElements()

setValuesForGuiPositionElements();

mOpacitySlider->blockSignals( true );
mTransparencySlider->blockSignals( true );
mOutlineWidthSpinBox->blockSignals( true );
mFrameGroupBox->blockSignals( true );
mBackgroundGroupBox->blockSignals( true );
mItemIdLineEdit->blockSignals( true );
mOpacitySpinBox->blockSignals( true );
mTransparencySpinBox->blockSignals( true );

mOpacitySpinBox->setValue( mItem->brush().color().alpha() );
mOpacitySlider->setValue( mItem->brush().color().alpha() );
mTransparencySpinBox->setValue( 255-mItem->brush().color().alpha() );
mTransparencySlider->setValue( 255-mItem->brush().color().alpha() );
mOutlineWidthSpinBox->setValue( mItem->pen().widthF() );
mItemIdLineEdit->setText( mItem->id() );
mFrameGroupBox->setChecked( mItem->hasFrame() );
mBackgroundGroupBox->setChecked( mItem->hasBackground() );

mOpacitySlider->blockSignals( false );
mTransparencySlider->blockSignals( false );
mOutlineWidthSpinBox->blockSignals( false );
mFrameGroupBox->blockSignals( false );
mBackgroundGroupBox->blockSignals( false );
mItemIdLineEdit->blockSignals( false );
mOpacitySpinBox->blockSignals( false );
mTransparencySpinBox->blockSignals( false );
}

void QgsComposerItemWidget::on_mItemIdLineEdit_textChanged( const QString &text )
@@ -39,8 +39,8 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa
public slots:
void on_mFrameColorButton_clicked();
void on_mBackgroundColorButton_clicked();
void on_mOpacitySlider_sliderReleased();
void on_mOpacitySpinBox_valueChanged( int value );
void on_mTransparencySlider_sliderReleased();
void on_mTransparencySpinBox_valueChanged( int value );
void on_mOutlineWidthSpinBox_valueChanged( double d );
void on_mFrameGroupBox_toggled( bool state );
void on_mBackgroundGroupBox_toggled( bool state );
@@ -67,7 +67,7 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa

private:
QgsComposerItemWidget();
void changeItemOpacity( int value );
void changeItemTransparency( int value );
void changeItemPosition();

QgsComposerItem* mItem;
@@ -310,14 +310,20 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSpinBox" name="mOpacitySpinBox">
<property name="maximum">
<number>255</number>
<widget class="QLabel" name="mOpacityLabel">
<property name="text">
<string>Transparency</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mTransparencySlider</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="mOpacitySlider">
<widget class="QSlider" name="mTransparencySlider">
<property name="maximum">
<number>255</number>
</property>
@@ -327,15 +333,9 @@
</widget>
</item>
<item>
<widget class="QLabel" name="mOpacityLabel">
<property name="text">
<string>Opacity</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mOpacitySlider</cstring>
<widget class="QSpinBox" name="mTransparencySpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
@@ -404,9 +404,9 @@
<resources/>
<connections>
<connection>
<sender>mOpacitySlider</sender>
<sender>mTransparencySlider</sender>
<signal>valueChanged(int)</signal>
<receiver>mOpacitySpinBox</receiver>
<receiver>mTransparencySpinBox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -420,9 +420,9 @@
</hints>
</connection>
<connection>
<sender>mOpacitySpinBox</sender>
<sender>mTransparencySpinBox</sender>
<signal>valueChanged(int)</signal>
<receiver>mOpacitySlider</receiver>
<receiver>mTransparencySlider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">

0 comments on commit bb57cf4

Please sign in to comment.