Skip to content

Commit 2d7cd38

Browse files
committedMay 1, 2014
[composer] Refresh view action now also reloads html items and refreshes attribute table features.
1 parent 8eb929a commit 2d7cd38

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed
 

‎python/core/composer/qgscomposition.sip

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,12 @@ class QgsComposition : QGraphicsScene
408408
@note added in version 2.2*/
409409
void updateBounds();
410410

411+
/**Forces items in the composition to refresh. For instance, this causes maps to redraw
412+
* and rebuild cached images, html items to reload their source url, and attribute tables
413+
* to refresh their contents.
414+
@note added in version 2.3*/
415+
void refreshItems();
416+
411417
protected:
412418
void init();
413419

@@ -441,4 +447,7 @@ class QgsComposition : QGraphicsScene
441447
void composerTableAdded( QgsComposerAttributeTable* table );
442448
/**Is emitted when a composer item has been removed from the scene*/
443449
void itemRemoved( QgsComposerItem* );
450+
451+
/**Is emitted when item in the composition must be refreshed*/
452+
void refreshItemsTriggered();
444453
};

‎src/app/composer/qgscomposer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ void QgsComposer::on_mActionRefreshView_triggered()
10221022
}
10231023
}
10241024

1025+
mComposition->refreshItems();
10251026
mComposition->update();
10261027
}
10271028

‎src/core/composer/qgscomposerattributetable.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* compositio
6666
}
6767
}
6868
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );
69+
70+
if ( mComposition )
71+
{
72+
connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( refreshAttributes() ) );
73+
}
6974
}
7075

7176
QgsComposerAttributeTable::~QgsComposerAttributeTable()

‎src/core/composer/qgscomposerhtml.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ QgsComposerHtml::QgsComposerHtml( QgsComposition* c, bool createUndoCommands ):
3636
if ( mComposition )
3737
{
3838
QObject::connect( mComposition, SIGNAL( itemRemoved( QgsComposerItem* ) ), this, SLOT( handleFrameRemoval( QgsComposerItem* ) ) );
39+
connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( loadHtml() ) );
3940
}
4041
}
4142

‎src/core/composer/qgscomposition.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ void QgsComposition::updateBounds()
181181
setSceneRect( compositionBounds() );
182182
}
183183

184+
void QgsComposition::refreshItems()
185+
{
186+
emit refreshItemsTriggered();
187+
}
188+
184189
QRectF QgsComposition::compositionBounds() const
185190
{
186191
//start with an empty rectangle

‎src/core/composer/qgscomposition.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
464464
@note added in version 2.2*/
465465
void updateBounds();
466466

467+
/**Forces items in the composition to refresh. For instance, this causes maps to redraw
468+
* and rebuild cached images, html items to reload their source url, and attribute tables
469+
* to refresh their contents.
470+
@note added in version 2.3*/
471+
void refreshItems();
472+
467473
protected:
468474
void init();
469475

@@ -596,6 +602,9 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
596602
/**Is emitted when a composer item has been removed from the scene*/
597603
void itemRemoved( QgsComposerItem* );
598604

605+
/**Is emitted when item in the composition must be refreshed*/
606+
void refreshItemsTriggered();
607+
599608
/**Is emitted when the composition has an updated status bar message for the composer window*/
600609
void statusMsgChanged( QString message );
601610
};

0 commit comments

Comments
 (0)
Please sign in to comment.