QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsmaskingwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaskingwidget.h
3 ---------------------
4 begin : September 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 QGSMASKINGWIDGET_H
16#define QGSMASKINGWIDGET_H
17
18// We don't want to expose this in the public API
19#define SIP_NO_FILE
20
22
23#include <QPointer>
24
25#include "qgspanelwidget.h"
26#include "ui_qgsmaskingwidgetbase.h"
28#include "qgis_sip.h"
29#include "qgis_gui.h"
30
32
40class GUI_EXPORT QgsMaskingWidget: public QgsPanelWidget, private Ui::QgsMaskingWidgetBase
41{
42 Q_OBJECT
43 public:
45 QgsMaskingWidget( QWidget *parent = nullptr );
46
48 void setLayer( QgsVectorLayer *layer );
49
51 void apply();
52
54 bool hasBeenPopulated();
55
56 protected:
57
58 void showEvent( QShowEvent * ) override;
59
60 private slots:
61
65 void onSelectionChanged();
66
67 private:
68 QgsVectorLayer *mLayer = nullptr;
70 void populate();
71
72 QPointer<QgsMessageBarItem> mMessageBarItem;
73 bool mMustPopulate = false;
74};
75
76
84class SymbolLayerVisitor : public QgsStyleEntityVisitorInterface
85{
86 public:
87 typedef std::function<void( const QgsSymbolLayer *, const QString & )> SymbolLayerCallback;
88
90 SymbolLayerVisitor( SymbolLayerCallback callback );
91
92 bool visitEnter( const QgsStyleEntityVisitorInterface::Node &node ) override;
93
95 void visitSymbol( const QgsSymbol *symbol, const QString &leafIdentifier, QVector<int> rootPath );
96
97 bool visit( const QgsStyleEntityVisitorInterface::StyleLeaf &leaf ) override;
98
99 private:
100 QString mSymbolKey;
101 QList<QPair<QgsSymbolLayerId, QList<QgsSymbolLayerReference>>> mMasks;
102 SymbolLayerCallback mCallback;
103};
104
106
107#endif
Represents an item shown within a QgsMessageBar widget.
Base class for any widget that can be shown as a inline panel.
An interface for classes which can visit style entity (e.g.
virtual bool visitEnter(const QgsStyleEntityVisitorInterface::Node &node)
Called when the visitor starts visiting a node.
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:94
Represents a vector layer which manages a vector based data sets.
Contains information relating to a node (i.e.
Contains information relating to the style entity currently being visited.