Skip to content

Commit 8152a00

Browse files
committedJun 1, 2017
Only show extent of open composer windows
1 parent 7921de3 commit 8152a00

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed
 

‎src/app/qgsdecorationlayoutextent.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "qgsgeometry.h"
2626
#include "qgscsexception.h"
2727
#include "qgslinesymbollayer.h"
28-
28+
#include "qgscomposer.h"
2929
#include "qgisapp.h"
3030
#include "qgsapplication.h"
3131
#include "qgslogger.h"
@@ -109,8 +109,10 @@ void QgsDecorationLayoutExtent::render( const QgsMapSettings &mapSettings, QgsRe
109109
const QgsMapToPixel &m2p = mapSettings.mapToPixel();
110110
QTransform transform = m2p.transform();
111111

112-
Q_FOREACH ( QgsComposition *composition, QgsProject::instance()->layoutManager()->compositions() )
112+
// only loop through open composers
113+
Q_FOREACH ( QgsComposer *composer, QgisApp::instance()->printComposers() )
113114
{
115+
QgsComposition *composition = composer->composition();
114116
Q_FOREACH ( const QgsComposerMap *map, composition->composerMapItems() )
115117
{
116118
QPolygonF extent = map->visibleExtentPolygon();

‎src/app/qgsdecorationlayoutextent.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,28 @@ class APP_EXPORT QgsDecorationLayoutExtent : public QgsDecorationItem
3434
Q_OBJECT
3535
public:
3636

37-
//! Constructor
37+
/**
38+
* Constructor for QgsDecorationLayoutExtent.
39+
*/
3840
QgsDecorationLayoutExtent( QObject *parent = nullptr );
3941

42+
/**
43+
* Returns the fill symbol used for shading layout extents.
44+
* \see setSymbol()
45+
*/
4046
QgsFillSymbol *symbol() const;
47+
48+
/**
49+
* Sets the fill \a symbol used for shading layout extents. Ownership of
50+
* \a symbol is transferred.
51+
* \see symbol()
52+
*/
4153
void setSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
4254

4355
public slots:
44-
//! set values on the gui when a project is read or the gui first loaded
4556
void projectRead() override;
46-
//! save values to the project
4757
void saveToProject() override;
48-
49-
//! Show the dialog box
5058
void run() override;
51-
//! render the copyright label
5259
void render( const QgsMapSettings &mapSettings, QgsRenderContext &context ) override;
5360

5461
private:

0 commit comments

Comments
 (0)
Please sign in to comment.