[composer] Refresh view action now also reloads html items and refreshes attribute table features.

This commit is contained in:
Nyall Dawson 2014-05-01 23:00:33 +10:00
parent 8eb929aeda
commit 2d7cd38b45
6 changed files with 30 additions and 0 deletions

View File

@ -408,6 +408,12 @@ class QgsComposition : QGraphicsScene
@note added in version 2.2*/
void updateBounds();
/**Forces items in the composition to refresh. For instance, this causes maps to redraw
* and rebuild cached images, html items to reload their source url, and attribute tables
* to refresh their contents.
@note added in version 2.3*/
void refreshItems();
protected:
void init();
@ -441,4 +447,7 @@ class QgsComposition : QGraphicsScene
void composerTableAdded( QgsComposerAttributeTable* table );
/**Is emitted when a composer item has been removed from the scene*/
void itemRemoved( QgsComposerItem* );
/**Is emitted when item in the composition must be refreshed*/
void refreshItemsTriggered();
};

View File

@ -1022,6 +1022,7 @@ void QgsComposer::on_mActionRefreshView_triggered()
}
}
mComposition->refreshItems();
mComposition->update();
}

View File

@ -66,6 +66,11 @@ QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* compositio
}
}
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );
if ( mComposition )
{
connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( refreshAttributes() ) );
}
}
QgsComposerAttributeTable::~QgsComposerAttributeTable()

View File

@ -36,6 +36,7 @@ QgsComposerHtml::QgsComposerHtml( QgsComposition* c, bool createUndoCommands ):
if ( mComposition )
{
QObject::connect( mComposition, SIGNAL( itemRemoved( QgsComposerItem* ) ), this, SLOT( handleFrameRemoval( QgsComposerItem* ) ) );
connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( loadHtml() ) );
}
}

View File

@ -181,6 +181,11 @@ void QgsComposition::updateBounds()
setSceneRect( compositionBounds() );
}
void QgsComposition::refreshItems()
{
emit refreshItemsTriggered();
}
QRectF QgsComposition::compositionBounds() const
{
//start with an empty rectangle

View File

@ -464,6 +464,12 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
@note added in version 2.2*/
void updateBounds();
/**Forces items in the composition to refresh. For instance, this causes maps to redraw
* and rebuild cached images, html items to reload their source url, and attribute tables
* to refresh their contents.
@note added in version 2.3*/
void refreshItems();
protected:
void init();
@ -596,6 +602,9 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
/**Is emitted when a composer item has been removed from the scene*/
void itemRemoved( QgsComposerItem* );
/**Is emitted when item in the composition must be refreshed*/
void refreshItemsTriggered();
/**Is emitted when the composition has an updated status bar message for the composer window*/
void statusMsgChanged( QString message );
};