QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
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
65 virtual void setContext( const QgsSymbolWidgetContext &context );
66
72 QgsSymbolWidgetContext context() const;
73
78 const QgsVectorLayer *vectorLayer() const { return mLayer; }
79
83 void applyChanges();
84
85 void setDockMode( bool dockMode ) override;
86
93 virtual void disableSymbolLevels() SIP_SKIP;
94
95 signals:
96
102 void layerVariablesChanged();
103
109 Q_DECL_DEPRECATED void symbolLevelsChanged() SIP_DEPRECATED;
110
111 protected:
112 QgsVectorLayer *mLayer = nullptr;
113 QgsStyle *mStyle = nullptr;
114 QMenu *contextMenu = nullptr;
115 QAction *mCopyAction = nullptr;
116 QAction *mPasteAction = nullptr;
117
122 QAction *mCopySymbolAction = nullptr;
123
128 QAction *mPasteSymbolAction = nullptr;
129
132
137 virtual QList<QgsSymbol *> selectedSymbols() { return QList<QgsSymbol *>(); }
138 virtual void refreshSymbolView() {}
139
145 QgsDataDefinedSizeLegendWidget *createDataDefinedSizeLegendWidget( const QgsMarkerSymbol *symbol, const QgsDataDefinedSizeLegend *ddsLegend ) SIP_FACTORY;
146
156 virtual void setSymbolLevels( const QList< QgsLegendSymbolItem > &levels, bool enabled );
157
158 protected slots:
159 void contextMenuViewCategories( QPoint p );
161 void changeSymbolColor();
163 void changeSymbolOpacity();
165 void changeSymbolUnit();
167 void changeSymbolWidth();
169 void changeSymbolSize();
171 void changeSymbolAngle();
172
173
174 virtual void copy() {}
175 virtual void paste() {}
176
182 virtual void pasteSymbolToSelection();
183
184 private slots:
185
186 void copySymbol();
187
188 private:
189
194 virtual void apply() SIP_FORCE;
195
196
197};
198
199
201
202#include <QObject>
203
204class QMenu;
205class QgsField;
206class QgsFields;
207
208#include "ui_widget_set_dd_value.h"
209#include "qgis_gui.h"
210
211
216class GUI_EXPORT QgsDataDefinedValueDialog : public QDialog, public Ui::QgsDataDefinedValueBaseDialog, private QgsExpressionContextGenerator
217{
218
219 Q_OBJECT
220
221 public:
222
229 QgsDataDefinedValueDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer, const QString &label );
230
237 void setContext( const QgsSymbolWidgetContext &context );
238
244 QgsSymbolWidgetContext context() const;
245
250 const QgsVectorLayer *vectorLayer() const { return mLayer; }
251
252 public slots:
253 void dataDefinedChanged();
254
255 protected:
256
262 void init( int propertyKey ); // needed in children ctor to call virtual
263
264 private:
265 QgsProperty symbolDataDefined() const SIP_FORCE;
266
267 virtual QgsProperty symbolDataDefined( const QgsSymbol * ) const = 0 SIP_FORCE;
268 virtual double value( const QgsSymbol * ) const = 0 SIP_FORCE;
269 virtual void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) = 0 SIP_FORCE;
270
271 QList<QgsSymbol *> mSymbolList;
272 QgsVectorLayer *mLayer = nullptr;
273
274 QgsSymbolWidgetContext mContext;
275
276 QgsExpressionContext createExpressionContext() const override;
277};
278
284{
285 Q_OBJECT
286 public:
287 QgsDataDefinedSizeDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
288
289 protected:
290 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
291
292 double value( const QgsSymbol *symbol ) const override;
293
294 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
295
296 private:
297
298 std::shared_ptr< QgsMarkerSymbol > mAssistantSymbol;
299};
300
306{
307 Q_OBJECT
308 public:
309 QgsDataDefinedRotationDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
310
311 protected:
312 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
313
314 double value( const QgsSymbol *symbol ) const override;
315
316 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
317};
318
324{
325 Q_OBJECT
326 public:
327 QgsDataDefinedWidthDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
328
329 protected:
330 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
331
332 double value( const QgsSymbol *symbol ) const override;
333
334 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
335};
336
337
338
339#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:90
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:230
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