Skip to content

Commit bcd9f04

Browse files
committedJul 20, 2013
composer item group: fix destruction
1 parent 401b637 commit bcd9f04

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
 

‎src/core/composer/qgscomposeritemgroup.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
#include <QPen>
2222
#include <QPainter>
2323

24-
QgsComposerItemGroup::QgsComposerItemGroup( QgsComposition* c ): QgsComposerItem( c )
24+
QgsComposerItemGroup::QgsComposerItemGroup( QgsComposition* c )
25+
: QgsComposerItem( c )
2526
{
2627
setZValue( 90 );
2728
show();
@@ -51,6 +52,9 @@ void QgsComposerItemGroup::addItem( QgsComposerItem* item )
5152
{
5253
return;
5354
}
55+
56+
connect( item, SIGNAL( destroyed() ), this, SLOT( itemDestroyed() ) );
57+
5458
mItems.insert( item );
5559
item->setSelected( false );
5660
item->setFlag( QGraphicsItem::ItemIsSelectable, false ); //item in groups cannot be selected
@@ -68,7 +72,6 @@ void QgsComposerItemGroup::addItem( QgsComposerItem* item )
6872
mSceneBoundingRectangle.setRight( maxXItem );
6973
mSceneBoundingRectangle.setBottom( maxYItem );
7074
}
71-
7275
else
7376
{
7477
if ( minXItem < mSceneBoundingRectangle.left() )
@@ -103,6 +106,11 @@ void QgsComposerItemGroup::removeItems()
103106
mItems.clear();
104107
}
105108

109+
void QgsComposerItemGroup::itemDestroyed()
110+
{
111+
mItems.remove( static_cast<QgsComposerItem*>( sender() ) );
112+
}
113+
106114
void QgsComposerItemGroup::paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget )
107115
{
108116
Q_UNUSED( option );

‎src/core/composer/qgscomposeritemgroup.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class CORE_EXPORT QgsComposerItemGroup: public QgsComposerItem
5959
signals:
6060
void childItemDeleted( QgsComposerItem* item );
6161

62+
public slots:
63+
void itemDestroyed();
64+
6265
protected:
6366
void drawFrame( QPainter* p );
6467

0 commit comments

Comments
 (0)
Please sign in to comment.