QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsrendererwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrendererwidget.h
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk 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 QGSRENDERERWIDGET_H
16#define QGSRENDERERWIDGET_H
17
18#include <QWidget>
19#include <QMenu>
20#include <QStackedWidget>
21#include "qgspanelwidget.h"
23
26class QgsVectorLayer;
27class QgsStyle;
29class QgsMapCanvas;
30class QgsMarkerSymbol;
32
45class GUI_EXPORT QgsRendererWidget : public QgsPanelWidget
46{
47 Q_OBJECT
48 public:
50
53
57 void showSymbolLevelsDialog( QgsFeatureRenderer *r );
58
64 virtual void setContext( const QgsSymbolWidgetContext &context );
65
70 QgsSymbolWidgetContext context() const;
71
75 const QgsVectorLayer *vectorLayer() const { return mLayer; }
76
80 void applyChanges();
81
82 void setDockMode( bool dockMode ) override;
83
90 virtual void disableSymbolLevels() SIP_SKIP;
91
92 signals:
93
99 void layerVariablesChanged();
100
106 Q_DECL_DEPRECATED void symbolLevelsChanged() SIP_DEPRECATED;
107
108 protected:
109 QgsVectorLayer *mLayer = nullptr;
110 QgsStyle *mStyle = nullptr;
111 QMenu *contextMenu = nullptr;
112 QAction *mCopyAction = nullptr;
113 QAction *mPasteAction = nullptr;
114
119 QAction *mCopySymbolAction = nullptr;
120
125 QAction *mPasteSymbolAction = nullptr;
126
129
134 virtual QList<QgsSymbol *> selectedSymbols() { return QList<QgsSymbol *>(); }
135 virtual void refreshSymbolView() {}
136
141 QgsDataDefinedSizeLegendWidget *createDataDefinedSizeLegendWidget( const QgsMarkerSymbol *symbol, const QgsDataDefinedSizeLegend *ddsLegend ) SIP_FACTORY;
142
152 virtual void setSymbolLevels( const QList< QgsLegendSymbolItem > &levels, bool enabled );
153
154 protected slots:
155 void contextMenuViewCategories( QPoint p );
157 void changeSymbolColor();
159 void changeSymbolOpacity();
161 void changeSymbolUnit();
163 void changeSymbolWidth();
165 void changeSymbolSize();
167 void changeSymbolAngle();
168
169
170 virtual void copy() {}
171 virtual void paste() {}
172
178 virtual void pasteSymbolToSelection();
179
180 private slots:
181
182 void copySymbol();
183
184 private:
185
190 virtual void apply() SIP_FORCE;
191
192
193};
194
195
197
198#include <QObject>
199
200class QMenu;
201class QgsField;
202class QgsFields;
203
204#include "ui_widget_set_dd_value.h"
205#include "qgis_gui.h"
206
207
212class GUI_EXPORT QgsDataDefinedValueDialog : public QDialog, public Ui::QgsDataDefinedValueBaseDialog, private QgsExpressionContextGenerator
213{
214
215 Q_OBJECT
216
217 public:
218
225 QgsDataDefinedValueDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer, const QString &label );
226
232 void setContext( const QgsSymbolWidgetContext &context );
233
238 QgsSymbolWidgetContext context() const;
239
243 const QgsVectorLayer *vectorLayer() const { return mLayer; }
244
245 public slots:
246 void dataDefinedChanged();
247
248 protected:
249
255 void init( int propertyKey ); // needed in children ctor to call virtual
256
257 private:
258 QgsProperty symbolDataDefined() const SIP_FORCE;
259
260 virtual QgsProperty symbolDataDefined( const QgsSymbol * ) const = 0 SIP_FORCE;
261 virtual double value( const QgsSymbol * ) const = 0 SIP_FORCE;
262 virtual void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) = 0 SIP_FORCE;
263
264 QList<QgsSymbol *> mSymbolList;
265 QgsVectorLayer *mLayer = nullptr;
266
267 QgsSymbolWidgetContext mContext;
268
269 QgsExpressionContext createExpressionContext() const override;
270};
271
277{
278 Q_OBJECT
279 public:
280 QgsDataDefinedSizeDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
281
282 protected:
283 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
284
285 double value( const QgsSymbol *symbol ) const override;
286
287 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
288
289 private:
290
291 std::shared_ptr< QgsMarkerSymbol > mAssistantSymbol;
292};
293
299{
300 Q_OBJECT
301 public:
302 QgsDataDefinedRotationDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
303
304 protected:
305 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
306
307 double value( const QgsSymbol *symbol ) const override;
308
309 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
310};
311
317{
318 Q_OBJECT
319 public:
320 QgsDataDefinedWidthDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
321
322 protected:
323 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
324
325 double value( const QgsSymbol *symbol ) const override;
326
327 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
328};
329
330
331
332#endif // QGSRENDERERWIDGET_H
Widget for configuration of appearance of legend for marker symbols with data-defined size.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Utility classes for "en masse" size definition.
const QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
Abstract interface for generating an expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:53
Container of fields for a vector layer.
Definition: qgsfields.h:45
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:93
A marker symbol type, for rendering Point and MultiPoint geometries.
Base class for any widget that can be shown as a inline panel.
virtual void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
A store for object properties.
Definition: qgsproperty.h:228
Base class for renderer settings widgets.
virtual void paste()
virtual void refreshSymbolView()
virtual QgsFeatureRenderer * renderer()=0
Returns pointer to the renderer (no transfer of ownership)
const QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
virtual void copy()
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:94
Represents a vector layer which manages a vector based data sets.
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_FORCE
Definition: qgis_sip.h:131
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_FACTORY
Definition: qgis_sip.h:76