Skip to content
Permalink
Browse files

Add signal / slot for adding composer html

  • Loading branch information
mhugent committed Jul 26, 2012
1 parent b9d2615 commit 590929dfac2a93024d8d039d365e7713d9ddee26
@@ -1337,6 +1337,16 @@ void QgsComposer::addComposerTable( QgsComposerAttributeTable* table )
mItemWidgetMap.insert( table, tWidget );
}

void QgsComposer::addComposerHtml( QgsComposerHtml* html )
{
if ( !html )
{
return;
}

//todo: create html widget and create entry for each frame in the item/widget map
}

void QgsComposer::deleteItem( QgsComposerItem* item )
{
QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.find( item );
@@ -246,6 +246,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
/**Adds a composer table to the item/widget map and creates a configuration widget*/
void addComposerTable( QgsComposerAttributeTable* table );

/**Adds composer html and creates a configuration widget*/
void addComposerHtml( QgsComposerHtml* html );

/**Removes item from the item/widget map and deletes the configuration widget. Does not delete the item itself*/
void deleteItem( QgsComposerItem* item );

@@ -93,7 +93,7 @@ void QgsComposerMultiFrame::addFrame( QgsComposerFrame* frame )
{
mFrameItems.push_back( frame );
QObject::connect( frame, SIGNAL( sizeChanged() ), this, SLOT( recalculateFrameSizes() ) );
QObject::connect( frame, SIGNAL( destroyed() ), this, SLOT( recalculateFrameSizes() ) );
// QObject::connect( frame, SIGNAL( destroyed( QObject* ) ), this, SLOT( removeFrame( QObject* ) ) );
if ( mComposition )
{
mComposition->addItem( frame );
@@ -109,3 +109,14 @@ void QgsComposerMultiFrame::removeFrame( int i )
}
mFrameItems.removeAt( i );
}

/*
void QgsComposerMultiFrame::removeFrame( QObject* frame )
{
QgsComposerFrame* composerFrame = dynamic_cast<QgsComposerFrame*>( frame );
if( composerFrame )
{
removeFrame( mFrameItems.indexOf( composerFrame ) );
recalculateFrameSizes();
}
}*/
@@ -54,6 +54,7 @@ class QgsComposerMultiFrame: public QObject

protected slots:
void recalculateFrameSizes();
//void removeFrame( QObject* frame );

private:
QgsComposerMultiFrame(); //forbidden
@@ -1096,6 +1096,12 @@ void QgsComposition::addComposerTable( QgsComposerAttributeTable* table )
emit selectedItemChanged( table );
}

void QgsComposition::addComposerHtml( QgsComposerHtml* html )
{
emit composerHtmlAdded( html );
clearSelection();
}

void QgsComposition::removeComposerItem( QgsComposerItem* item )
{
QgsComposerMap* map = dynamic_cast<QgsComposerMap *>( item );
@@ -31,6 +31,7 @@ class QGraphicsRectItem;
class QgsMapRenderer;
class QDomElement;
class QgsComposerArrow;
class QgsComposerHtml;
class QgsComposerItem;
class QgsComposerLabel;
class QgsComposerLegend;
@@ -214,6 +215,8 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
void addComposerShape( QgsComposerShape* shape );
/**Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerTable( QgsComposerAttributeTable* table );
/**Adds composer html and advices composer to create a widget for it (through signal)*/
void addComposerHtml( QgsComposerHtml* html );

/**Remove item from the graphics scene. Additionally to QGraphicsScene::removeItem, this function considers undo/redo command*/
void removeComposerItem( QgsComposerItem* item );
@@ -298,6 +301,8 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
void selectedItemChanged( QgsComposerItem* selected );
/**Is emitted when new composer arrow has been added to the view*/
void composerArrowAdded( QgsComposerArrow* arrow );
/**Is emitted when a new composer html has been added to the view*/
void composerHtmlAdded( QgsComposerHtml* html );
/**Is emitted when new composer label has been added to the view*/
void composerLabelAdded( QgsComposerLabel* label );
/**Is emitted when new composer map has been added to the view*/

0 comments on commit 590929d

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