QGIS API Documentation 3.99.0-Master (a5475b57e34)
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
20#include "qgis_gui.h"
21#include "qgis_sip.h"
23
24#include <QWidget>
25
26#define SIP_NO_FILE
27
28class QTreeWidget;
29class QTreeWidgetItem;
30class QgsVectorLayer;
31
39class GUI_EXPORT QgsSymbolLayerSelectionWidget : public QWidget
40{
41 Q_OBJECT
42 public:
44 explicit QgsSymbolLayerSelectionWidget( QWidget *parent = nullptr );
45
47 void setLayer( const QgsVectorLayer *layer );
48
50 QSet<QString> selection() const;
51
53 void setSelection( const QSet<QString> &sel );
54
55 signals:
57 void changed();
58
59 private:
61 QTreeWidget *mTree;
63 const QgsVectorLayer *mLayer = nullptr;
64
65 // Mapping between symbol layer id and tree elements
66 QHash<QString, QTreeWidgetItem *> mItems;
67
69};
70
71#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.