QGIS API Documentation
3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
src
gui
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
#include <QAbstractListModel>
20
21
#include "
qgis.h
"
22
#include "
qgsmaplayer.h
"
23
#include "qgis_gui.h"
24
#include <QItemDelegate>
25
#include <QLabel>
26
32
class
GUI_EXPORT
QgsMapLayerStyleCategoriesModel
:
public
QAbstractListModel
33
{
34
Q_OBJECT
35
36
public
:
37
39
enum class
Role
:
int
40
{
41
NameRole = Qt::UserRole + 1,
42
};
43
47
explicit
QgsMapLayerStyleCategoriesModel
(
Qgis::LayerType
type, QObject *parent =
nullptr
);
48
50
void
setCategories(
QgsMapLayer::StyleCategories
categories );
51
53
QgsMapLayer::StyleCategories
categories()
const
;
54
56
void
setShowAllCategories(
bool
showAll );
57
58
int
rowCount(
const
QModelIndex & = QModelIndex() )
const override
;
59
int
columnCount(
const
QModelIndex & = QModelIndex() )
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
Qt::ItemFlags flags(
const
QModelIndex & )
const override
;
63
64
private
:
66
QgsMapLayer::StyleCategories
mCategories;
68
QList<QgsMapLayer::StyleCategory> mCategoryList;
70
bool
mShowAllCategories =
false
;
71
};
72
79
class
GUI_EXPORT
QgsCategoryDisplayLabelDelegate
:
public
QItemDelegate
80
{
81
Q_OBJECT
82
83
public
:
85
explicit
QgsCategoryDisplayLabelDelegate
( QObject *parent =
nullptr
);
86
87
protected
:
88
void
drawDisplay( QPainter *painter,
const
QStyleOptionViewItem &option,
89
const
QRect &rect,
const
QString &text )
const override
;
90
QSize sizeHint(
const
QStyleOptionViewItem &option,
91
const
QModelIndex &index )
const override
;
92
};
93
94
#endif
// QGSMAPLAYERSTYLECATEGORIESMODEL_H
Qgis::LayerType
LayerType
Types of layers that can be added to a map.
Definition
qgis.h:169
QgsCategoryDisplayLabelDelegate
A label delegate being able to display html encoded content.
Definition
qgsmaplayerstylecategoriesmodel.h:80
QgsMapLayerStyleCategoriesModel
Model for layer style categories.
Definition
qgsmaplayerstylecategoriesmodel.h:33
QgsMapLayerStyleCategoriesModel::Role
Role
Custom model roles.
Definition
qgsmaplayerstylecategoriesmodel.h:40
QgsMapLayer::StyleCategories
QFlags< StyleCategory > StyleCategories
Definition
qgsmaplayer.h:192
qgis.h
qgsmaplayer.h
Generated on Mon Oct 28 2024 22:06:03 for QGIS API Documentation by
1.9.8