3 changes: 2 additions & 1 deletion python/core/composer/qgscomposeritemcommand.sip
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
//item
ItemOutlineWidth,
ItemMove,
ItemRotation
ItemRotation,
ItemTransparency
};

QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text );
Expand Down
29 changes: 22 additions & 7 deletions src/app/composer/qgscomposeritemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem*

setValuesForGuiElements();
connect( mItem, SIGNAL( sizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) );
connect( mItem, SIGNAL( itemChanged() ), this, SLOT( setValuesForGuiNonPositionElements() ) );

connect( mTransparencySlider, SIGNAL( valueChanged( int ) ), mTransparencySpnBx, SLOT( setValue( int ) ) );
connect( mTransparencySpnBx, SIGNAL( valueChanged( int ) ), mTransparencySlider, SLOT( setValue( int ) ) );
Expand Down Expand Up @@ -335,15 +336,13 @@ void QgsComposerItemWidget::setValuesForGuiPositionElements()
mHeightLineEdit->blockSignals( false );
}

void QgsComposerItemWidget::setValuesForGuiElements()
void QgsComposerItemWidget::setValuesForGuiNonPositionElements()
{
if ( !mItem )
{
return;
}

setValuesForGuiPositionElements();

mOutlineWidthSpinBox->blockSignals( true );
mFrameGroupBox->blockSignals( true );
mBackgroundGroupBox->blockSignals( true );
Expand All @@ -357,11 +356,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()
mItemRotationSpinBox->blockSignals( true );

mBackgroundColorButton->setColor( mItem->brush().color() );
mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFrameColorButton->setColor( mItem->pen().color() );
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mOutlineWidthSpinBox->setValue( mItem->pen().widthF() );
mFrameJoinStyleCombo->setPenJoinStyle( mItem->frameJoinStyle() );
mItemIdLineEdit->setText( mItem->id() );
Expand All @@ -385,20 +380,40 @@ void QgsComposerItemWidget::setValuesForGuiElements()
mItemRotationSpinBox->blockSignals( false );
}

void QgsComposerItemWidget::setValuesForGuiElements()
{
if ( !mItem )
{
return;
}

mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

setValuesForGuiPositionElements();
setValuesForGuiNonPositionElements();
}

void QgsComposerItemWidget::on_mBlendModeCombo_currentIndexChanged( int index )
{
Q_UNUSED( index );
if ( mItem )
{
mItem->beginCommand( tr( "Item blend mode changed" ) );
mItem->setBlendMode( mBlendModeCombo->blendMode() );
mItem->endCommand();
}
}

void QgsComposerItemWidget::on_mTransparencySlider_valueChanged( int value )
{
if ( mItem )
{
mItem->beginCommand( tr( "Item transparency changed" ), QgsComposerMergeCommand::ItemTransparency );
mItem->setTransparency( value );
mItem->endCommand();
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/app/composer/qgscomposeritemwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa
void on_mItemRotationSpinBox_valueChanged( double val );

void setValuesForGuiElements();
//sets the values for all position related (x, y, width, height) elements
void setValuesForGuiPositionElements();
//sets the values for all non-position related elements
void setValuesForGuiNonPositionElements();

private:
QgsComposerItemWidget();
Expand Down
12 changes: 12 additions & 0 deletions src/app/composer/qgscomposermapwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,12 +773,18 @@ void QgsComposerMapWidget::on_mOverviewFrameStyleButton_clicked()
return;
}

mComposerMap->beginCommand( tr( "Overview frame style changed" ) );
QgsSymbolV2SelectorDialog d( mComposerMap->overviewFrameMapSymbol(), QgsStyleV2::defaultStyle(), 0 );

//QgsSymbolV2PropertiesDialog d( mComposerMap->overviewFrameMapSymbol(), 0, this );
if ( d.exec() == QDialog::Accepted )
{
updateOverviewSymbolMarker();
mComposerMap->endCommand();
}
else
{
mComposerMap->cancelCommand();
}
}

Expand Down Expand Up @@ -892,10 +898,16 @@ void QgsComposerMapWidget::on_mGridLineStyleButton_clicked()
return;
}

mComposerMap->beginCommand( tr( "Grid line style changed" ) );
QgsSymbolV2SelectorDialog d( mComposerMap->gridLineSymbol(), QgsStyleV2::defaultStyle(), 0 );
if ( d.exec() == QDialog::Accepted )
{
updateLineSymbolMarker();
mComposerMap->endCommand();
}
else
{
mComposerMap->cancelCommand();
}

mComposerMap->update();
Expand Down
6 changes: 6 additions & 0 deletions src/app/composer/qgscomposershapewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ void QgsComposerShapeWidget::on_mShapeStyleButton_clicked()
coverageLayer = mComposerShape->composition()->atlasComposition().coverageLayer();
}

mComposerShape->beginCommand( tr( "Shape style changed" ) );
QgsSymbolV2SelectorDialog d( mComposerShape->shapeStyleSymbol(), QgsStyleV2::defaultStyle(), coverageLayer );

if ( d.exec() == QDialog::Accepted )
{
updateShapeStyle();
mComposerShape->endCommand();
}
else
{
mComposerShape->cancelCommand();
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,7 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&
}

//rotation
if ( itemElem.attribute( "itemRotation", "0" ).toDouble() != 0 )
{
setItemRotation( itemElem.attribute( "itemRotation", "0" ).toDouble() );
}
setItemRotation( itemElem.attribute( "itemRotation", "0" ).toDouble() );

//uuid
mUuid = itemElem.attribute( "uuid", QUuid::createUuid().toString() );
Expand Down
3 changes: 2 additions & 1 deletion src/core/composer/qgscomposeritemcommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
//item
ItemOutlineWidth,
ItemMove,
ItemRotation
ItemRotation,
ItemTransparency
};

QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text );
Expand Down