Skip to content
Permalink
Browse files

[composer] Allow item rotation from -360->360

Fix #12696
  • Loading branch information
nyalldawson committed May 30, 2017
1 parent efe6109 commit 6f368bed6ac21d59f9409b18b99bd0431eebe1fd
@@ -150,6 +150,8 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget *parent, QgsComposerItem *

setupUi( this );

mItemRotationSpinBox->setClearValue( 0 );

//make button exclusive
QButtonGroup *buttonGroup = new QButtonGroup( this );
buttonGroup->addButton( mUpperLeftCheckBox );
@@ -1009,13 +1009,10 @@ double QgsComposerItem::rectHandlerBorderTolerance() const

void QgsComposerItem::setItemRotation( const double r, const bool adjustPosition )
{
if ( r >= 360 )
mItemRotation = r;
if ( mItemRotation >= 360.0 || mItemRotation <= -360.0 )
{
mItemRotation = ( static_cast< int >( r ) ) % 360;
}
else
{
mItemRotation = r;
mItemRotation = fmod( mItemRotation, 360.0 );
}

QgsExpressionContext context = createExpressionContext();
@@ -427,13 +427,13 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec
*/
bool positionLock() const { return mItemPositionLocked; }

/** Returns the current rotation for the composer item.
* \returns rotation for composer item
/**
* Returns the current rotation for the composer item, in degrees clockwise.
* \param valueType controls whether the returned value is the user specified rotation,
* or the current evaluated rotation (which may be affected by data driven rotation
* settings).
* \since QGIS 2.1
* \see setItemRotation
* \see setItemRotation()
*/
double itemRotation( const QgsComposerObject::PropertyValueType valueType = QgsComposerObject::EvaluatedValue ) const;

@@ -555,14 +555,15 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec

public slots:

/** Sets the item rotation
* \param r item rotation in degrees
/**
* Sets the item \a rotation, in degrees clockwise.
* \param rotation item rotation in degrees
* \param adjustPosition set to true if item should be shifted so that rotation occurs
* around item center. If false, rotation occurs around item origin
* \since QGIS 2.1
* \see itemRotation
*/
virtual void setItemRotation( const double r, const bool adjustPosition = false );
virtual void setItemRotation( const double rotation, const bool adjustPosition = false );

void repaint() override;

@@ -374,6 +374,9 @@
<property name="suffix">
<string> °</string>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>

0 comments on commit 6f368be

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