2017-06-20 13:34:27 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2018-01-08 12:18:07 +10:00
|
|
|
* src/core/layout/qgslayoutmanager.h *
|
2017-06-20 13:34:27 +02:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-15 15:07:37 +10:00
|
|
|
class QgsLayoutManager : QObject
|
|
|
|
{
|
2021-03-22 21:13:52 +01:00
|
|
|
%Docstring(signature="appended")
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-05-26 14:10:30 +10:00
|
|
|
Manages storage of a set of layouts.
|
2017-06-20 13:34:27 +02:00
|
|
|
|
2021-01-30 09:16:35 +10:00
|
|
|
:py:class:`QgsLayoutManager` handles the storage, serializing and deserializing
|
2018-01-17 07:51:06 +10:00
|
|
|
of print layouts and reports. Usually this class is not constructed directly, but
|
2021-01-30 09:16:35 +10:00
|
|
|
rather accessed through a :py:class:`QgsProject` via :py:func:`QgsProject.layoutManager()`.
|
2017-06-20 13:34:27 +02:00
|
|
|
|
2021-01-30 09:16:35 +10:00
|
|
|
:py:class:`QgsLayoutManager` retains ownership of all the layouts contained
|
2017-12-15 10:36:55 -04:00
|
|
|
in the manager.
|
2018-05-28 22:03:46 +10:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
|
|
|
|
2017-03-15 15:07:37 +10:00
|
|
|
%TypeHeaderCode
|
2017-06-20 13:34:27 +02:00
|
|
|
#include "qgslayoutmanager.h"
|
2017-03-15 15:07:37 +10:00
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
explicit QgsLayoutManager( QgsProject *project /TransferThis/ = 0 );
|
2017-06-20 13:34:27 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor for QgsLayoutManager. The project will become the parent object for this
|
|
|
|
manager.
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
2017-03-15 15:07:37 +10:00
|
|
|
|
|
|
|
~QgsLayoutManager();
|
2017-06-20 13:34:27 +02:00
|
|
|
|
2017-12-29 17:56:33 +10:00
|
|
|
bool addLayout( QgsMasterLayoutInterface *layout /Transfer/ );
|
2017-12-05 15:27:49 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Adds a ``layout`` to the manager. Ownership of the layout is transferred to the manager.
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if the addition was successful, or ``False`` if the layout could not be added (eg
|
2017-12-15 10:36:55 -04:00
|
|
|
as a result of a duplicate layout name).
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeLayout`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layoutAdded`
|
2017-12-05 15:27:49 +10:00
|
|
|
%End
|
|
|
|
|
2017-12-29 17:56:33 +10:00
|
|
|
bool removeLayout( QgsMasterLayoutInterface *layout );
|
2017-12-05 15:27:49 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Removes a ``layout`` from the manager. The layout is deleted.
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if the removal was successful, or ``False`` if the removal failed (eg as a result
|
2017-12-15 10:36:55 -04:00
|
|
|
of removing a layout which is not contained in the manager).
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`addLayout`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layoutRemoved`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layoutAboutToBeRemoved`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`clear`
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
2017-03-15 15:07:37 +10:00
|
|
|
|
|
|
|
void clear();
|
2017-06-20 13:34:27 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Removes and deletes all layouts from the manager.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeLayout`
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
|
|
|
|
2017-12-29 17:56:33 +10:00
|
|
|
QList< QgsMasterLayoutInterface * > layouts() const;
|
2017-12-05 15:27:49 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of all layouts contained in the manager.
|
2017-12-05 15:27:49 +10:00
|
|
|
%End
|
|
|
|
|
2018-01-10 17:58:47 +01:00
|
|
|
QList< QgsPrintLayout * > printLayouts() const;
|
|
|
|
%Docstring
|
|
|
|
Returns a list of all print layouts contained in the manager.
|
|
|
|
%End
|
|
|
|
|
2017-12-29 17:56:33 +10:00
|
|
|
QgsMasterLayoutInterface *layoutByName( const QString &name ) const;
|
2017-12-05 15:27:49 +10:00
|
|
|
%Docstring
|
2019-02-26 21:19:42 +10:00
|
|
|
Returns the layout with a matching name, or ``None`` if no matching layouts
|
2017-12-15 10:36:55 -04:00
|
|
|
were found.
|
2017-12-05 15:27:49 +10:00
|
|
|
%End
|
|
|
|
|
2017-03-17 20:52:57 +10:00
|
|
|
bool readXml( const QDomElement &element, const QDomDocument &doc );
|
2017-06-20 13:34:27 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reads the manager's state from a DOM element, restoring all layouts
|
|
|
|
present in the XML document.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`writeXml`
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
|
|
|
|
2017-03-17 20:52:57 +10:00
|
|
|
QDomElement writeXml( QDomDocument &doc ) const;
|
2017-06-20 13:34:27 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a DOM element representing the state of the manager.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`readXml`
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
|
|
|
|
2017-12-29 17:56:33 +10:00
|
|
|
QgsMasterLayoutInterface *duplicateLayout( const QgsMasterLayoutInterface *layout, const QString &newName );
|
2017-12-04 16:33:37 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Duplicates an existing ``layout`` from the manager. The new
|
|
|
|
layout will automatically be stored in the manager.
|
2020-06-19 20:28:18 +02:00
|
|
|
Returns the new layout if duplication was successful.
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
2017-03-15 15:07:37 +10:00
|
|
|
|
2018-01-05 12:51:52 +10:00
|
|
|
QString generateUniqueTitle( QgsMasterLayoutInterface::Type type = QgsMasterLayoutInterface::PrintLayout ) const;
|
2017-12-05 15:27:49 +10:00
|
|
|
%Docstring
|
2018-01-05 12:51:52 +10:00
|
|
|
Generates a unique title for a new layout of the specified ``type``, which does not
|
2017-12-15 10:36:55 -04:00
|
|
|
clash with any already contained by the manager.
|
2019-07-03 14:57:40 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
|
|
|
|
%Docstring
|
|
|
|
Accepts the specified style entity ``visitor``, causing it to visit all style entities associated
|
|
|
|
within the contained layouts.
|
|
|
|
|
|
|
|
Returns ``True`` if the visitor should continue visiting other objects, or ``False`` if visiting
|
|
|
|
should be canceled.
|
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
2017-12-05 15:27:49 +10:00
|
|
|
%End
|
|
|
|
|
2017-03-15 15:07:37 +10:00
|
|
|
signals:
|
2017-03-18 12:41:38 +10:00
|
|
|
|
2017-12-05 15:27:49 +10:00
|
|
|
void layoutAboutToBeAdded( const QString &name );
|
|
|
|
%Docstring
|
|
|
|
Emitted when a layout is about to be added to the manager
|
|
|
|
%End
|
|
|
|
|
|
|
|
void layoutAdded( const QString &name );
|
|
|
|
%Docstring
|
|
|
|
Emitted when a layout has been added to the manager
|
|
|
|
%End
|
|
|
|
|
|
|
|
void layoutRemoved( const QString &name );
|
|
|
|
%Docstring
|
|
|
|
Emitted when a layout was removed from the manager
|
|
|
|
%End
|
|
|
|
|
|
|
|
void layoutAboutToBeRemoved( const QString &name );
|
|
|
|
%Docstring
|
|
|
|
Emitted when a layout is about to be removed from the manager
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
2017-03-18 12:41:38 +10:00
|
|
|
|
2017-12-29 17:56:33 +10:00
|
|
|
void layoutRenamed( QgsMasterLayoutInterface *layout, const QString &newName );
|
2017-12-05 15:27:49 +10:00
|
|
|
%Docstring
|
|
|
|
Emitted when a layout is renamed
|
2017-06-20 13:34:27 +02:00
|
|
|
%End
|
2017-03-15 15:07:37 +10:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-03-11 13:21:19 +10:00
|
|
|
|
|
|
|
class QgsLayoutManagerModel : QAbstractListModel
|
|
|
|
{
|
2021-03-22 21:13:52 +01:00
|
|
|
%Docstring(signature="appended")
|
2019-03-11 13:21:19 +10:00
|
|
|
|
|
|
|
List model representing the print layouts and reports available in a
|
|
|
|
layout manager.
|
|
|
|
|
|
|
|
.. versionadded:: 3.8
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgslayoutmanager.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum Role
|
|
|
|
{
|
|
|
|
LayoutRole,
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit QgsLayoutManagerModel( QgsLayoutManager *manager, QObject *parent /TransferThis/ = 0 );
|
|
|
|
%Docstring
|
|
|
|
Constructor for QgsLayoutManagerModel, showing the layouts from the specified ``manager``.
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual int rowCount( const QModelIndex &parent ) const;
|
|
|
|
|
|
|
|
virtual QVariant data( const QModelIndex &index, int role ) const;
|
|
|
|
|
|
|
|
virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
|
|
|
|
|
|
|
|
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
|
|
|
|
|
|
|
|
|
|
|
|
QgsMasterLayoutInterface *layoutFromIndex( const QModelIndex &index ) const;
|
|
|
|
%Docstring
|
|
|
|
Returns the layout at the corresponding ``index``.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`indexFromLayout`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QModelIndex indexFromLayout( QgsMasterLayoutInterface *layout ) const;
|
|
|
|
%Docstring
|
|
|
|
Returns the model index corresponding to a ``layout``.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`layoutFromIndex`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setAllowEmptyLayout( bool allowEmpty );
|
|
|
|
%Docstring
|
|
|
|
Sets whether an optional empty layout ("not set") option is present in the model.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`allowEmptyLayout`
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool allowEmptyLayout() const;
|
|
|
|
%Docstring
|
|
|
|
Returns ``True`` if the model allows the empty layout ("not set") choice.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setAllowEmptyLayout`
|
|
|
|
%End
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QgsLayoutManagerProxyModel : QSortFilterProxyModel
|
|
|
|
{
|
2021-03-22 21:13:52 +01:00
|
|
|
%Docstring(signature="appended")
|
2019-03-11 13:21:19 +10:00
|
|
|
|
|
|
|
QSortFilterProxyModel subclass for QgsLayoutManagerModel
|
|
|
|
|
|
|
|
.. versionadded:: 3.8
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgslayoutmanager.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum Filter
|
|
|
|
{
|
|
|
|
FilterPrintLayouts,
|
|
|
|
FilterReports,
|
|
|
|
};
|
|
|
|
typedef QFlags<QgsLayoutManagerProxyModel::Filter> Filters;
|
|
|
|
|
|
|
|
|
|
|
|
explicit QgsLayoutManagerProxyModel( QObject *parent /TransferThis/ = 0 );
|
|
|
|
%Docstring
|
|
|
|
Constructor for QgsLayoutManagerProxyModel.
|
|
|
|
%End
|
|
|
|
virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
|
|
|
|
|
|
|
|
virtual bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const;
|
|
|
|
|
|
|
|
|
|
|
|
QgsLayoutManagerProxyModel::Filters filters() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the current filters used for filtering available layouts.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setFilters`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setFilters( QgsLayoutManagerProxyModel::Filters filters );
|
|
|
|
%Docstring
|
|
|
|
Sets the current ``filters`` used for filtering available layouts.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`filters`
|
2019-11-19 12:59:10 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QString filterString() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the current filter string, if set.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setFilterString`
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
%End
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void setFilterString( const QString &filter );
|
|
|
|
%Docstring
|
|
|
|
Sets a ``filter`` string, such that only layouts with names containing the
|
|
|
|
specified string will be shown.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`filterString`
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
2019-03-11 13:21:19 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
QFlags<QgsLayoutManagerProxyModel::Filter> operator|(QgsLayoutManagerProxyModel::Filter f1, QFlags<QgsLayoutManagerProxyModel::Filter> f2);
|
|
|
|
|
|
|
|
|
2017-06-20 13:34:27 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2018-01-08 12:18:07 +10:00
|
|
|
* src/core/layout/qgslayoutmanager.h *
|
2017-06-20 13:34:27 +02:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|