Skip to content
Permalink
Browse files

Add QgsLayout subclass, QgsPrintLayout

A print layout is a layout with an atlas
  • Loading branch information
nyalldawson committed Dec 19, 2017
1 parent bd7784c commit e6a6db89a179924bab102fdcac4c1e426be5d717
@@ -437,6 +437,7 @@
%Include layout/qgslayouttable.sip
%Include layout/qgslayouttablecolumn.sip
%Include layout/qgslayoutundostack.sip
%Include layout/qgsprintlayout.sip
%Include symbology/qgscptcityarchive.sip
%Include symbology/qgssvgcache.sip
%Include symbology/qgsstyle.sip
@@ -29,7 +29,7 @@ QgsLayoutAtlas which is automatically created and attached to the composition.
%End
public:

QgsLayoutAtlas( QgsLayout *layout );
QgsLayoutAtlas( QgsLayout *layout /TransferThis/ );
%Docstring
Constructor for new QgsLayoutAtlas.
%End
@@ -0,0 +1,42 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgsprintlayout.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsPrintLayout : QgsLayout
{
%Docstring
Print layout, a QgsLayout subclass for static or atlas-based layouts.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprintlayout.h"
%End
public:

QgsPrintLayout( QgsProject *project );
%Docstring
Constructor for QgsPrintLayout.
%End

QgsLayoutAtlas *atlas();
%Docstring
Returns the print layout's atlas.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgsprintlayout.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -412,6 +412,7 @@ SET(QGIS_CORE_SRCS
layout/qgslayoutpoint.cpp
layout/qgslayoutserializableobject.cpp
layout/qgslayoutsize.cpp
layout/qgsprintlayout.cpp

pal/costcalculator.cpp
pal/feature.cpp
@@ -770,6 +771,7 @@ SET(QGIS_CORE_MOC_HDRS
layout/qgslayouttable.h
layout/qgslayouttablecolumn.h
layout/qgslayoutundostack.h
layout/qgsprintlayout.h

symbology/qgscptcityarchive.h
symbology/qgssvgcache.h
@@ -22,7 +22,8 @@
#include "qgslayout.h"

QgsLayoutAtlas::QgsLayoutAtlas( QgsLayout *layout )
: mLayout( layout )
: QObject( layout )
, mLayout( layout )
, mFilenameExpressionString( QStringLiteral( "'output_'||@atlas_featurenumber" ) )
{

@@ -40,7 +40,7 @@ class CORE_EXPORT QgsLayoutAtlas : public QObject
/**
* Constructor for new QgsLayoutAtlas.
*/
QgsLayoutAtlas( QgsLayout *layout );
QgsLayoutAtlas( QgsLayout *layout SIP_TRANSFERTHIS );

/**
* Returns whether the atlas generation is enabled
@@ -0,0 +1,24 @@
/***************************************************************************
qgsprintlayout.cpp
-------------------
begin : December 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsprintlayout.h"
#include "qgslayoutatlas.h"

QgsPrintLayout::QgsPrintLayout( QgsProject *project )
: QgsLayout( project )
, mAtlas( new QgsLayoutAtlas( this ) )
{
}
@@ -0,0 +1,52 @@
/***************************************************************************
qgsprintlayout.h
-------------------
begin : December 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPRINTLAYOUT_H
#define QGSPRINTLAYOUT_H

#include "qgis_core.h"
#include "qgslayout.h"

class QgsLayoutAtlas;

/**
* \ingroup core
* \class QgsPrintLayout
* \brief Print layout, a QgsLayout subclass for static or atlas-based layouts.
* \since QGIS 3.0
*/
class CORE_EXPORT QgsPrintLayout : public QgsLayout
{
Q_OBJECT

public:

/**
* Constructor for QgsPrintLayout.
*/
QgsPrintLayout( QgsProject *project );

/**
* Returns the print layout's atlas.
*/
QgsLayoutAtlas *atlas();

private:

QgsLayoutAtlas *mAtlas = nullptr;

};

#endif //QGSPRINTLAYOUT_H

0 comments on commit e6a6db8

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