QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
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#include "qgsrenderer.h"
25
28class QgsVectorLayer;
29class QgsStyle;
30class QgsMapCanvas;
31class QgsMarkerSymbol;
34
48{
49 Q_OBJECT
50 public:
53
56
60 void showSymbolLevelsDialog( QgsFeatureRenderer *r );
61
67 virtual void setContext( const QgsSymbolWidgetContext &context );
68
73 QgsSymbolWidgetContext context() const;
74
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
144 QgsDataDefinedSizeLegendWidget *createDataDefinedSizeLegendWidget( const QgsMarkerSymbol *symbol, const QgsDataDefinedSizeLegend *ddsLegend ) SIP_FACTORY;
145
155 virtual void setSymbolLevels( const QList< QgsLegendSymbolItem > &levels, bool enabled );
156
162 void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsFeatureRenderer::Property key );
163
164 protected slots:
165 void contextMenuViewCategories( QPoint p );
167 void changeSymbolColor();
169 void changeSymbolOpacity();
171 void changeSymbolUnit();
173 void changeSymbolWidth();
175 void changeSymbolSize();
177 void changeSymbolAngle();
178
179
180 virtual void copy() {}
181 virtual void paste() {}
182
188 virtual void pasteSymbolToSelection();
189
190 private slots:
191
192 void copySymbol();
193 void updateDataDefinedProperty();
194
195 private:
196
201 virtual void apply() SIP_FORCE;
202
203
204};
205
206
208
209#include <QObject>
210
211class QMenu;
212class QgsField;
213class QgsFields;
214
215#include "ui_widget_set_dd_value.h"
216#include "qgis_gui.h"
217
218
223class GUI_EXPORT QgsDataDefinedValueDialog : public QDialog, public Ui::QgsDataDefinedValueBaseDialog, private QgsExpressionContextGenerator
224{
225
226 Q_OBJECT
227
228 public:
229
236 QgsDataDefinedValueDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer, const QString &label );
237
243 void setContext( const QgsSymbolWidgetContext &context );
244
249 QgsSymbolWidgetContext context() const;
250
254 const QgsVectorLayer *vectorLayer() const { return mLayer; }
255
256 public slots:
257 void dataDefinedChanged();
258
259 protected:
260
266 void init( int propertyKey ); // needed in children ctor to call virtual
267
268 private:
269 QgsProperty symbolDataDefined() const SIP_FORCE;
270
271 virtual QgsProperty symbolDataDefined( const QgsSymbol * ) const = 0 SIP_FORCE;
272 virtual double value( const QgsSymbol * ) const = 0 SIP_FORCE;
273 virtual void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) = 0 SIP_FORCE;
274
275 QList<QgsSymbol *> mSymbolList;
276 QgsVectorLayer *mLayer = nullptr;
277
278 QgsSymbolWidgetContext mContext;
279
280 QgsExpressionContext createExpressionContext() const override;
281};
282
288{
289 Q_OBJECT
290 public:
291 QgsDataDefinedSizeDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
292
293 protected:
294 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
295
296 double value( const QgsSymbol *symbol ) const override;
297
298 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
299
300 private:
301
302 std::shared_ptr< QgsMarkerSymbol > mAssistantSymbol;
303};
304
310{
311 Q_OBJECT
312 public:
313 QgsDataDefinedRotationDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
314
315 protected:
316 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
317
318 double value( const QgsSymbol *symbol ) const override;
319
320 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
321};
322
328{
329 Q_OBJECT
330 public:
331 QgsDataDefinedWidthDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
332
333 protected:
334 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
335
336 double value( const QgsSymbol *symbol ) const override;
337
338 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
339};
340
341
342
343#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.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract base class for all 2D vector feature renderers.
Property
Data definable properties for renderers.
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:53
Container of fields for a vector layer.
Definition qgsfields.h:46
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.
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 button for controlling property overrides which may apply to a widget.
A store for object properties.
Base class for renderer settings widgets.
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.
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:231
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