QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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"
36 #include "qgssymbol.h" //for the unit
37 #include "qgspanelwidget.h"
38 #include "qgsmapcanvas.h"
39 #include "qgspainteffect.h"
40 #include "qgsproject.h"
41 #include "qgsvectorlayer.h"
44 #include "qgstemporalcontroller.h"
45 #include "qgssymbollayerutils.h"
47 #include "qgsmarkersymbol.h"
48 #include "qgslinesymbol.h"
49 #include "qgsfillsymbol.h"
50 #include "qgsmarkersymbollayer.h"
51 
52 static bool _initWidgetFunction( const QString &name, QgsSymbolLayerWidgetFunc f )
53 {
55 
56  QgsSymbolLayerAbstractMetadata *abstractMetadata = reg->symbolLayerMetadata( name );
57  if ( !abstractMetadata )
58  {
59  QgsDebugMsg( "Failed to find symbol layer's entry in registry: " + name );
60  return false;
61  }
62  QgsSymbolLayerMetadata *metadata = dynamic_cast<QgsSymbolLayerMetadata *>( abstractMetadata );
63  if ( !metadata )
64  {
65  QgsDebugMsg( "Failed to cast symbol layer's metadata: " + name );
66  return false;
67  }
68  metadata->setWidgetFunction( f );
69  return true;
70 }
71 
72 static void _initWidgetFunctions()
73 {
74  static bool sInitialized = false;
75  if ( sInitialized )
76  return;
77 
78  _initWidgetFunction( QStringLiteral( "SimpleLine" ), QgsSimpleLineSymbolLayerWidget::create );
79  _initWidgetFunction( QStringLiteral( "MarkerLine" ), QgsMarkerLineSymbolLayerWidget::create );
80  _initWidgetFunction( QStringLiteral( "HashLine" ), QgsHashedLineSymbolLayerWidget::create );
81  _initWidgetFunction( QStringLiteral( "ArrowLine" ), QgsArrowSymbolLayerWidget::create );
82  _initWidgetFunction( QStringLiteral( "InterpolatedLine" ), QgsInterpolatedLineSymbolLayerWidget::create );
83  _initWidgetFunction( QStringLiteral( "RasterLine" ), QgsRasterLineSymbolLayerWidget::create );
84  _initWidgetFunction( QStringLiteral( "Lineburst" ), QgsLineburstSymbolLayerWidget::create );
85 
86  _initWidgetFunction( QStringLiteral( "SimpleMarker" ), QgsSimpleMarkerSymbolLayerWidget::create );
87  _initWidgetFunction( QStringLiteral( "FilledMarker" ), QgsFilledMarkerSymbolLayerWidget::create );
88  _initWidgetFunction( QStringLiteral( "SvgMarker" ), QgsSvgMarkerSymbolLayerWidget::create );
89  _initWidgetFunction( QStringLiteral( "RasterMarker" ), QgsRasterMarkerSymbolLayerWidget::create );
90  _initWidgetFunction( QStringLiteral( "AnimatedMarker" ), QgsAnimatedMarkerSymbolLayerWidget::create );
91  _initWidgetFunction( QStringLiteral( "FontMarker" ), QgsFontMarkerSymbolLayerWidget::create );
92  _initWidgetFunction( QStringLiteral( "EllipseMarker" ), QgsEllipseSymbolLayerWidget::create );
93  _initWidgetFunction( QStringLiteral( "VectorField" ), QgsVectorFieldSymbolLayerWidget::create );
94  _initWidgetFunction( QStringLiteral( "MaskMarker" ), QgsMaskMarkerSymbolLayerWidget::create );
95 
96  _initWidgetFunction( QStringLiteral( "SimpleFill" ), QgsSimpleFillSymbolLayerWidget::create );
97  _initWidgetFunction( QStringLiteral( "GradientFill" ), QgsGradientFillSymbolLayerWidget::create );
98  _initWidgetFunction( QStringLiteral( "ShapeburstFill" ), QgsShapeburstFillSymbolLayerWidget::create );
99  _initWidgetFunction( QStringLiteral( "RasterFill" ), QgsRasterFillSymbolLayerWidget::create );
100  _initWidgetFunction( QStringLiteral( "SVGFill" ), QgsSVGFillSymbolLayerWidget::create );
101  _initWidgetFunction( QStringLiteral( "CentroidFill" ), QgsCentroidFillSymbolLayerWidget::create );
102  _initWidgetFunction( QStringLiteral( "LinePatternFill" ), QgsLinePatternFillSymbolLayerWidget::create );
103  _initWidgetFunction( QStringLiteral( "PointPatternFill" ), QgsPointPatternFillSymbolLayerWidget::create );
104  _initWidgetFunction( QStringLiteral( "RandomMarkerFill" ), QgsRandomMarkerFillSymbolLayerWidget::create );
105 
106  _initWidgetFunction( QStringLiteral( "GeometryGenerator" ), QgsGeometryGeneratorSymbolLayerWidget::create );
107 
108  sInitialized = true;
109 }
110 
111 
113  : QgsPanelWidget( parent )
114  , mLayer( layer )
115  , mSymbol( symbol )
116  , mVectorLayer( vl )
117 {
118 
119  setupUi( this );
120  connect( mEnabledCheckBox, &QCheckBox::toggled, this, &QgsLayerPropertiesWidget::mEnabledCheckBox_toggled );
121  // initialize the sub-widgets
122  // XXX Should this thing be here this way? Initialize all the widgets just for the sake of one layer?
123  // TODO Make this on demand creation
124  _initWidgetFunctions();
125 
126  // TODO Algorithm
127  //
128  // 3. populate the combo box with the supported layer type
129  // 4. set the present layer type
130  // 5. create the widget for the present layer type and set in stacked widget
131  // 6. connect comboBox type changed to two things
132  // 1. emit signal that type has beed changed
133  // 2. remove the widget and place the new widget corresponding to the changed layer type
134  //
136  // update layer type combo box
137  const int idx = cboLayerType->findData( mLayer->layerType() );
138  cboLayerType->setCurrentIndex( idx );
139 
140  connect( mEnabledCheckBox, &QAbstractButton::toggled, mEnabledDDBtn, &QWidget::setEnabled );
141  mEnabledCheckBox->setChecked( mLayer->enabled() );
142 
143  // set the corresponding widget
144  updateSymbolLayerWidget( layer );
145  connect( cboLayerType, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayerPropertiesWidget::layerTypeChanged );
146 
148 
149  this->connectChildPanel( mEffectWidget );
150 
151  if ( !mLayer->paintEffect() )
152  {
154  mLayer->paintEffect()->setEnabled( false );
155  }
156  mEffectWidget->setPaintEffect( mLayer->paintEffect() );
157 
159 }
160 
162 {
163  mContext = context;
164  if ( mSymbol )
165  mContext.setSymbolType( mSymbol->type() );
166 
167  QgsSymbolLayerWidget *w = dynamic_cast< QgsSymbolLayerWidget * >( stackedWidget->currentWidget() );
168  if ( w )
169  w->setContext( mContext );
170 }
171 
173 {
174  return mContext;
175 }
176 
178 {
180  mEffectWidget->setDockMode( this->dockMode() );
181 }
182 
184 {
185  const QStringList symbolLayerIds = QgsApplication::symbolLayerRegistry()->symbolLayersForType( mSymbol->type() );
186 
187  const auto constSymbolLayerIds = symbolLayerIds;
188  for ( const QString &symbolLayerId : constSymbolLayerIds )
189  cboLayerType->addItem( QgsApplication::symbolLayerRegistry()->symbolLayerMetadata( symbolLayerId )->visibleName(), symbolLayerId );
190 
191  if ( mSymbol->type() == Qgis::SymbolType::Fill )
192  {
194  const auto constLineLayerIds = lineLayerIds;
195  for ( const QString &lineLayerId : constLineLayerIds )
196  {
198  if ( layerInfo->type() != Qgis::SymbolType::Hybrid )
199  {
200  const QString visibleName = layerInfo->visibleName();
201  const QString name = tr( "Outline: %1" ).arg( visibleName );
202  cboLayerType->addItem( name, lineLayerId );
203  }
204  }
205  }
206 }
207 
209 {
210  if ( stackedWidget->currentWidget() != pageDummy )
211  {
212  // stop updating from the original widget
213  if ( QgsSymbolLayerWidget *w = qobject_cast< QgsSymbolLayerWidget * >( stackedWidget->currentWidget() ) )
215  stackedWidget->removeWidget( stackedWidget->currentWidget() );
216  }
217 
219 
220  const QString layerType = layer->layerType();
221  QgsSymbolLayerAbstractMetadata *am = pReg->symbolLayerMetadata( layerType );
222  if ( am )
223  {
225  if ( w )
226  {
227  w->setContext( mContext );
228  w->setSymbolLayer( layer );
229  stackedWidget->addWidget( w );
230  stackedWidget->setCurrentWidget( w );
231  // start receiving updates from widget
233  connect( w, &QgsSymbolLayerWidget::symbolChanged, this, &QgsLayerPropertiesWidget::reloadLayer );
234  return;
235  }
236  }
237  // When anything is not right
238  stackedWidget->setCurrentWidget( pageDummy );
239 }
240 
242 {
243  if ( auto *lExpressionContext = mContext.expressionContext() )
244  return *lExpressionContext;
245 
246  QgsExpressionContext expContext;
250 
251  if ( auto *lMapCanvas = mContext.mapCanvas() )
252  {
253  expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
254  << new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
255  if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
256  {
257  expContext << generator->createExpressionContextScope();
258  }
259  }
260  else
261  {
263  }
264 
266 
268  if ( mLayer )
269  {
270  //cheat a bit - set the symbol color variable to match the symbol layer's color (when we should really be using the *symbols*
271  //color, but that's not accessible here). 99% of the time these will be the same anyway
273  }
274  expContext << symbolScope;
280  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_layer_count" ), 1, true ) );
281  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_layer_index" ), 1, true ) );
282  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_marker_row" ), 1, true ) );
283  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_marker_column" ), 1, true ) );
284  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_frame" ), 1, true ) );
285 
286  // additional scopes
287  const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
288  for ( const QgsExpressionContextScope &scope : constAdditionalExpressionContextScopes )
289  {
290  expContext.appendScope( new QgsExpressionContextScope( scope ) );
291  }
292 
293  //TODO - show actual value
294  expContext.setOriginalValueVariable( QVariant() );
295 
301  << QStringLiteral( "symbol_layer_count" ) << QStringLiteral( "symbol_layer_index" )
302  << QStringLiteral( "symbol_frame" ) );
303 
304  return expContext;
305 }
306 
308 {
310  connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayerPropertiesWidget::updateProperty );
311  button->registerExpressionContextGenerator( this );
312 }
313 
314 void QgsLayerPropertiesWidget::updateProperty()
315 {
316  QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
317  const QgsSymbolLayer::Property key = static_cast< QgsSymbolLayer::Property >( button->propertyKey() );
318  mLayer->setDataDefinedProperty( key, button->toProperty() );
319  emit changed();
320 }
321 
323 {
324  QgsSymbolLayer *layer = mLayer;
325  if ( !layer )
326  return;
327  const QString newLayerType = cboLayerType->currentData().toString();
328  if ( layer->layerType() == newLayerType )
329  return;
330 
331  // get creation function for new layer from registry
333  QgsSymbolLayerAbstractMetadata *am = pReg->symbolLayerMetadata( newLayerType );
334  if ( !am ) // check whether the metadata is assigned
335  return;
336 
337  // change layer to a new (with different type)
338  // base new layer on existing layer's properties
339  QVariantMap properties = layer->properties();
340 
341  // if the old symbol layer was a "geometry generator" layer then
342  // we instead get the properties from the generator
343  if ( QgsGeometryGeneratorSymbolLayer *generator = dynamic_cast< QgsGeometryGeneratorSymbolLayer * >( layer ) )
344  {
345  if ( generator->subSymbol() && generator->subSymbol()->symbolLayerCount() > 0 )
346  properties = generator->subSymbol()->symbolLayer( 0 )->properties();
347  }
348 
349  QgsSymbolLayer *newLayer = am->createSymbolLayer( properties );
350  if ( !newLayer )
351  return;
352 
353  // if a symbol layer is changed to a "geometry generator" layer, then we move the old symbol layer into the
354  // geometry generator's subsymbol.
355  if ( QgsGeometryGeneratorSymbolLayer *generator = dynamic_cast< QgsGeometryGeneratorSymbolLayer * >( newLayer ) )
356  {
357  if ( mSymbol )
358  {
359  switch ( mSymbol->type() )
360  {
362  {
363  std::unique_ptr< QgsMarkerSymbol > markerSymbol = std::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList( {layer->clone() } ) );
364  generator->setSymbolType( Qgis::SymbolType::Marker );
365  generator->setSubSymbol( markerSymbol.release() );
366  break;
367  }
369  {
370  std::unique_ptr< QgsLineSymbol > lineSymbol = std::make_unique< QgsLineSymbol >( QgsSymbolLayerList( {layer->clone() } ) );
371  generator->setSymbolType( Qgis::SymbolType::Line );
372  generator->setSubSymbol( lineSymbol.release() );
373  break;
374  }
376  {
377  std::unique_ptr< QgsFillSymbol > fillSymbol = std::make_unique< QgsFillSymbol >( QgsSymbolLayerList( {layer->clone() } ) );
378  generator->setSymbolType( Qgis::SymbolType::Fill );
379  generator->setSubSymbol( fillSymbol.release() );
380  break;
381  }
383  break;
384  }
385  }
386  }
387  else
388  {
389  // try to copy the subsymbol, if its the same type as the new symbol layer's subsymbol
390  if ( newLayer->subSymbol() && layer->subSymbol() && newLayer->subSymbol()->type() == layer->subSymbol()->type() )
391  {
392  newLayer->setSubSymbol( layer->subSymbol()->clone() );
393  }
394  }
395 
396  // special logic for when NEW symbol layers are created from GUI only...
397  // TODO: find a nicer generic way to handle this!
398  if ( QgsFontMarkerSymbolLayer *fontMarker = dynamic_cast< QgsFontMarkerSymbolLayer * >( newLayer ) )
399  {
400  const QString defaultFont = fontMarker->fontFamily();
401  const QFontDatabase fontDb;
402  if ( !fontDb.hasFamily( defaultFont ) )
403  {
404  // default font marker font choice doesn't exist on system, so just use first available symbol font
405  const QStringList candidates = fontDb.families( QFontDatabase::WritingSystem::Symbol );
406  bool foundGoodCandidate = false;
407  for ( const QString &candidate : candidates )
408  {
409  if ( fontDb.writingSystems( candidate ).size() == 1 )
410  {
411  // family ONLY offers symbol writing systems, so it's a good candidate!
412  fontMarker->setFontFamily( candidate );
413  foundGoodCandidate = true;
414  break;
415  }
416  }
417  if ( !foundGoodCandidate && !candidates.empty() )
418  {
419  // fallback to first available family which advertises symbol writing system
420  QString candidate = candidates.at( 0 );
421  fontMarker->setFontFamily( candidate );
422  }
423  }
424 
425  // search (briefly!!) for a unicode character which actually exists in the font
426  const QFontMetrics fontMetrics( fontMarker->fontFamily() );
427  ushort character = fontMarker->character().at( 0 ).unicode();
428  for ( ; character < 1000; ++character )
429  {
430  if ( fontMetrics.inFont( QChar( character ) ) )
431  {
432  fontMarker->setCharacter( QChar( character ) );
433  break;
434  }
435  }
436  }
437 
438  updateSymbolLayerWidget( newLayer );
439  emit changeLayer( newLayer );
440 }
441 
443 {
444  emit changed();
445 
446  // also update paint effect preview
447  bool paintEffectToggled = false;
448  if ( mLayer->paintEffect() && mLayer->paintEffect()->enabled() )
449  {
450  mLayer->paintEffect()->setEnabled( false );
451  paintEffectToggled = true;
452  }
454  if ( paintEffectToggled )
455  {
456  mLayer->paintEffect()->setEnabled( true );
457  }
458  emit widgetChanged();
459 }
460 
461 void QgsLayerPropertiesWidget::reloadLayer()
462 {
463  emit changeLayer( mLayer );
464 }
465 
466 void QgsLayerPropertiesWidget::mEnabledCheckBox_toggled( bool enabled )
467 {
468  mLayer->setEnabled( enabled );
470 }
QgsAnimatedMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsAnimatedMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:748
QgsSymbolLayer::setEnabled
void setEnabled(bool enabled)
Sets whether symbol layer is enabled and should be drawn.
Definition: qgssymbollayer.h:251
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
QgsSymbolLayer::enabled
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
Definition: qgssymbollayer.h:242
qgsexpressioncontextutils.h
qgsinterpolatedlinesymbollayerwidget.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:149
qgssymbollayerwidget.h
QgsSymbolLayerAbstractMetadata::visibleName
QString visibleName() const
Definition: qgssymbollayerregistry.h:55
QgsGradientFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsGradientFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:383
QgsSymbolLayerAbstractMetadata::createSymbolLayer
virtual QgsSymbolLayer * createSymbolLayer(const QVariantMap &map)=0
Create a symbol layer of this type given the map of properties.
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:1003
QgsSymbolLayerAbstractMetadata
Stores metadata about one symbol layer class.
Definition: qgssymbollayerregistry.h:36
QgsSymbolLayer::dataDefinedProperties
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
Definition: qgssymbollayer.h:595
QgsLayerPropertiesWidget::layerTypeChanged
void layerTypeChanged()
Definition: qgslayerpropertieswidget.cpp:322
Qgis::SymbolType::Fill
@ Fill
Fill symbol.
QgsSimpleFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSimpleFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:276
QgsLayerPropertiesWidget::mVectorLayer
QgsVectorLayer * mVectorLayer
Definition: qgslayerpropertieswidget.h:102
QgsSymbolLayerWidget::changed
void changed()
Should be emitted whenever configuration changes happened on this symbol layer configuration.
Qgis::SymbolType::Line
@ Line
Line symbol.
QgsExpressionContext::EXPR_ORIGINAL_VALUE
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
Definition: qgsexpressioncontext.h:805
QgsLayerPropertiesWidget::mSymbol
const QgsSymbol * mSymbol
Definition: qgslayerpropertieswidget.h:101
QgsExpressionContextUtils::globalScope
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Definition: qgsexpressioncontextutils.cpp:40
qgsmapcanvas.h
QgsExpressionContextScope::addVariable
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Definition: qgsexpressioncontext.cpp:97
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:827
QgsExpressionContext::EXPR_GEOMETRY_POINT_COUNT
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
Definition: qgsexpressioncontext.h:821
QgsVectorFieldSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsVectorFieldSymbolLayerWidget.
Definition: qgsvectorfieldsymbollayerwidget.h:45
QgsSymbolLayer::subSymbol
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
Definition: qgssymbollayer.cpp:154
QgsExpressionContext::lastScope
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
Definition: qgsexpressioncontext.cpp:377
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:823
QgsExpressionContext::setOriginalValueVariable
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
Definition: qgsexpressioncontext.cpp:600
qgssymbollayerutils.h
QgsSymbolLayerWidget
Definition: qgssymbollayerwidget.h:37
QgsExpressionContextUtils::layerScope
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Definition: qgsexpressioncontextutils.cpp:334
QgsSymbolWidgetContext
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Definition: qgssymbolwidgetcontext.h:35
QgsPointPatternFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsPointPatternFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:1046
qgsmarkersymbollayer.h
QgsSimpleMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSimpleMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:214
QgsMarkerLineSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsMarkerLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:492
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:427
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:480
QgsInterpolatedLineSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *layer)
Static creation method.
Definition: qgsinterpolatedlinesymbollayerwidget.h:59
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:169
QgsRandomMarkerFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsRandomMarkerFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:1101
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:183
qgspainteffectregistry.h
QgsExpressionContextScopeGenerator
Abstract interface for generating an expression context scope.
Definition: qgsexpressioncontextscopegenerator.h:28
QgsExpressionContext::EXPR_GEOMETRY_PART_NUM
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
Definition: qgsexpressioncontext.h:813
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
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:807
QgsSymbolLayerAbstractMetadata::type
Qgis::SymbolType type() const
Definition: qgssymbollayerregistry.h:56
QgsPanelWidget::dockMode
bool dockMode()
Returns the dock mode state.
Definition: qgspanelwidget.h:93
QgsSymbolWidgetContext::setSymbolType
void setSymbolType(Qgis::SymbolType type)
Sets the associated symbol type, if the widget is being shown as a subcomponent of a parent symbol co...
Definition: qgssymbolwidgetcontext.cpp:123
qgsvectorfieldsymbollayerwidget.h
QgsPropertyOverrideButton
A button for controlling property overrides which may apply to a widget.
Definition: qgspropertyoverridebutton.h:50
QgsApplication::symbolLayerRegistry
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers.
Definition: qgsapplication.cpp:2385
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:1241
QgsSymbolLayer::propertyDefinitions
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
Definition: qgssymbollayer.cpp:292
QgsSymbolLayer::clone
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
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:291
QgsLayerPropertiesWidget::registerDataDefinedButton
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key)
Registers a data defined override button.
Definition: qgslayerpropertieswidget.cpp:307
QgsSymbolLayerWidgetFunc
QgsSymbolLayerWidget *(* QgsSymbolLayerWidgetFunc)(QgsVectorLayer *)
Definition: qgssymbollayerregistry.h:101
QgsSymbolLayer
Definition: qgssymbollayer.h:54
QgsSvgMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSvgMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:605
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
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:128
QgsRasterFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsRasterFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:807
QgsSymbolLayer::setSubSymbol
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer's subsymbol. takes ownership of the passed symbol.
Definition: qgssymbollayer.cpp:159
QgsSymbol::type
Qgis::SymbolType type() const
Returns the symbol's type.
Definition: qgssymbol.h:152
QgsFontMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsFontMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:1147
QgsHashedLineSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsHashedLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:548
qgssymbollayerregistry.h
QgsLayerPropertiesWidget::changed
void changed()
QgsGeometryGeneratorSymbolLayer
Definition: qgsgeometrygeneratorsymbollayer.h:31
QgsPanelWidget::widgetChanged
void widgetChanged()
Emitted when the widget state changes.
QgsSymbolLayer::properties
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
QgsPropertyOverrideButton::toProperty
QgsProperty toProperty() const
Returns a QgsProperty object encapsulating the current state of the widget.
Definition: qgspropertyoverridebutton.cpp:192
QgsSymbolLayerRegistry::symbolLayersForType
QStringList symbolLayersForType(Qgis::SymbolType type)
Returns a list of available symbol layers for a specified symbol type.
Definition: qgssymbollayerregistry.cpp:171
QgsSymbolLayerMetadata
Convenience metadata class that uses static functions to create symbol layer and its widget.
Definition: qgssymbollayerregistry.h:110
QgsSymbolLayerUtils::symbolLayerPreviewPicture
static QPicture symbolLayerPreviewPicture(const QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit units, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::SymbolType parentSymbolType=Qgis::SymbolType::Hybrid)
Draws a symbol layer preview to a QPicture.
Definition: qgssymbollayerutils.cpp:947
QgsRasterMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsRasterMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:691
qgssymbollayer.h
qgsellipsesymbollayerwidget.h
QgsSymbolLayer::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
Definition: qgssymbollayer.cpp:228
QgsMapUnitScale
Struct for storing maximum and minimum scales for measurements in map units.
Definition: qgsmapunitscale.h:36
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:223
QgsGeometryGeneratorSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Will be registered as factory.
Definition: qgssymbollayerwidget.h:1283
QgsSymbolLayerMetadata::setWidgetFunction
void setWidgetFunction(QgsSymbolLayerWidgetFunc f)
Definition: qgssymbollayerregistry.h:139
QgsPaintEffect::setEnabled
void setEnabled(bool enabled)
Sets whether the effect is enabled.
Definition: qgspainteffect.cpp:45
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
QgsExpressionContext::EXPR_GEOMETRY_RING_NUM
static const QString EXPR_GEOMETRY_RING_NUM
Inbuilt variable name for geometry ring number variable.
Definition: qgsexpressioncontext.h:819
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext....
Definition: qgsexpressioncontext.h:113
QgsLayerPropertiesWidget::mLayer
QgsSymbolLayer * mLayer
Definition: qgslayerpropertieswidget.h:99
QgsSymbolLayer::PropertyLayerEnabled
@ PropertyLayerEnabled
Whether symbol layer is enabled.
Definition: qgssymbollayer.h:188
QgsExpressionContext::appendScope
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
Definition: qgsexpressioncontext.cpp:494
qgsvectorlayer.h
QgsExpressionContext::EXPR_CLUSTER_SIZE
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
Definition: qgsexpressioncontext.h:825
QgsExpressionContext::EXPR_GEOMETRY_PART_COUNT
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
Definition: qgsexpressioncontext.h:811
Qgis::SymbolType::Hybrid
@ Hybrid
Hybrid symbol.
QgsSymbol::clone
virtual QgsSymbol * clone() const =0
Returns a deep copy of this symbol.
QgsSVGFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsSVGFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:945
QgsLineburstSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsLineburstSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:906
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:538
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:177
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:61
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:172
qgsarrowsymbollayerwidget.h
qgslayerpropertieswidget.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
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:945
QgsSymbolLayerList
QList< QgsSymbolLayer * > QgsSymbolLayerList
Definition: qgssymbol.h:27
qgsmarkersymbol.h
QgsShapeburstFillSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsShapeburstFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:440
QgsFontMarkerSymbolLayer
Definition: qgsmarkersymbollayer.h:860
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:161
QgsExpressionContextUtils::atlasScope
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
Definition: qgsexpressioncontextutils.cpp:660
QgsSymbolLayer::Property
Property
Data definable properties.
Definition: qgssymbollayer.h:142
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:328
QgsSymbolLayer::layerType
virtual QString layerType() const =0
Returns a string that represents this layer type.
QgsSymbolLayer::color
virtual QColor color() const
Returns the "representative" color of the symbol layer.
Definition: qgssymbollayer.cpp:247
QgsLayerPropertiesWidget::updateSymbolLayerWidget
void updateSymbolLayerWidget(QgsSymbolLayer *layer)
Definition: qgslayerpropertieswidget.cpp:208
qgsgeometrygeneratorsymbollayer.h
qgslogger.h
QgsPaintEffect::enabled
bool enabled() const
Returns whether the effect is enabled.
Definition: qgspainteffect.h:197
QgsExpressionContextScope::StaticVariable
Single variable definition for use within a QgsExpressionContextScope.
Definition: qgsexpressioncontext.h:120
qgspanelwidget.h
QgsMapSettings
The QgsMapSettings class contains configuration for rendering of the map. The rendering itself is don...
Definition: qgsmapsettings.h:88
QgsFilledMarkerSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsFilledMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:330
qgsmasksymbollayerwidget.h
QgsRasterLineSymbolLayerWidget::create
static QgsSymbolLayerWidget * create(QgsVectorLayer *vl)
Creates a new QgsRasterLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.h:860
qgsfillsymbol.h
QgsLayerPropertiesWidget::populateLayerTypes
void populateLayerTypes()
Definition: qgslayerpropertieswidget.cpp:183
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:241
qgssymbol.h
QgsLayerPropertiesWidget::emitSignalChanged
void emitSignalChanged()
Definition: qgslayerpropertieswidget.cpp:442
qgsproject.h
Qgis::SymbolType::Marker
@ Marker
Marker symbol.
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:126
QgsLayerPropertiesWidget::QgsLayerPropertiesWidget
QgsLayerPropertiesWidget(QgsSymbolLayer *layer, const QgsSymbol *symbol, QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsLayerPropertiesWidget.
Definition: qgslayerpropertieswidget.cpp:112
QgsSymbolLayerRegistry::symbolLayerMetadata
QgsSymbolLayerAbstractMetadata * symbolLayerMetadata(const QString &name) const
Returns metadata for specified symbol layer. Returns nullptr if not found.
Definition: qgssymbollayerregistry.cpp:113
qgslinesymbol.h