Skip to content
Permalink
Browse files

[layout] Add printLayouts to return all print layouts contained in th…

…e manager
  • Loading branch information
elpaso committed Jan 10, 2018
1 parent 880d853 commit f868bcc691d5f7fd974a4aa0da430dfc57121006
@@ -84,6 +84,11 @@ Removes and deletes all layouts from the manager.
Returns a list of all layouts contained in the manager.
%End

QList< QgsPrintLayout * > printLayouts() const;
%Docstring
Returns a list of all print layouts contained in the manager.
%End


QgsMasterLayoutInterface *layoutByName( const QString &name ) const;
%Docstring
@@ -140,6 +140,19 @@ QList<QgsMasterLayoutInterface *> QgsLayoutManager::layouts() const
return mLayouts;
}

QList<QgsPrintLayout *> QgsLayoutManager::printLayouts() const
{
QList<QgsPrintLayout *> result;
const QList<QgsMasterLayoutInterface *> _layouts( mLayouts );
for ( const auto &layout : _layouts )
{
QgsPrintLayout *_item( dynamic_cast<QgsPrintLayout *>( layout ) );
if ( _item )
result.push_back( _item );
}
return result;
}

QgsComposition *QgsLayoutManager::compositionByName( const QString &name ) const
{
Q_FOREACH ( QgsComposition *c, mCompositions )
@@ -23,6 +23,7 @@
#include <QObject>

class QgsProject;
class QgsPrintLayout;

/**
* \ingroup core
@@ -110,6 +111,11 @@ class CORE_EXPORT QgsLayoutManager : public QObject
*/
QList< QgsMasterLayoutInterface * > layouts() const;

/**
* Returns a list of all print layouts contained in the manager.
*/
QList< QgsPrintLayout * > printLayouts() const;

/**
* Returns the composition with a matching name, or nullptr if no matching compositions
* were found.

0 comments on commit f868bcc

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