QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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:
40  explicit QgsMapLayerStyleCategoriesModel( QObject *parent = nullptr );
41 
43  void setCategories( QgsMapLayer::StyleCategories categories );
44 
46  QgsMapLayer::StyleCategories categories() const;
47 
49  void setShowAllCategories( bool showAll );
50 
51  int rowCount( const QModelIndex & = QModelIndex() ) const override;
52  int columnCount( const QModelIndex & = QModelIndex() ) const override;
53  QVariant data( const QModelIndex &index, int role ) const override;
54  bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
55  Qt::ItemFlags flags( const QModelIndex & ) const override;
56 
57  private:
59  QgsMapLayer::StyleCategories mCategories;
61  QList<QgsMapLayer::StyleCategory> mCategoryList;
63  bool mShowAllCategories = false;
64 };
65 
66 #endif // QGSMAPLAYERSTYLECATEGORIESMODEL_H
QgsMapLayerStyleCategoriesModel
Definition: qgsmaplayerstylecategoriesmodel.h:34
qgsmaplayer.h