Skip to content

Commit

Permalink
[composer] Move item rotation control to item widget panel
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 30, 2013
1 parent 719c78c commit 4169aa7
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 78 deletions.
14 changes: 14 additions & 0 deletions src/app/composer/qgscomposeritemwidget.cpp
Expand Up @@ -333,6 +333,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()
mTransparencySpnBx->blockSignals( true );
mFrameColorButton->blockSignals( true );
mBackgroundColorButton->blockSignals( true );
mItemRotationSpinBox->blockSignals( true );

mBackgroundColorButton->setColor( mItem->brush().color() );
mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
Expand All @@ -348,6 +349,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()
mBlendModeCombo->setBlendMode( mItem->blendMode() );
mTransparencySlider->setValue( mItem->transparency() );
mTransparencySpnBx->setValue( mItem->transparency() );
mItemRotationSpinBox->setValue( mItem->itemRotation() );

mBackgroundColorButton->blockSignals( false );
mFrameColorButton->blockSignals( false );
Expand All @@ -359,6 +361,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()
mBlendModeCombo->blockSignals( false );
mTransparencySlider->blockSignals( false );
mTransparencySpnBx->blockSignals( false );
mItemRotationSpinBox->blockSignals( false );
}

void QgsComposerItemWidget::on_mBlendModeCombo_currentIndexChanged( int index )
Expand Down Expand Up @@ -495,3 +498,14 @@ void QgsComposerItemWidget::on_mLowerRightCheckBox_stateChanged( int state )
}
setValuesForGuiPositionElements();
}

void QgsComposerItemWidget::on_mItemRotationSpinBox_valueChanged( double val )
{
if ( mItem )
{
mItem->beginCommand( tr( "Item rotation changed" ), QgsComposerMergeCommand::ItemRotation );
mItem->setItemRotation( val );
mItem->update();
mItem->endCommand();
}
}
2 changes: 2 additions & 0 deletions src/app/composer/qgscomposeritemwidget.h
Expand Up @@ -73,6 +73,8 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa
void on_mBlendModeCombo_currentIndexChanged( int index );
void on_mTransparencySlider_valueChanged( int value );

void on_mItemRotationSpinBox_valueChanged( double val );

void setValuesForGuiElements();
void setValuesForGuiPositionElements();

Expand Down
13 changes: 0 additions & 13 deletions src/app/composer/qgscomposerlabelwidget.cpp
Expand Up @@ -228,17 +228,6 @@ void QgsComposerLabelWidget::on_mMiddleRadioButton_clicked()
}
}

void QgsComposerLabelWidget::on_mRotationSpinBox_valueChanged( double v )
{
if ( mComposerLabel )
{
mComposerLabel->beginCommand( tr( "Label rotation changed" ), QgsComposerMergeCommand::ItemRotation );
mComposerLabel->setItemRotation( v );
mComposerLabel->update();
mComposerLabel->endCommand();
}
}

void QgsComposerLabelWidget::setGuiElementValues()
{
blockAllSignals( true );
Expand All @@ -252,7 +241,6 @@ void QgsComposerLabelWidget::setGuiElementValues()
mLeftRadioButton->setChecked( mComposerLabel->hAlign() == Qt::AlignLeft );
mCenterRadioButton->setChecked( mComposerLabel->hAlign() == Qt::AlignHCenter );
mRightRadioButton->setChecked( mComposerLabel->hAlign() == Qt::AlignRight );
mRotationSpinBox->setValue( mComposerLabel->itemRotation() );
blockAllSignals( false );
}

Expand All @@ -267,5 +255,4 @@ void QgsComposerLabelWidget::blockAllSignals( bool block )
mLeftRadioButton->blockSignals( block );
mCenterRadioButton->blockSignals( block );
mRightRadioButton->blockSignals( block );
mRotationSpinBox->blockSignals( block );
}
1 change: 0 additions & 1 deletion src/app/composer/qgscomposerlabelwidget.h
Expand Up @@ -44,7 +44,6 @@ class QgsComposerLabelWidget: public QWidget, private Ui::QgsComposerLabelWidget
void on_mTopRadioButton_clicked();
void on_mBottomRadioButton_clicked();
void on_mMiddleRadioButton_clicked();
void on_mRotationSpinBox_valueChanged( double v );

private slots:
void setGuiElementValues();
Expand Down
13 changes: 0 additions & 13 deletions src/app/composer/qgscomposershapewidget.cpp
Expand Up @@ -53,7 +53,6 @@ QgsComposerShapeWidget::~QgsComposerShapeWidget()
void QgsComposerShapeWidget::blockAllSignals( bool block )
{
mShapeComboBox->blockSignals( block );
mRotationSpinBox->blockSignals( block );
mCornerRadiusSpinBox->blockSignals( block );
}

Expand All @@ -66,7 +65,6 @@ void QgsComposerShapeWidget::setGuiElementValues()

blockAllSignals( true );

mRotationSpinBox->setValue( mComposerShape->itemRotation() );
mCornerRadiusSpinBox->setValue( mComposerShape->cornerRadius() );
if ( mComposerShape->shapeType() == QgsComposerShape::Ellipse )
{
Expand All @@ -87,17 +85,6 @@ void QgsComposerShapeWidget::setGuiElementValues()
blockAllSignals( false );
}

void QgsComposerShapeWidget::on_mRotationSpinBox_valueChanged( int val )
{
if ( mComposerShape )
{
mComposerShape->beginCommand( tr( "Shape rotation changed" ), QgsComposerMergeCommand::ItemRotation );
mComposerShape->setItemRotation( val );
mComposerShape->update();
mComposerShape->endCommand();
}
}

void QgsComposerShapeWidget::on_mCornerRadiusSpinBox_valueChanged( double val )
{
if ( mComposerShape )
Expand Down
1 change: 0 additions & 1 deletion src/app/composer/qgscomposershapewidget.h
Expand Up @@ -38,7 +38,6 @@ class QgsComposerShapeWidget: public QWidget, private Ui::QgsComposerShapeWidget

private slots:
void on_mShapeComboBox_currentIndexChanged( const QString& text );
void on_mRotationSpinBox_valueChanged( int val );
void on_mCornerRadiusSpinBox_valueChanged( double val );

/**Sets the GUI elements to the currentValues of mComposerShape*/
Expand Down
32 changes: 32 additions & 0 deletions src/ui/qgscomposeritemwidgetbase.ui
Expand Up @@ -217,6 +217,38 @@
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mTransformsGroupBox">
<property name="title">
<string>Rotation</string>
</property>
<property name="syncGroup" stdset="0">
<string notr="true">composeritem</string>
</property>
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Rotation</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="mItemRotationSpinBox">
<property name="suffix">
<string> °</string>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mFrameGroupBox">
<property name="title">
Expand Down
29 changes: 0 additions & 29 deletions src/ui/qgscomposerlabelwidgetbase.ui
Expand Up @@ -299,35 +299,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mRotationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Rotation</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mRotationSpinBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="mRotationSpinBox">
<property name="suffix">
<string> °</string>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
22 changes: 1 addition & 21 deletions src/ui/qgscomposershapewidgetbase.ui
Expand Up @@ -72,33 +72,13 @@
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Rotation</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="mRotationSpinBox">
<property name="suffix">
<string> °</string>
</property>
<property name="prefix">
<string comment="Rotation" extracomment="Rotation"/>
</property>
<property name="maximum">
<number>359</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Corner radius</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="mCornerRadiusSpinBox">
<property name="suffix">
<string> mm</string>
Expand Down

0 comments on commit 4169aa7

Please sign in to comment.