Skip to content

Commit

Permalink
[composer] Correctly update non-position related item property contro…
Browse files Browse the repository at this point in the history
…ls after undo/redo
  • Loading branch information
nyalldawson committed Apr 13, 2014
1 parent 5537afc commit 80ab4a2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
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 @@ -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,6 +380,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 @@ -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

0 comments on commit 80ab4a2

Please sign in to comment.