QGIS API Documentation  3.17.0-Master (df2c9ff931)
qgsgeopdflayertreemodel.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeopdflayertreemodel.h
3  ---------------------
4  begin : August 2019
5  copyright : (C) 2019 by 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 #ifndef QGSGEOPDFLAYERTREEMODEL_H
16 #define QGSGEOPDFLAYERTREEMODEL_H
17 
18 // We don't want to expose this in the public API
19 #define SIP_NO_FILE
20 
21 #include <QSortFilterProxyModel>
22 #include <QItemDelegate>
23 
24 #include "qgis_gui.h"
25 #include "qgsmaplayermodel.h"
26 
27 class QgsMapCanvas;
28 class QgsProject;
29 class QgsVectorLayer;
30 
31 
39 class GUI_EXPORT QgsGeoPdfLayerTreeModel : public QgsMapLayerModel
40 {
41  Q_OBJECT
42 
43  public:
44 
46  enum Columns
47  {
48  LayerColumn = 0,
51  IncludeVectorAttributes
52  };
53 
55  QgsGeoPdfLayerTreeModel( const QList< QgsMapLayer * > &layers, QObject *parent = nullptr );
56 
57  int columnCount( const QModelIndex &parent ) const override;
58  QVariant headerData( int section, Qt::Orientation orientation, int role ) const override;
59  Qt::ItemFlags flags( const QModelIndex &idx ) const override;
60  QVariant data( const QModelIndex &index, int role ) const override;
61  bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
62 
66  void checkAll( bool checked, const QModelIndex &parent = QModelIndex(), int column = IncludeVectorAttributes );
67 
68  private:
69 
70  QgsMapLayer *mapLayer( const QModelIndex &idx ) const;
71  QgsVectorLayer *vectorLayer( const QModelIndex &idx ) const;
72 };
73 
74 
76 class GUI_EXPORT QgsGeoPdfLayerFilteredTreeModel : public QSortFilterProxyModel
77 {
78  public:
79 
80  QgsGeoPdfLayerFilteredTreeModel( QgsGeoPdfLayerTreeModel *sourceModel, QObject *parent = nullptr );
81 
82  bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override;
83 
84  private:
85  QgsGeoPdfLayerTreeModel *mLayerTreeModel = nullptr;
86 };
88 
89 #endif // QGSGEOPDFLAYERTREEMODEL_H
Base class for all map layer types.
Definition: qgsmaplayer.h:84
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void checkAll(Qt::CheckState checkState)
checkAll changes the checkstate for all the layers
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
Qt::ItemFlags flags(const QModelIndex &index) const override
The QgsMapLayerModel class is a model to display layers in widgets.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
Definition: qgsproject.h:98
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Layer tree model for Geo-PDF layers.
Represents a vector layer which manages a vector based data sets.