Skip to content

Commit

Permalink
Only show extent of open composer windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 1, 2017
1 parent 7921de3 commit 8152a00
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/app/qgsdecorationlayoutextent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down
19 changes: 13 additions & 6 deletions src/app/qgsdecorationlayoutextent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8152a00

Please sign in to comment.