QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
200 virtual void apply() SIP_FORCE;
201};
202
203
205
206#include <QObject>
207
208class QMenu;
209class QgsField;
210class QgsFields;
211
212#include "ui_widget_set_dd_value.h"
213#include "qgis_gui.h"
214
215
220class GUI_EXPORT QgsDataDefinedValueDialog : public QDialog, public Ui::QgsDataDefinedValueBaseDialog, private QgsExpressionContextGenerator
221{
222 Q_OBJECT
223
224 public:
231 QgsDataDefinedValueDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer, const QString &label );
232
238 void setContext( const QgsSymbolWidgetContext &context );
239
244 QgsSymbolWidgetContext context() const;
245
249 const QgsVectorLayer *vectorLayer() const { return mLayer; }
250
251 public slots:
252 void dataDefinedChanged();
253
254 protected:
260 void init( int propertyKey ); // needed in children ctor to call virtual
261
262 private:
263 QgsProperty symbolDataDefined() const SIP_FORCE;
264
265 virtual QgsProperty symbolDataDefined( const QgsSymbol * ) const = 0 SIP_FORCE;
266 virtual double value( const QgsSymbol * ) const = 0 SIP_FORCE;
267 virtual void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) = 0 SIP_FORCE;
268
269 QList<QgsSymbol *> mSymbolList;
270 QgsVectorLayer *mLayer = nullptr;
271
272 QgsSymbolWidgetContext mContext;
273
274 QgsExpressionContext createExpressionContext() const override;
275};
276
282{
283 Q_OBJECT
284 public:
285 QgsDataDefinedSizeDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
286
287 protected:
288 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
289
290 double value( const QgsSymbol *symbol ) const override;
291
292 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
293
294 private:
295 std::shared_ptr<QgsMarkerSymbol> mAssistantSymbol;
296};
297
303{
304 Q_OBJECT
305 public:
306 QgsDataDefinedRotationDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
307
308 protected:
309 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
310
311 double value( const QgsSymbol *symbol ) const override;
312
313 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
314};
315
321{
322 Q_OBJECT
323 public:
324 QgsDataDefinedWidthDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
325
326 protected:
327 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
328
329 double value( const QgsSymbol *symbol ) const override;
330
331 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
332};
333
334
335#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