Skip to content
Permalink
Browse files

Only show extent of open composer windows

  • Loading branch information
nyalldawson committed Jun 1, 2017
1 parent 7921de3 commit 8152a0069663c10e8cfd1f2f16c89689515efa06
Showing with 17 additions and 8 deletions.
  1. +4 −2 src/app/qgsdecorationlayoutextent.cpp
  2. +13 −6 src/app/qgsdecorationlayoutextent.h
@@ -25,7 +25,7 @@
#include "qgsgeometry.h"
#include "qgscsexception.h"
#include "qgslinesymbollayer.h"

#include "qgscomposer.h"
#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgslogger.h"
@@ -109,8 +109,10 @@ void QgsDecorationLayoutExtent::render( const QgsMapSettings &mapSettings, QgsRe
const QgsMapToPixel &m2p = mapSettings.mapToPixel();
QTransform transform = m2p.transform();

Q_FOREACH ( QgsComposition *composition, QgsProject::instance()->layoutManager()->compositions() )
// only loop through open composers
Q_FOREACH ( QgsComposer *composer, QgisApp::instance()->printComposers() )
{
QgsComposition *composition = composer->composition();
Q_FOREACH ( const QgsComposerMap *map, composition->composerMapItems() )
{
QPolygonF extent = map->visibleExtentPolygon();
@@ -34,21 +34,28 @@ class APP_EXPORT QgsDecorationLayoutExtent : public QgsDecorationItem
Q_OBJECT
public:

//! Constructor
/**
* Constructor for QgsDecorationLayoutExtent.
*/
QgsDecorationLayoutExtent( QObject *parent = nullptr );

/**
* Returns the fill symbol used for shading layout extents.
* \see setSymbol()
*/
QgsFillSymbol *symbol() const;

/**
* Sets the fill \a symbol used for shading layout extents. Ownership of
* \a symbol is transferred.
* \see symbol()
*/
void setSymbol( QgsFillSymbol *symbol SIP_TRANSFER );

public slots:
//! set values on the gui when a project is read or the gui first loaded
void projectRead() override;
//! save values to the project
void saveToProject() override;

//! Show the dialog box
void run() override;
//! render the copyright label
void render( const QgsMapSettings &mapSettings, QgsRenderContext &context ) override;

private:

0 comments on commit 8152a00

Please sign in to comment.
You can’t perform that action at this time.