QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgssymbollayerselectionwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssymbollayerselectionwidget.h
3 ---------------------
4 begin : July 2019
5 copyright : (C) 2019 by Hugo Mercier
6 email : hugo dot mercier at oslandia 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 QGSSYMBOLLAYERSELECTIONWIDGET_H
16#define QGSSYMBOLLAYERSELECTIONWIDGET_H
17
18// We don't want to expose this in the public API
19#define SIP_NO_FILE
20
21#include "qgis_gui.h"
22#include "qgis_sip.h"
24
25#include <QWidget>
26
27class QTreeWidget;
28class QTreeWidgetItem;
29class QgsVectorLayer;
30
38class GUI_EXPORT QgsSymbolLayerSelectionWidget : public QWidget
39{
40 Q_OBJECT
41 public:
43 explicit QgsSymbolLayerSelectionWidget( QWidget *parent = nullptr );
44
46 void setLayer( const QgsVectorLayer *layer );
47
49 QSet<QString> selection() const;
50
52 void setSelection( const QSet<QString> &sel );
53
54 signals:
56 void changed();
57
58 private:
60 QTreeWidget *mTree;
62 const QgsVectorLayer *mLayer = nullptr;
63
64 // Mapping between symbol layer id and tree elements
65 QHash<QString, QTreeWidgetItem *> mItems;
66
68};
69
70#endif
void setSelection(const QSet< QString > &sel)
Sets the symbol layer selection.
QgsSymbolLayerSelectionWidget(QWidget *parent=nullptr)
Default constructor.
void changed()
Signal emitted when something the configuration is changed.
QSet< QString > selection() const
Returns current symbol layer selection.
void setLayer(const QgsVectorLayer *layer)
Populate the tree with selectable symbol layers from a given layer.
Represents a vector layer which manages a vector based dataset.