QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgslayoutmanagermodel.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutmanagermodel.h
3 ------------------
4 Date : January 2017
5 Copyright : (C) 2017 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSLAYOUTMANAGERMODEL_H
17#define QGSLAYOUTMANAGERMODEL_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
22
23#include <QAbstractListModel>
24#include <QObject>
25#include <QSortFilterProxyModel>
26
27class QgsProject;
28class QgsPrintLayout;
32
33
43#ifdef SIP_RUN
44class CORE_EXPORT QgsLayoutManagerModel : public QgsProjectStoredObjectManagerModelBase // for sip we skip to the base class and avoid the template difficulty
45{
46#else
47class CORE_EXPORT QgsLayoutManagerModel : public QgsProjectStoredObjectManagerModel< QgsMasterLayoutInterface >
48{
49#endif
50 Q_OBJECT
51
52 public:
53
54 // *INDENT-OFF*
55
63 {
64 Layout SIP_MONKEYPATCH_COMPAT_NAME(LayoutRole) = Qt::UserRole + 1,
65 };
66 Q_ENUM( CustomRole )
67 // *INDENT-ON*
68
69
72 explicit QgsLayoutManagerModel( QgsLayoutManager *manager, QObject *parent SIP_TRANSFERTHIS = nullptr );
73
78 QgsMasterLayoutInterface *layoutFromIndex( const QModelIndex &index ) const;
79
84 QModelIndex indexFromLayout( QgsMasterLayoutInterface *layout ) const;
85
90 void setAllowEmptyLayout( bool allowEmpty );
91
96 bool allowEmptyLayout() const { return allowEmptyObject(); }
97
98};
99
100
109#ifdef SIP_RUN
110class CORE_EXPORT QgsLayoutManagerProxyModel : public QgsProjectStoredObjectManagerProxyModelBase // for sip we skip to the base class and avoid the template difficulty
111{
112#else
113class CORE_EXPORT QgsLayoutManagerProxyModel : public QgsProjectStoredObjectManagerProxyModel< QgsMasterLayoutInterface >
114{
115#endif
116 Q_OBJECT
117 public:
118
120 enum Filter SIP_ENUM_BASETYPE( IntFlag )
121 {
123 FilterReports = 1 << 2,
124 };
125 Q_DECLARE_FLAGS( Filters, Filter )
126 Q_FLAG( Filters )
127
128
131 explicit QgsLayoutManagerProxyModel( QObject *parent SIP_TRANSFERTHIS = nullptr );
132
139
146
147 protected:
148
149 bool filterAcceptsRowInternal( int sourceRow, const QModelIndex &sourceParent ) const override;
150
151 private:
152
154
155};
156
158#endif // QGSLAYOUTMANAGERMODEL_H
List model representing the print layouts and reports available in a layout manager.
CustomRole
Custom model roles.
bool allowEmptyLayout() const
Returns true if the model allows the empty layout ("not set") choice.
QgsLayoutManagerModel(QgsLayoutManager *manager, QObject *parent=nullptr)
Constructor for QgsLayoutManagerModel, showing the layouts from the specified manager.
void setFilters(QgsLayoutManagerProxyModel::Filters filters)
Sets the current filters used for filtering available layouts.
QgsLayoutManagerProxyModel::Filters filters() const
Returns the current filters used for filtering available layouts.
Filter
Available filter flags for filtering the model.
@ FilterPrintLayouts
Includes print layouts.
QgsLayoutManagerProxyModel(QObject *parent=nullptr)
Constructor for QgsLayoutManagerProxyModel.
bool filterAcceptsRowInternal(int sourceRow, const QModelIndex &sourceParent) const override
Returns true if the proxy accepts the matching source row.
Manages storage of a set of layouts.
Interface for master layout type objects, such as print layouts and reports.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Base class for list models representing the objects available in a QgsAbstractProjectStoredObjectMana...
QgsProjectStoredObjectManagerModel(QgsAbstractProjectStoredObjectManager< QgsMasterLayoutInterface > *manager, QObject *parent=nullptr)
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
An interface for classes which can visit style entity (e.g.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:275
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:268
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:270
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)