Skip to content

Commit

Permalink
[composer] Follow up 2b3108f, fix calculation of bounding rect after …
Browse files Browse the repository at this point in the history
…resizing composer shapes
  • Loading branch information
nyalldawson committed Apr 11, 2014
1 parent 9864bfc commit bead88a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/composer/qgscomposershape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,11 @@ void QgsComposerShape::updateBoundingRect()
mCurrentRectangle = rectangle;
}
}

void QgsComposerShape::setSceneRect( const QRectF& rectangle )
{
// Reimplemented from QgsComposerItem as we need to call updateBoundingRect after the shape's size changes
QgsComposerItem::setSceneRect( rectangle );
updateBoundingRect();
update();
}
5 changes: 5 additions & 0 deletions src/core/composer/qgscomposershape.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class CORE_EXPORT QgsComposerShape: public QgsComposerItem
@note this function was added in version 2.3*/
QRectF boundingRect() const;

/**Sets new scene rectangle bounds and recalculates hight and extent. Reimplemented from
* QgsComposerItem as it needs to call updateBoundingRect after the shape's size changes
*/
void setSceneRect( const QRectF& rectangle );

protected:
/* reimplement drawFrame, since it's not a rect, but a custom shape */
virtual void drawFrame( QPainter* p );
Expand Down

0 comments on commit bead88a

Please sign in to comment.