Skip to content
Permalink
Browse files
composer item group: fix destruction
  • Loading branch information
jef-n committed Jul 20, 2013
1 parent 401b637 commit bcd9f0426f31f854f6cdeacd7b65d3fc63d1e559
Showing with 13 additions and 2 deletions.
  1. +10 −2 src/core/composer/qgscomposeritemgroup.cpp
  2. +3 −0 src/core/composer/qgscomposeritemgroup.h
@@ -21,7 +21,8 @@
#include <QPen>
#include <QPainter>

QgsComposerItemGroup::QgsComposerItemGroup( QgsComposition* c ): QgsComposerItem( c )
QgsComposerItemGroup::QgsComposerItemGroup( QgsComposition* c )
: QgsComposerItem( c )
{
setZValue( 90 );
show();
@@ -51,6 +52,9 @@ void QgsComposerItemGroup::addItem( QgsComposerItem* item )
{
return;
}

connect( item, SIGNAL( destroyed() ), this, SLOT( itemDestroyed() ) );

mItems.insert( item );
item->setSelected( false );
item->setFlag( QGraphicsItem::ItemIsSelectable, false ); //item in groups cannot be selected
@@ -68,7 +72,6 @@ void QgsComposerItemGroup::addItem( QgsComposerItem* item )
mSceneBoundingRectangle.setRight( maxXItem );
mSceneBoundingRectangle.setBottom( maxYItem );
}

else
{
if ( minXItem < mSceneBoundingRectangle.left() )
@@ -103,6 +106,11 @@ void QgsComposerItemGroup::removeItems()
mItems.clear();
}

void QgsComposerItemGroup::itemDestroyed()
{
mItems.remove( static_cast<QgsComposerItem*>( sender() ) );
}

void QgsComposerItemGroup::paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget )
{
Q_UNUSED( option );
@@ -59,6 +59,9 @@ class CORE_EXPORT QgsComposerItemGroup: public QgsComposerItem
signals:
void childItemDeleted( QgsComposerItem* item );

public slots:
void itemDestroyed();

protected:
void drawFrame( QPainter* p );

0 comments on commit bcd9f04

Please sign in to comment.