QGIS API Documentation
4.3.0-Master (8c22baaae17)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsmaplayerstylemanagerwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmaplayerstylemanagerwidget.h
3
---------------------
4
begin : June 2016
5
copyright : (C) 2016 by Nathan Woodrow
6
email : woodrow dot nathan at gmail dot com
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
#ifndef QGSMAPLAYERSTYLEMANAGERWIDGET_H
16
#define QGSMAPLAYERSTYLEMANAGERWIDGET_H
17
18
#include "qgis_gui.h"
19
#include "
qgsmaplayerconfigwidget.h
"
20
21
#include <QAbstractListModel>
22
#include <QListView>
23
#include <QWidget>
24
25
class
QgsMapLayer
;
26
class
QgsMapCanvas
;
27
28
class
QStandardItem;
29
38
class
GUI_EXPORT
QgsMapLayerStyleModel
:
public
QAbstractListModel
39
{
40
Q_OBJECT
41
42
public
:
46
QgsMapLayerStyleModel
(
QgsMapLayerStyleManager
*manager, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
47
48
int
rowCount
(
const
QModelIndex &parent = QModelIndex() )
const override
;
49
QVariant
data
(
const
QModelIndex &index,
int
role = Qt::DisplayRole )
const override
;
50
bool
setData
(
const
QModelIndex &index,
const
QVariant &value,
int
role = Qt::EditRole )
override
;
51
Qt::ItemFlags
flags
(
const
QModelIndex &index )
const override
;
52
56
QModelIndex
indexForName
(
const
QString &name )
const
;
57
58
private
slots:
59
60
void
styleAdded(
const
QString &name );
61
void
styleRemoved(
const
QString &name );
62
void
styleRenamed(
const
QString &oldname,
const
QString &newname );
63
64
private
:
65
QPointer< QgsMapLayerStyleManager > mManager;
66
QStringList mStyleNames;
67
};
68
73
class
GUI_EXPORT
QgsMapLayerStyleManagerWidget
:
public
QgsMapLayerConfigWidget
74
{
75
Q_OBJECT
76
public
:
83
QgsMapLayerStyleManagerWidget
(
QgsMapLayer
*
layer
,
QgsMapCanvas
*canvas, QWidget *parent =
nullptr
);
84
85
void
syncToLayer
(
QgsMapLayer
*
layer
)
final
;
86
87
public
slots:
88
void
apply
()
override
{}
89
90
private
slots:
91
void
selectionChanged(
const
QItemSelection &selected,
const
QItemSelection &deselected );
92
void
currentStyleChanged(
const
QString &name );
93
void
addStyle();
94
void
removeStyle();
95
void
saveAsDefault();
96
void
loadDefault();
97
void
saveStyle();
98
void
loadStyle();
99
100
private
:
101
QgsMapLayerStyleModel
*mModel =
nullptr
;
102
QListView *mStyleList =
nullptr
;
103
};
104
105
#endif
// QGSMAPLAYERSTYLEMANAGERWIDGET_H
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition
qgsmapcanvas.h:96
QgsMapLayerConfigWidget::QgsMapLayerConfigWidget
QgsMapLayerConfigWidget(QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent=nullptr)
A panel widget that can be shown in the map style dock.
Definition
qgsmaplayerconfigwidget.cpp:40
QgsMapLayerConfigWidget::layer
QgsMapLayer * layer()
Returns the layer the widget is associated with.
Definition
qgsmaplayerconfigwidget.cpp:46
QgsMapLayerStyleManagerWidget::syncToLayer
void syncToLayer(QgsMapLayer *layer) final
Reset to original (vector layer) values.
Definition
qgsmaplayerstylemanagerwidget.cpp:215
QgsMapLayerStyleManagerWidget::apply
void apply() override
Definition
qgsmaplayerstylemanagerwidget.h:88
QgsMapLayerStyleManagerWidget::QgsMapLayerStyleManagerWidget
QgsMapLayerStyleManagerWidget(QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent=nullptr)
Style manager widget to manage the layers styles.
Definition
qgsmaplayerstylemanagerwidget.cpp:169
QgsMapLayerStyleManager
Management of styles for use with one map layer.
Definition
qgsmaplayerstylemanager.h:56
QgsMapLayerStyleModel
A model for display of styles from a QgsMapLayerStyleManager.
Definition
qgsmaplayerstylemanagerwidget.h:39
QgsMapLayerStyleModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition
qgsmaplayerstylemanagerwidget.cpp:63
QgsMapLayerStyleModel::indexForName
QModelIndex indexForName(const QString &name) const
Returns the model index corresponding to the specified style name.
Definition
qgsmaplayerstylemanagerwidget.cpp:130
QgsMapLayerStyleModel::data
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition
qgsmaplayerstylemanagerwidget.cpp:71
QgsMapLayerStyleModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition
qgsmaplayerstylemanagerwidget.cpp:117
QgsMapLayerStyleModel::QgsMapLayerStyleModel
QgsMapLayerStyleModel(QgsMapLayerStyleManager *manager, QObject *parent=nullptr)
Constructor for QgsMapLayerStyleModel, showing styles from the specified manager.
Definition
qgsmaplayerstylemanagerwidget.cpp:49
QgsMapLayerStyleModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition
qgsmaplayerstylemanagerwidget.cpp:89
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:83
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
qgsmaplayerconfigwidget.h
Generated on
for QGIS API Documentation by
1.17.0