QGIS API Documentation
3.41.0-Master (af5edcb665c)
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
:
38
enum class
Role
:
int
39
{
40
NameRole = Qt::UserRole + 1,
41
};
42
46
explicit
QgsMapLayerStyleCategoriesModel
(
Qgis::LayerType
type, QObject *parent =
nullptr
);
47
49
void
setCategories(
QgsMapLayer::StyleCategories
categories );
50
52
QgsMapLayer::StyleCategories
categories()
const
;
53
55
void
setShowAllCategories(
bool
showAll );
56
57
int
rowCount(
const
QModelIndex & = QModelIndex() )
const override
;
58
int
columnCount(
const
QModelIndex & = QModelIndex() )
const override
;
59
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
60
bool
setData(
const
QModelIndex &index,
const
QVariant &value,
int
role )
override
;
61
Qt::ItemFlags flags(
const
QModelIndex & )
const override
;
62
63
private
:
65
QgsMapLayer::StyleCategories
mCategories;
67
QList<QgsMapLayer::StyleCategory> mCategoryList;
69
bool
mShowAllCategories =
false
;
70
};
71
78
class
GUI_EXPORT
QgsCategoryDisplayLabelDelegate
:
public
QItemDelegate
79
{
80
Q_OBJECT
81
82
public
:
84
explicit
QgsCategoryDisplayLabelDelegate
( QObject *parent =
nullptr
);
85
86
protected
:
87
void
drawDisplay( QPainter *painter,
const
QStyleOptionViewItem &option,
const
QRect &rect,
const
QString &text )
const override
;
88
QSize sizeHint(
const
QStyleOptionViewItem &option,
const
QModelIndex &index )
const override
;
89
};
90
91
#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:79
QgsMapLayerStyleCategoriesModel
Model for layer style categories.
Definition
qgsmaplayerstylecategoriesmodel.h:33
QgsMapLayerStyleCategoriesModel::Role
Role
Custom model roles.
Definition
qgsmaplayerstylecategoriesmodel.h:39
QgsMapLayer::StyleCategories
QFlags< StyleCategory > StyleCategories
Definition
qgsmaplayer.h:192
qgis.h
qgsmaplayer.h
Generated on Thu Dec 26 2024 02:19:01 for QGIS API Documentation by
1.9.8