QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsmaplayerstylecategoriesmodel.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaplayerstylecategoriesmodel.h
3  --------------------------------------
4  Date : September 2018
5  Copyright : (C) 2018 by Denis Rouzaud
6  Email : [email protected]
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 QGSMAPLAYERSTYLECATEGORIESMODEL_H
17 #define QGSMAPLAYERSTYLECATEGORIESMODEL_H
18 
19 // We don't want to expose this in the public API
20 #define SIP_NO_FILE
21 
22 #include <QAbstractListModel>
23 
24 #include "qgis.h"
25 #include "qgsmaplayer.h"
26 #include "qgis_gui.h"
27 
35 class GUI_EXPORT QgsMapLayerStyleCategoriesModel : public QAbstractListModel
36 {
37  Q_OBJECT
38 
39  public:
40 
44  explicit QgsMapLayerStyleCategoriesModel( QgsMapLayerType type, QObject *parent = nullptr );
45 
47  void setCategories( QgsMapLayer::StyleCategories categories );
48 
50  QgsMapLayer::StyleCategories categories() const;
51 
53  void setShowAllCategories( bool showAll );
54 
55  int rowCount( const QModelIndex & = QModelIndex() ) const override;
56  int columnCount( const QModelIndex & = QModelIndex() ) const override;
57  QVariant data( const QModelIndex &index, int role ) const override;
58  bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
59  Qt::ItemFlags flags( const QModelIndex & ) const override;
60 
61  private:
63  QgsMapLayer::StyleCategories mCategories;
65  QList<QgsMapLayer::StyleCategory> mCategoryList;
67  bool mShowAllCategories = false;
68 };
69 
70 #endif // QGSMAPLAYERSTYLECATEGORIESMODEL_H
Model for layer style categories.
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgis.h:46