Add signal / slot for adding composer html

This commit is contained in:
Marco Hugentobler 2012-07-26 11:37:48 +02:00
parent b9d2615e7c
commit 590929dfac
6 changed files with 37 additions and 1 deletions

View File

@ -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 );

View File

@ -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 );

View File

@ -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();
}
}*/

View File

@ -54,6 +54,7 @@ class QgsComposerMultiFrame: public QObject
protected slots:
void recalculateFrameSizes();
//void removeFrame( QObject* frame );
private:
QgsComposerMultiFrame(); //forbidden

View File

@ -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 );

View File

@ -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*/