QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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 "qgsmaplayer.h"
25 #include "qgis_gui.h"
26 
34 class GUI_EXPORT QgsMapLayerStyleCategoriesModel : public QAbstractListModel
35 {
36  Q_OBJECT
37 
38  public:
39 
43  explicit QgsMapLayerStyleCategoriesModel( QgsMapLayerType type, QObject *parent = nullptr );
44 
46  void setCategories( QgsMapLayer::StyleCategories categories );
47 
49  QgsMapLayer::StyleCategories categories() const;
50 
52  void setShowAllCategories( bool showAll );
53 
54  int rowCount( const QModelIndex & = QModelIndex() ) const override;
55  int columnCount( const QModelIndex & = QModelIndex() ) const override;
56  QVariant data( const QModelIndex &index, int role ) const override;
57  bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
58  Qt::ItemFlags flags( const QModelIndex & ) const override;
59 
60  private:
62  QgsMapLayer::StyleCategories mCategories;
64  QList<QgsMapLayer::StyleCategory> mCategoryList;
66  bool mShowAllCategories = false;
67 };
68 
69 #endif // QGSMAPLAYERSTYLECATEGORIESMODEL_H
Model for layer style categories.
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgsmaplayer.h:69