Skip to content

Commit

Permalink
replaced "opacity" by "transparency" in the composer GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierdalang authored and dakcarto committed Feb 19, 2013
1 parent a882208 commit bb57cf4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
42 changes: 21 additions & 21 deletions src/app/composer/qgscomposeritemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down Expand Up @@ -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 )
Expand Down
6 changes: 3 additions & 3 deletions src/app/composer/qgscomposeritemwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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;
Expand Down
34 changes: 17 additions & 17 deletions src/ui/qgscomposeritemwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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">
Expand All @@ -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">
Expand Down

0 comments on commit bb57cf4

Please sign in to comment.