QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgslayerpropertieswidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayerpropertieswidget.cpp
3  ----------------------------
4  begin : June 2012
5  copyright : (C) 2012 by Arunmozhi
6  email : aruntheguy at gmail.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 
17 
18 #include <QFile>
19 #include <QStandardItem>
20 #include <QKeyEvent>
21 #include <QMessageBox>
22 #include <QPicture>
23 
24 #include "qgssymbollayer.h"
25 #include "qgssymbollayerregistry.h"
26 #include "qgspainteffectregistry.h"
27 
28 #include "qgsapplication.h"
29 #include "qgslogger.h"
30 
31 #include "qgssymbollayerwidget.h"
35 #include "qgssymbol.h" //for the unit
36 #include "qgspanelwidget.h"
37 #include "qgsmapcanvas.h"
38 #include "qgspainteffect.h"
39 #include "qgsproject.h"
40 #include "qgsvectorlayer.h"
43 #include "qgstemporalcontroller.h"
44 #include "qgssymbollayerutils.h"
45 
46 static bool _initWidgetFunction( const QString &name, QgsSymbolLayerWidgetFunc f )
47 {
49 
50  QgsSymbolLayerAbstractMetadata *abstractMetadata = reg->symbolLayerMetadata( name );
51  if ( !abstractMetadata )
52  {
53  QgsDebugMsg( "Failed to find symbol layer's entry in registry: " + name );
54  return false;
55  }
56  QgsSymbolLayerMetadata *metadata = dynamic_cast<QgsSymbolLayerMetadata *>( abstractMetadata );
57  if ( !metadata )
58  {
59  QgsDebugMsg( "Failed to cast symbol layer's metadata: " + name );
60  return false;
61  }
62  metadata->setWidgetFunction( f );
63  return true;
64 }
65 
66 static void _initWidgetFunctions()
67 {
68  static bool sInitialized = false;
69  if ( sInitialized )
70  return;
71 
72  _initWidgetFunction( QStringLiteral( "SimpleLine" ), QgsSimpleLineSymbolLayerWidget::create );
73  _initWidgetFunction( QStringLiteral( "MarkerLine" ), QgsMarkerLineSymbolLayerWidget::create );
74  _initWidgetFunction( QStringLiteral( "HashLine" ), QgsHashedLineSymbolLayerWidget::create );
75  _initWidgetFunction( QStringLiteral( "ArrowLine" ), QgsArrowSymbolLayerWidget::create );
76 
77  _initWidgetFunction( QStringLiteral( "SimpleMarker" ), QgsSimpleMarkerSymbolLayerWidget::create );
78  _initWidgetFunction( QStringLiteral( "FilledMarker" ), QgsFilledMarkerSymbolLayerWidget::create );
79  _initWidgetFunction( QStringLiteral( "SvgMarker" ), QgsSvgMarkerSymbolLayerWidget::create );
80  _initWidgetFunction( QStringLiteral( "RasterMarker" ), QgsRasterMarkerSymbolLayerWidget::create );
81  _initWidgetFunction( QStringLiteral( "FontMarker" ), QgsFontMarkerSymbolLayerWidget::create );
82  _initWidgetFunction( QStringLiteral( "EllipseMarker" ), QgsEllipseSymbolLayerWidget::create );
83  _initWidgetFunction( QStringLiteral( "VectorField" ), QgsVectorFieldSymbolLayerWidget::create );
84  _initWidgetFunction( QStringLiteral( "MaskMarker" ), QgsMaskMarkerSymbolLayerWidget::create );
85 
86  _initWidgetFunction( QStringLiteral( "SimpleFill" ), QgsSimpleFillSymbolLayerWidget::create );
87  _initWidgetFunction( QStringLiteral( "GradientFill" ), QgsGradientFillSymbolLayerWidget::create );
88  _initWidgetFunction( QStringLiteral( "ShapeburstFill" ), QgsShapeburstFillSymbolLayerWidget::create );
89  _initWidgetFunction( QStringLiteral( "RasterFill" ), QgsRasterFillSymbolLayerWidget::create );
90  _initWidgetFunction( QStringLiteral( "SVGFill" ), QgsSVGFillSymbolLayerWidget::create );
91  _initWidgetFunction( QStringLiteral( "CentroidFill" ), QgsCentroidFillSymbolLayerWidget::create );
92  _initWidgetFunction( QStringLiteral( "LinePatternFill" ), QgsLinePatternFillSymbolLayerWidget::create );
93  _initWidgetFunction( QStringLiteral( "PointPatternFill" ), QgsPointPatternFillSymbolLayerWidget::create );
94  _initWidgetFunction( QStringLiteral( "RandomMarkerFill" ), QgsRandomMarkerFillSymbolLayerWidget::create );
95 
96  _initWidgetFunction( QStringLiteral( "GeometryGenerator" ), QgsGeometryGeneratorSymbolLayerWidget::create );
97 
98  sInitialized = true;
99 }
100 
101 
103  : QgsPanelWidget( parent )
104  , mLayer( layer )
105  , mSymbol( symbol )
106  , mVectorLayer( vl )
107 {
108 
109  setupUi( this );
110  connect( mEnabledCheckBox, &QCheckBox::toggled, this, &QgsLayerPropertiesWidget::mEnabledCheckBox_toggled );
111  // initialize the sub-widgets
112  // XXX Should this thing be here this way? Initialize all the widgets just for the sake of one layer?
113  // TODO Make this on demand creation
114  _initWidgetFunctions();
115 
116  // TODO Algorithm
117  //
118  // 3. populate the combo box with the supported layer type
119  // 4. set the present layer type
120  // 5. create the widget for the present layer type and set in stacked widget
121  // 6. connect comboBox type changed to two things
122  // 1. emit signal that type has beed changed
123  // 2. remove the widget and place the new widget corresponding to the changed layer type
124  //
126  // update layer type combo box
127  int idx = cboLayerType->findData( mLayer->layerType() );
128  cboLayerType->setCurrentIndex( idx );
129 
130  connect( mEnabledCheckBox, &QAbstractButton::toggled, mEnabledDDBtn, &QWidget::setEnabled );
131  mEnabledCheckBox->setChecked( mLayer->enabled() );
132 
133  // set the corresponding widget
134  updateSymbolLayerWidget( layer );
135  connect( cboLayerType, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayerPropertiesWidget::layerTypeChanged );
136 
138 
139  this->connectChildPanel( mEffectWidget );
140 
141  if ( !mLayer->paintEffect() )
142  {
144  mLayer->paintEffect()->setEnabled( false );
145  }
146  mEffectWidget->setPaintEffect( mLayer->paintEffect() );
147 
149 }
150 
152 {
153  mContext = context;
154 
155  QgsSymbolLayerWidget *w = dynamic_cast< QgsSymbolLayerWidget * >( stackedWidget->currentWidget() );
156  if ( w )
157  w->setContext( mContext );
158 }
159 
161 {
162  return mContext;
163 }
164 
166 {
168  mEffectWidget->setDockMode( this->dockMode() );
169 }
170 
172 {
173  QStringList symbolLayerIds = QgsApplication::symbolLayerRegistry()->symbolLayersForType( mSymbol->type() );
174 
175  const auto constSymbolLayerIds = symbolLayerIds;
176  for ( const QString &symbolLayerId : constSymbolLayerIds )
177  cboLayerType->addItem( QgsApplication::symbolLayerRegistry()->symbolLayerMetadata( symbolLayerId )->visibleName(), symbolLayerId );
178 
179  if ( mSymbol->type() == QgsSymbol::Fill )
180  {
182  const auto constLineLayerIds = lineLayerIds;
183  for ( const QString &lineLayerId : constLineLayerIds )
184  {
186  if ( layerInfo->type() != QgsSymbol::Hybrid )
187  {
188  QString visibleName = layerInfo->visibleName();
189  QString name = tr( "Outline: %1" ).arg( visibleName );
190  cboLayerType->addItem( name, lineLayerId );
191  }
192  }
193  }
194 }
195 
197 {
198  if ( stackedWidget->currentWidget() != pageDummy )
199  {
200  // stop updating from the original widget
201  if ( QgsSymbolLayerWidget *w = qobject_cast< QgsSymbolLayerWidget * >( stackedWidget->currentWidget() ) )
203  stackedWidget->removeWidget( stackedWidget->currentWidget() );
204  }
205 
207 
208  QString layerType = layer->layerType();
209  QgsSymbolLayerAbstractMetadata *am = pReg->symbolLayerMetadata( layerType );
210  if ( am )
211  {
213  if ( w )
214  {
215  w->setContext( mContext );
216  w->setSymbolLayer( layer );
217  stackedWidget->addWidget( w );
218  stackedWidget->setCurrentWidget( w );
219  // start receiving updates from widget
221  connect( w, &QgsSymbolLayerWidget::symbolChanged, this, &QgsLayerPropertiesWidget::reloadLayer );
222  return;
223  }
224  }
225  // When anything is not right
226  stackedWidget->setCurrentWidget( pageDummy );
227 }
228 
230 {
231  if ( auto *lExpressionContext = mContext.expressionContext() )
232  return *lExpressionContext;
233 
234  QgsExpressionContext expContext;
238 
239  if ( auto *lMapCanvas = mContext.mapCanvas() )
240  {
241  expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
242  << new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
243  if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
244  {
245  expContext << generator->createExpressionContextScope();
246  }
247  }
248  else
249  {
251  }
252 
254 
256  if ( mLayer )
257  {
258  //cheat a bit - set the symbol color variable to match the symbol layer's color (when we should really be using the *symbols*
259  //color, but that's not accessible here). 99% of the time these will be the same anyway
261  }
262  expContext << symbolScope;
267  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_layer_count" ), 1, true ) );
268  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_layer_index" ), 1, true ) );
269  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_marker_row" ), 1, true ) );
270  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_marker_column" ), 1, true ) );
271 
272  // additional scopes
273  const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
274  for ( const QgsExpressionContextScope &scope : constAdditionalExpressionContextScopes )
275  {
276  expContext.appendScope( new QgsExpressionContextScope( scope ) );
277  }
278 
279  //TODO - show actual value
280  expContext.setOriginalValueVariable( QVariant() );
281 
286  << QStringLiteral( "symbol_layer_count" ) << QStringLiteral( "symbol_layer_index" ) );
287 
288  return expContext;
289 }
290 
292 {
294  connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayerPropertiesWidget::updateProperty );
295  button->registerExpressionContextGenerator( this );
296 }
297 
298 void QgsLayerPropertiesWidget::updateProperty()
299 {
300  QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
301  QgsSymbolLayer::Property key = static_cast< QgsSymbolLayer::Property >( button->propertyKey() );
302  mLayer->setDataDefinedProperty( key, button->toProperty() );
303  emit changed();
304 }
305 
307 {
308  QgsSymbolLayer *layer = mLayer;
309  if ( !layer )
310  return;
311  QString newLayerType = cboLayerType->currentData().toString();
312  if ( layer->layerType() == newLayerType )
313  return;
314 
315  // get creation function for new layer from registry
317  QgsSymbolLayerAbstractMetadata *am = pReg->symbolLayerMetadata( newLayerType );
318  if ( !am ) // check whether the metadata is assigned
319  return;
320 
321  // change layer to a new (with different type)
322  // base new layer on existing layer's properties
323  QgsSymbolLayer *newLayer = am->createSymbolLayer( layer->properties() );
324  if ( !newLayer )
325  return;
326 
327  updateSymbolLayerWidget( newLayer );
328  emit changeLayer( newLayer );
329 }
330 
332 {
333  emit changed();
334 
335  // also update paint effect preview
336  bool paintEffectToggled = false;
337  if ( mLayer->paintEffect() && mLayer->paintEffect()->enabled() )
338  {
339  mLayer->paintEffect()->setEnabled( false );
340  paintEffectToggled = true;
341  }
342  mEffectWidget->setPreviewPicture( QgsSymbolLayerUtils::symbolLayerPreviewPicture( mLayer, QgsUnitTypes::RenderMillimeters, QSize( 60, 60 ) ) );
343  if ( paintEffectToggled )
344  {
345  mLayer->paintEffect()->setEnabled( true );
346  }
347  emit widgetChanged();
348 }
349 
350 void QgsLayerPropertiesWidget::reloadLayer()
351 {
352  emit changeLayer( mLayer );
353 }
354 
355 void QgsLayerPropertiesWidget::mEnabledCheckBox_toggled( bool enabled )
356 {
357  mLayer->setEnabled( enabled );
359 }
QgsSymbolLayer::setEnabled
void setEnabled(bool enabled)
Sets whether symbol layer is enabled and should be drawn.
Definition: qgssymbollayer.h:222
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:370
QgsSymbolLayer::enabled
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
Definition: qgssymbollayer.h:213
qgsexpressioncontextutils.h
QgsSymbolWidgetContext::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:54
QgsSimpleLineSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSimpleLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:144
qgssymbollayerwidget.h
QgsSymbolLayerAbstractMetadata::visibleName
QString visibleName() const
Definition: qgssymbollayerregistry.h:46
QgsGradientFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsGradientFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:374
QgsEffectStackCompactWidget::changed
void changed()
Emitted when the paint effect properties change.
QgsSymbolLayerWidget::setSymbolLayer
virtual void setSymbolLayer(QgsSymbolLayer *layer)=0
QgsLinePatternFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsLinePatternFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:838
QgsSymbolLayerAbstractMetadata
Stores metadata about one symbol layer class.
Definition: qgssymbollayerregistry.h:35
QgsSymbolLayer::dataDefinedProperties
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
Definition: qgssymbollayer.h:486
QgsLayerPropertiesWidget::layerTypeChanged
void layerTypeChanged()
Definition: qgslayerpropertieswidget.cpp:306
QgsSimpleFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSimpleFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:268
QgsLayerPropertiesWidget::mVectorLayer
QgsVectorLayer * mVectorLayer
Definition: qgslayerpropertieswidget.h:104
QgsSymbolLayerWidget::changed
void changed()
Should be emitted whenever configuration changes happened on this symbol layer configuration.
QgsExpressionContext::EXPR_ORIGINAL_VALUE
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
Definition: qgsexpressioncontext.h:721
QgsLayerPropertiesWidget::mSymbol
const QgsSymbol * mSymbol
Definition: qgslayerpropertieswidget.h:103
QgsExpressionContextUtils::globalScope
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Definition: qgsexpressioncontextutils.cpp:34
qgsmapcanvas.h
QgsExpressionContextScope::addVariable
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Definition: qgsexpressioncontext.cpp:93
QgsPanelWidget::setDockMode
virtual void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
Definition: qgspanelwidget.cpp:44
QgsPropertyOverrideButton::changed
void changed()
Emitted when property definition changes.
QgsExpressionContext::EXPR_CLUSTER_COLOR
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
Definition: qgsexpressioncontext.h:737
QgsExpressionContext::EXPR_GEOMETRY_POINT_COUNT
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
Definition: qgsexpressioncontext.h:731
QgsVectorFieldSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsVectorFieldSymbolLayerWidget.
Definition: qgsvectorfieldsymbollayerwidget.h:45
QgsSymbolLayer::color
virtual QColor color() const
The fill color.
Definition: qgssymbollayer.h:227
QgsExpressionContext::lastScope
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
Definition: qgsexpressioncontext.cpp:373
QgsArrowSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *layer)
Static creation method.
Definition: qgsarrowsymbollayerwidget.h:46
QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
Definition: qgsexpressioncontext.h:733
QgsExpressionContext::setOriginalValueVariable
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
Definition: qgsexpressioncontext.cpp:566
qgssymbollayerutils.h
QgsSymbolLayerWidget
Definition: qgssymbollayerwidget.h:35
QgsExpressionContextUtils::layerScope
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Definition: qgsexpressioncontextutils.cpp:265
QgsSymbolWidgetContext
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Definition: qgssymbolwidgetcontext.h:36
QgsPointPatternFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsPointPatternFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:881
QgsSimpleMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSimpleMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:207
QgsMarkerLineSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsMarkerLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:483
QgsPanelWidget::connectChildPanel
void connectChildPanel(QgsPanelWidget *panel)
Connect the given sub panel widgets showPanel signals to this current panels main showPanel event to ...
Definition: qgspanelwidget.cpp:38
QgsExpressionContextUtils::mapSettingsScope
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
Definition: qgsexpressioncontextutils.cpp:357
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:468
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:168
QgsRandomMarkerFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsRandomMarkerFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:936
QgsPropertyOverrideButton::propertyKey
int propertyKey() const
Returns the property key linked to the button.
Definition: qgspropertyoverridebutton.h:123
QgsSymbolLayerRegistry
Registry of available symbol layer classes.
Definition: qgssymbollayerregistry.h:145
qgspainteffectregistry.h
QgsExpressionContextScopeGenerator
Abstract interface for generating an expression context scope.
Definition: qgsexpressioncontextscopegenerator.h:29
QgsExpressionContext::EXPR_GEOMETRY_PART_NUM
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
Definition: qgsexpressioncontext.h:729
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:64
QgsDebugMsg
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
qgspainteffect.h
QgsPaintEffectRegistry::defaultStack
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects.
Definition: qgspainteffectregistry.cpp:114
QgsLayerPropertiesWidget::changeLayer
void changeLayer(QgsSymbolLayer *)
QgsExpressionContext::EXPR_SYMBOL_COLOR
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
Definition: qgsexpressioncontext.h:723
QgsPanelWidget::dockMode
bool dockMode()
Returns the dock mode state.
Definition: qgspanelwidget.h:83
QgsSymbolLayer::properties
virtual QgsStringMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
qgsvectorfieldsymbollayerwidget.h
QgsPropertyOverrideButton
A button for controlling property overrides which may apply to a widget.
Definition: qgspropertyoverridebutton.h:51
QgsApplication::symbolLayerRegistry
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers.
Definition: qgsapplication.cpp:2203
qgsapplication.h
QgsSymbolLayerWidget::symbolChanged
void symbolChanged()
Should be emitted whenever the sub symbol changed on this symbol layer configuration.
QgsCentroidFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsCentroidFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:1075
QgsSymbolLayer::propertyDefinitions
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
Definition: qgssymbollayer.cpp:221
qgstemporalcontroller.h
QgsEllipseSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSymbolLayerWidget.
Definition: qgsellipsesymbollayerwidget.h:46
QgsMaskMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *layer)
Static creation method.
Definition: qgsmasksymbollayerwidget.h:49
QgsExpressionContextUtils::projectScope
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
Definition: qgsexpressioncontextutils.cpp:222
QgsLayerPropertiesWidget::registerDataDefinedButton
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key)
Registers a data defined override button.
Definition: qgslayerpropertieswidget.cpp:291
QgsSymbolLayerWidgetFunc
QgsSymbolLayerWidget *(* QgsSymbolLayerWidgetFunc)(QgsVectorLayer *)
Definition: qgssymbollayerregistry.h:78
QgsSymbolLayer
Definition: qgssymbollayer.h:53
QgsSvgMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSvgMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:593
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsSymbolLayerWidget::setContext
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Definition: qgssymbollayerwidget.cpp:118
QgsRasterFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsRasterFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:731
QgsFontMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsFontMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:981
QgsHashedLineSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsHashedLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:538
qgssymbollayerregistry.h
QgsLayerPropertiesWidget::changed
void changed()
QgsPanelWidget::widgetChanged
void widgetChanged()
Emitted when the widget state changes.
QgsPropertyOverrideButton::toProperty
QgsProperty toProperty() const
Returns a QgsProperty object encapsulating the current state of the widget.
Definition: qgspropertyoverridebutton.cpp:210
QgsSymbolLayerAbstractMetadata::type
QgsSymbol::SymbolType type() const
Definition: qgssymbollayerregistry.h:47
QgsSymbolLayerMetadata
Convenience metadata class that uses static functions to create symbol layer and its widget.
Definition: qgssymbollayerregistry.h:87
QgsRasterMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsRasterMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:677
qgssymbollayer.h
qgsellipsesymbollayerwidget.h
QgsSymbolLayer::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
Definition: qgssymbollayer.cpp:191
QgsSymbol::Fill
@ Fill
Fill symbol.
Definition: qgssymbol.h:89
QgsSymbolWidgetContext::expressionContext
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
Definition: qgssymbolwidgetcontext.cpp:77
QgsSymbolLayer::paintEffect
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the layer.
Definition: qgssymbollayer.cpp:186
QgsGeometryGeneratorSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Will be registered as factory.
Definition: qgssymbollayerwidget.h:1117
QgsSymbolLayerMetadata::setWidgetFunction
void setWidgetFunction(QgsSymbolLayerWidgetFunc f)
Definition: qgssymbollayerregistry.h:113
QgsPaintEffect::setEnabled
void setEnabled(bool enabled)
Sets whether the effect is enabled.
Definition: qgspainteffect.cpp:44
QgsPropertyOverrideButton::init
void init(int propertyKey, const QgsProperty &property, const QgsPropertiesDefinition &definitions, const QgsVectorLayer *layer=nullptr, bool auxiliaryStorageEnabled=false)
Initialize a newly constructed property button (useful if button was included in a UI layout).
Definition: qgspropertyoverridebutton.cpp:96
QgsSymbolLayerRegistry::symbolLayersForType
QStringList symbolLayersForType(QgsSymbol::SymbolType type)
Returns a list of available symbol layers for a specified symbol type.
Definition: qgssymbollayerregistry.cpp:143
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition: qgsexpressioncontext.h:112
QgsLayerPropertiesWidget::mLayer
QgsSymbolLayer * mLayer
Definition: qgslayerpropertieswidget.h:101
QgsSymbolLayer::PropertyLayerEnabled
@ PropertyLayerEnabled
Whether symbol layer is enabled.
Definition: qgssymbollayer.h:176
QgsExpressionContext::appendScope
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
Definition: qgsexpressioncontext.cpp:490
qgsvectorlayer.h
QgsExpressionContext::EXPR_CLUSTER_SIZE
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
Definition: qgsexpressioncontext.h:735
QgsExpressionContext::EXPR_GEOMETRY_PART_COUNT
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
Definition: qgsexpressioncontext.h:727
QgsSVGFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSVGFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:781
QgsExpressionContextUtils::updateSymbolScope
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
Definition: qgsexpressioncontextutils.cpp:459
QgsLayerPropertiesWidget::setDockMode
void setDockMode(bool dockMode) override
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
Definition: qgslayerpropertieswidget.cpp:165
QgsSymbolLayerAbstractMetadata::createSymbolLayerWidget
virtual QgsSymbolLayerWidget * createSymbolLayerWidget(QgsVectorLayer *)
Create widget for symbol layer of this type. Can return nullptr if there's no GUI.
Definition: qgssymbollayerregistry.h:52
QgsLayerPropertiesWidget::context
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
Definition: qgslayerpropertieswidget.cpp:160
qgsarrowsymbollayerwidget.h
qgslayerpropertieswidget.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsPropertyOverrideButton::registerExpressionContextGenerator
void registerExpressionContextGenerator(QgsExpressionContextGenerator *generator)
Register an expression context generator class that will be used to retrieve an expression context fo...
Definition: qgspropertyoverridebutton.cpp:954
QgsShapeburstFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsShapeburstFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:431
QgsLayerPropertiesWidget::setContext
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Definition: qgslayerpropertieswidget.cpp:151
QgsSymbolLayerUtils::symbolLayerPreviewPicture
static QPicture symbolLayerPreviewPicture(const QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit units, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
Draws a symbol layer preview to a QPicture.
Definition: qgssymbollayerutils.cpp:835
QgsSymbol::Line
@ Line
Line symbol.
Definition: qgssymbol.h:88
QgsSymbol::type
SymbolType type() const
Returns the symbol's type.
Definition: qgssymbol.h:122
QgsExpressionContextUtils::atlasScope
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
Definition: qgsexpressioncontextutils.cpp:580
QgsSymbolLayer::Property
Property
Data definable properties.
Definition: qgssymbollayer.h:131
QgsExpressionContext::setHighlightedVariables
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
Definition: qgsexpressioncontext.cpp:324
QgsSymbolLayer::layerType
virtual QString layerType() const =0
Returns a string that represents this layer type.
QgsLayerPropertiesWidget::updateSymbolLayerWidget
void updateSymbolLayerWidget(QgsSymbolLayer *layer)
Definition: qgslayerpropertieswidget.cpp:196
QgsSymbolLayerAbstractMetadata::createSymbolLayer
virtual QgsSymbolLayer * createSymbolLayer(const QgsStringMap &map)=0
Create a symbol layer of this type given the map of properties.
QgsSymbol::Hybrid
@ Hybrid
Hybrid symbol.
Definition: qgssymbol.h:90
qgslogger.h
QgsPaintEffect::enabled
bool enabled() const
Returns whether the effect is enabled.
Definition: qgspainteffect.h:198
QgsExpressionContextScope::StaticVariable
Single variable definition for use within a QgsExpressionContextScope.
Definition: qgsexpressioncontext.h:119
qgspanelwidget.h
QgsMapSettings
The QgsMapSettings class contains configuration for rendering of the map.
Definition: qgsmapsettings.h:88
QgsFilledMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsFilledMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:321
qgsmasksymbollayerwidget.h
QgsLayerPropertiesWidget::populateLayerTypes
void populateLayerTypes()
Definition: qgslayerpropertieswidget.cpp:171
QgsLayerPropertiesWidget::createExpressionContext
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Definition: qgslayerpropertieswidget.cpp:229
qgssymbol.h
QgsLayerPropertiesWidget::emitSignalChanged
void emitSignalChanged()
Definition: qgslayerpropertieswidget.cpp:331
qgsproject.h
QgsSymbolWidgetContext::additionalExpressionContextScopes
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
Definition: qgssymbolwidgetcontext.cpp:87
QgsSymbolLayer::setDataDefinedProperty
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
Definition: qgssymbollayer.cpp:113
QgsLayerPropertiesWidget::QgsLayerPropertiesWidget
QgsLayerPropertiesWidget(QgsSymbolLayer *layer, const QgsSymbol *symbol, QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsLayerPropertiesWidget.
Definition: qgslayerpropertieswidget.cpp:102
QgsSymbolLayerRegistry::symbolLayerMetadata
QgsSymbolLayerAbstractMetadata * symbolLayerMetadata(const QString &name) const
Returns metadata for specified symbol layer. Returns nullptr if not found.
Definition: qgssymbollayerregistry.cpp:93