QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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 // *INDENT-OFF*
54
62 {
63 Layout SIP_MONKEYPATCH_COMPAT_NAME( LayoutRole ) = Qt::UserRole + 1,
64 };
65 Q_ENUM( CustomRole )
66 // *INDENT-ON*
67
68
71 explicit QgsLayoutManagerModel( QgsLayoutManager *manager, QObject *parent SIP_TRANSFERTHIS = nullptr );
72
77 QgsMasterLayoutInterface *layoutFromIndex( const QModelIndex &index ) const;
78
83 QModelIndex indexFromLayout( QgsMasterLayoutInterface *layout ) const;
84
89 void setAllowEmptyLayout( bool allowEmpty );
90
95 bool allowEmptyLayout() const { return allowEmptyObject(); }
96};
97
98
107#ifdef SIP_RUN
108class CORE_EXPORT QgsLayoutManagerProxyModel : public QgsProjectStoredObjectManagerProxyModelBase // for sip we skip to the base class and avoid the template difficulty
109{
110#else
111class CORE_EXPORT QgsLayoutManagerProxyModel : public QgsProjectStoredObjectManagerProxyModel< QgsMasterLayoutInterface >
112{
113#endif
114 Q_OBJECT
115 public:
117 enum Filter SIP_ENUM_BASETYPE( IntFlag )
118 {
120 FilterReports = 1 << 2,
121 };
122 Q_DECLARE_FLAGS( Filters, Filter )
123 Q_FLAG( Filters )
124
125
128 explicit QgsLayoutManagerProxyModel( QObject *parent SIP_TRANSFERTHIS = nullptr );
129
136
143
144 protected:
145 bool filterAcceptsRowInternal( int sourceRow, const QModelIndex &sourceParent ) const override;
146
147 private:
149};
150
152#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:113
An interface for classes which can visit style entity (e.g.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:274
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:267
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:269
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)