QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
19#include "qgspanelwidget.h"
20#include "qgsrenderer.h"
22
23#include <QMenu>
24#include <QStackedWidget>
25#include <QWidget>
26
29class QgsVectorLayer;
30class QgsStyle;
31class QgsMapCanvas;
32class QgsMarkerSymbol;
35
49{
50 Q_OBJECT
51 public:
54
57
62
68 virtual void setContext( const QgsSymbolWidgetContext &context );
69
75
79 const QgsVectorLayer *vectorLayer() const { return mLayer; }
80
84 void applyChanges();
85
86 void setDockMode( bool dockMode ) override;
87
94 virtual void disableSymbolLevels() SIP_SKIP;
95
96 signals:
97
104
110 Q_DECL_DEPRECATED void symbolLevelsChanged() SIP_DEPRECATED;
111
112 protected:
114 QgsStyle *mStyle = nullptr;
115 QMenu *contextMenu = nullptr;
116 QAction *mCopyAction = nullptr;
117 QAction *mPasteAction = nullptr;
118
123 QAction *mCopySymbolAction = nullptr;
124
129 QAction *mPasteSymbolAction = nullptr;
130
133
138 virtual QList<QgsSymbol *> selectedSymbols() { return QList<QgsSymbol *>(); }
139 virtual void refreshSymbolView() {}
140
145 QgsDataDefinedSizeLegendWidget *createDataDefinedSizeLegendWidget( const QgsMarkerSymbol *symbol, const QgsDataDefinedSizeLegend *ddsLegend ) SIP_FACTORY;
146
156 virtual void setSymbolLevels( const QList<QgsLegendSymbolItem> &levels, bool enabled );
157
163 void registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsFeatureRenderer::Property key );
164
165 protected slots:
166 void contextMenuViewCategories( QPoint p );
168 void changeSymbolColor();
170 void changeSymbolOpacity();
172 void changeSymbolUnit();
174 void changeSymbolWidth();
176 void changeSymbolSize();
178 void changeSymbolAngle();
179
180
181 virtual void copy() {}
182 virtual void paste() {}
183
189 virtual void pasteSymbolToSelection();
190
191 private slots:
192
193 void copySymbol();
194 void updateDataDefinedProperty();
195
196 private:
201 virtual void apply() SIP_FORCE;
202};
203
204
206
207#include <QObject>
208
209class QMenu;
210class QgsField;
211class QgsFields;
212
213#include "ui_widget_set_dd_value.h"
214#include "qgis_gui.h"
215
216
221class GUI_EXPORT QgsDataDefinedValueDialog : public QDialog, public Ui::QgsDataDefinedValueBaseDialog, private QgsExpressionContextGenerator
222{
223 Q_OBJECT
224
225 public:
232 QgsDataDefinedValueDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer, const QString &label );
233
240
246
250 const QgsVectorLayer *vectorLayer() const { return mLayer; }
251
252 public slots:
253 void dataDefinedChanged();
254
255 protected:
261 void init( int propertyKey ); // needed in children ctor to call virtual
262
263 private:
264 QgsProperty symbolDataDefined() const SIP_FORCE;
265
266 virtual QgsProperty symbolDataDefined( const QgsSymbol * ) const = 0 SIP_FORCE;
267 virtual double value( const QgsSymbol * ) const = 0 SIP_FORCE;
268 virtual void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) = 0 SIP_FORCE;
269
270 QList<QgsSymbol *> mSymbolList;
271 QgsVectorLayer *mLayer = nullptr;
272
273 QgsSymbolWidgetContext mContext;
274
275 QgsExpressionContext createExpressionContext() const override;
276};
277
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 std::shared_ptr<QgsMarkerSymbol> mAssistantSymbol;
298};
299
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
325{
326 Q_OBJECT
327 public:
328 QgsDataDefinedWidthDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer );
329
330 protected:
331 QgsProperty symbolDataDefined( const QgsSymbol *symbol ) const override;
332
333 double value( const QgsSymbol *symbol ) const override;
334
335 void setDataDefined( QgsSymbol *symbol, const QgsProperty &dd ) override;
336};
337
338
339#endif // QGSRENDERERWIDGET_H
void setDataDefined(QgsSymbol *symbol, const QgsProperty &dd) override
QgsDataDefinedRotationDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer)
double value(const QgsSymbol *symbol) const override
QgsProperty symbolDataDefined(const QgsSymbol *symbol) const override
QgsProperty symbolDataDefined(const QgsSymbol *symbol) const override
void setDataDefined(QgsSymbol *symbol, const QgsProperty &dd) override
double value(const QgsSymbol *symbol) const override
QgsDataDefinedSizeDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer)
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.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
QgsDataDefinedValueDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer, const QString &label)
Constructor.
const QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
QgsProperty symbolDataDefined(const QgsSymbol *symbol) const override
double value(const QgsSymbol *symbol) const override
void setDataDefined(QgsSymbol *symbol, const QgsProperty &dd) override
QgsDataDefinedWidthDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer)
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:54
Container of fields for a vector layer.
Definition qgsfields.h:46
Stores information about one class/rule of a vector layer renderer in a unified way that can be used ...
Map canvas is a class for displaying all GIS data types on a canvas.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an 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.
void layerVariablesChanged()
Emitted when expression context variables on the associated vector layers have been changed.
QAction * mPasteSymbolAction
Paste symbol action.
QgsRendererWidget(QgsVectorLayer *layer, QgsStyle *style)
Q_DECL_DEPRECATED void symbolLevelsChanged()
Emitted when the symbol levels settings have been changed.
virtual void refreshSymbolView()
virtual QList< QgsSymbol * > selectedSymbols()
Subclasses may provide the capability of changing multiple symbols at once by implementing the follow...
void showSymbolLevelsDialog(QgsFeatureRenderer *r)
Show a dialog with renderer's symbol level settings.
QgsSymbolWidgetContext mContext
Context in which widget is shown.
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the renderer widget is shown, e.g., the associated map canvas and expressio...
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.
QgsSymbolWidgetContext context() const
Returns the context in which the renderer widget is shown, e.g., the associated map canvas and expres...
QAction * mCopySymbolAction
Copy symbol action.
QgsVectorLayer * mLayer
A database of saved style entities, including symbols, color ramps, text formats and others.
Definition qgsstyle.h:88
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 dataset.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_FORCE
Definition qgis_sip.h:139
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_FACTORY
Definition qgis_sip.h:84