Skip to content
Permalink
Browse files
[composer] Move item rotation control to item widget panel
  • 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.
@@ -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" ) );
@@ -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 );
@@ -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 )
@@ -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();
}
}
@@ -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();

@@ -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 );
@@ -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 );
}

@@ -267,5 +255,4 @@ void QgsComposerLabelWidget::blockAllSignals( bool block )
mLeftRadioButton->blockSignals( block );
mCenterRadioButton->blockSignals( block );
mRightRadioButton->blockSignals( block );
mRotationSpinBox->blockSignals( block );
}
@@ -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();
@@ -53,7 +53,6 @@ QgsComposerShapeWidget::~QgsComposerShapeWidget()
void QgsComposerShapeWidget::blockAllSignals( bool block )
{
mShapeComboBox->blockSignals( block );
mRotationSpinBox->blockSignals( block );
mCornerRadiusSpinBox->blockSignals( block );
}

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

blockAllSignals( true );

mRotationSpinBox->setValue( mComposerShape->itemRotation() );
mCornerRadiusSpinBox->setValue( mComposerShape->cornerRadius() );
if ( mComposerShape->shapeType() == QgsComposerShape::Ellipse )
{
@@ -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 )
@@ -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*/
@@ -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">
@@ -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>
@@ -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>

0 comments on commit 4169aa7

Please sign in to comment.