QGIS API Documentation 3.39.0-Master (bca3cdb6021)
Loading...
Searching...
No Matches
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
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
35class GUI_EXPORT QgsMapLayerStyleCategoriesModel : public QAbstractListModel
36{
37 Q_OBJECT
38
39 public:
40
44 explicit QgsMapLayerStyleCategoriesModel( Qgis::LayerType 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:
65 QList<QgsMapLayer::StyleCategory> mCategoryList;
67 bool mShowAllCategories = false;
68};
69
70#endif // QGSMAPLAYERSTYLECATEGORIESMODEL_H
LayerType
Types of layers that can be added to a map.
Definition qgis.h:169
QFlags< StyleCategory > StyleCategories