Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add signal / slot for adding composer html
  • Loading branch information
mhugent committed Jul 26, 2012
1 parent b9d2615 commit 590929d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -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 );
Expand Down
3 changes: 3 additions & 0 deletions src/app/composer/qgscomposer.h
Expand Up @@ -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 );

Expand Down
13 changes: 12 additions & 1 deletion src/core/composer/qgscomposermultiframe.cpp
Expand Up @@ -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 );
Expand All @@ -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();
}
}*/
1 change: 1 addition & 0 deletions src/core/composer/qgscomposermultiframe.h
Expand Up @@ -54,6 +54,7 @@ class QgsComposerMultiFrame: public QObject

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

private:
QgsComposerMultiFrame(); //forbidden
Expand Down
6 changes: 6 additions & 0 deletions src/core/composer/qgscomposition.cpp
Expand Up @@ -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 );
Expand Down
5 changes: 5 additions & 0 deletions src/core/composer/qgscomposition.h
Expand Up @@ -31,6 +31,7 @@ class QGraphicsRectItem;
class QgsMapRenderer;
class QDomElement;
class QgsComposerArrow;
class QgsComposerHtml;
class QgsComposerItem;
class QgsComposerLabel;
class QgsComposerLegend;
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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*/
Expand Down

0 comments on commit 590929d

Please sign in to comment.