QgsRendererWidget class
Base class for renderer settings widgets.
Contents
WORKFLOW:
- open renderer dialog with some RENDERER (never null!)
- find out which widget to use
- instantiate it and set in stacked widget
- on any change of renderer type, create some default (dummy?) version and change the stacked widget
- when clicked OK/Apply, get the renderer from active widget and clone it for the layer
Base classes
- class QgsPanelWidget
- Base class for any widget that can be shown as a inline panel.
Derived classes
- class QgsInvertedPolygonRendererWidget
- A widget used represent options of a QgsInvertedPolygonRenderer.
- class QgsNullSymbolRendererWidget
- Blank widget for customizing QgsNullSymbolRenderer.
- class QgsPointClusterRendererWidget
- A widget which allows configuration of the properties for a QgsPointClusterRenderer.
Public functions
- void applyChanges()
- This method should be called whenever the renderer is actually set on the layer.
- auto context() const -> QgsSymbolWidgetContext
- Returns the context in which the renderer widget is shown, e.g., the associated map canvas and expression contexts.
- auto renderer() -> QgsFeatureRenderer* pure virtual
- Returns pointer to the renderer (no transfer of ownership)
- void setContext(const QgsSymbolWidgetContext& context) virtual
- Sets the context in which the renderer widget is shown, e.g., the associated map canvas and expression contexts.
- void showSymbolLevelsDialog(QgsFeatureRenderer* r)
- show a dialog with renderer's symbol level settings
- auto vectorLayer() const -> const QgsVectorLayer*
- Returns the vector layer associated with the widget.
Signals
- void layerVariablesChanged()
- Emitted when expression context variables on the associated vector layers have been changed.
Protected functions
- auto createDataDefinedSizeLegendWidget(const QgsMarkerSymbol* symbol, const QgsDataDefinedSizeLegend* ddsLegend) -> QgsDataDefinedSizeLegendWidget*
- Creates widget to setup data-defined size legend.
- auto selectedSymbols() -> QList<QgsSymbol*> virtual
- Subclasses may provide the capability of changing multiple symbols at once by implementing the following two methods and by connecting the slot contextMenuViewCategories(const QPoint&)
Protected slots
- void changeSymbolAngle()
- Change marker angles of selected symbols.
- void changeSymbolColor()
- Change color of selected symbols.
- void changeSymbolOpacity()
- Change opacity of selected symbols.
- void changeSymbolSize()
- Change marker sizes of selected symbols.
- void changeSymbolUnit()
- Change units mm/map units of selected symbols.
- void changeSymbolWidth()
- Change line widths of selected symbols.
Protected variables
- QgsSymbolWidgetContext mContext
- Context in which widget is shown.
Private functions
- void apply() SIP_FORCE virtual
- This will be called whenever the renderer is set on a layer.
Function documentation
QgsSymbolWidgetContext QgsRendererWidget:: context() const
Returns the context in which the renderer widget is shown, e.g., the associated map canvas and expression contexts.
void QgsRendererWidget:: setContext(const QgsSymbolWidgetContext& context) virtual
Sets the context in which the renderer widget is shown, e.g., the associated map canvas and expression contexts.
| Parameters | |
|---|---|
| context | symbol widget context |
const QgsVectorLayer* QgsRendererWidget:: vectorLayer() const
Returns the vector layer associated with the widget.
void QgsRendererWidget:: layerVariablesChanged() signal
Emitted when expression context variables on the associated vector layers have been changed.
Will request the parent dialog to re-synchronize with the variables.
QgsDataDefinedSizeLegendWidget* QgsRendererWidget:: createDataDefinedSizeLegendWidget(const QgsMarkerSymbol* symbol,
const QgsDataDefinedSizeLegend* ddsLegend) protected
Creates widget to setup data-defined size legend.
Returns newly created panel - may be null if it could not be opened. Ownership is transferred to the caller.
void QgsRendererWidget:: apply() SIP_FORCE virtual private
This will be called whenever the renderer is set on a layer.
This can be overwritten in subclasses.