25 changes: 18 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 @@ -322,15 +323,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 @@ -343,11 +342,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() );
mItemIdLineEdit->setText( mItem->id() );
mFrameGroupBox->setChecked( mItem->hasFrame() );
Expand All @@ -369,6 +364,22 @@ 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 );
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 @@ -80,7 +80,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
1 change: 1 addition & 0 deletions src/app/composer/qgscomposerlegendwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): m
{
legend->model()->setHorizontalHeaderLabels( QStringList() << tr( "Item" ) << tr( "Title style" ) );
mItemTreeView->setModel( legend->model() );
connect( legend, SIGNAL( itemChanged() ), this, SLOT( setGuiElements() ) );
}

QgsComposerLegendWidgetStyleDelegate* styleDelegate = new QgsComposerLegendWidgetStyleDelegate();
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 @@ -229,10 +229,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