Skip to content
Permalink
Browse files

Keep item position constant if reference point changes (ticket #7519)

  • Loading branch information
mhugent committed Apr 12, 2013
1 parent 71c45c0 commit 377b4518713b8f67c69b9663b191576164b4c9ce
Showing with 116 additions and 9 deletions.
  1. +107 −0 src/app/composer/qgscomposeritemwidget.cpp
  2. +9 −9 src/app/composer/qgscomposeritemwidget.h
@@ -414,3 +414,110 @@ void QgsComposerItemWidget::on_mItemIdLineEdit_editingFinished()
mItem->endCommand();
}
}

void QgsComposerItemWidget::on_mUpperLeftCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx(), mItem->transform().dy(), QgsComposerItem::UpperLeft );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mUpperMiddleCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx() + mItem->rect().width() / 2.0,
mItem->transform().dy(), QgsComposerItem::UpperMiddle );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mUpperRightCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx() + mItem->rect().width(),
mItem->transform().dy(), QgsComposerItem::UpperRight );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mMiddleLeftCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx(),
mItem->transform().dy() + mItem->rect().height() / 2.0, QgsComposerItem::MiddleLeft );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mMiddleCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx() + mItem->rect().width() / 2.0,
mItem->transform().dy() + mItem->rect().height() / 2.0, QgsComposerItem::Middle );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mMiddleRightCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx() + mItem->rect().width(),
mItem->transform().dy() + mItem->rect().height() / 2.0, QgsComposerItem::MiddleRight );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mLowerLeftCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx(),
mItem->transform().dy() + mItem->rect().height(), QgsComposerItem::LowerLeft );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mLowerMiddleCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx() + mItem->rect().width() / 2.0,
mItem->transform().dy() + mItem->rect().height(), QgsComposerItem::LowerMiddle );
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mLowerRightCheckBox_stateChanged( int state )
{
if ( state != Qt::Checked )
return;
if ( mItem )
{
mItem->setItemPosition( mItem->transform().dx() + mItem->rect().width(),
mItem->transform().dy() + mItem->rect().height(), QgsComposerItem::LowerRight );
}
setValuesForGuiPositionElements();
}
@@ -60,15 +60,15 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa
void on_mWidthLineEdit_editingFinished() { changeItemPosition(); }
void on_mHeightLineEdit_editingFinished() { changeItemPosition(); }

void on_mUpperLeftCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mUpperMiddleCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mUpperRightCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mMiddleLeftCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mMiddleCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mMiddleRightCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mLowerLeftCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mLowerMiddleCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mLowerRightCheckBox_stateChanged( int state ) { Q_UNUSED( state ); changeItemPosition(); }
void on_mUpperLeftCheckBox_stateChanged( int state );
void on_mUpperMiddleCheckBox_stateChanged( int state );
void on_mUpperRightCheckBox_stateChanged( int state );
void on_mMiddleLeftCheckBox_stateChanged( int state );
void on_mMiddleCheckBox_stateChanged( int state );
void on_mMiddleRightCheckBox_stateChanged( int state );
void on_mLowerLeftCheckBox_stateChanged( int state );
void on_mLowerMiddleCheckBox_stateChanged( int state );
void on_mLowerRightCheckBox_stateChanged( int state );

void on_mBlendModeCombo_currentIndexChanged( int index );
void on_mTransparencySlider_valueChanged( int value );

0 comments on commit 377b451

Please sign in to comment.
You can’t perform that action at this time.