QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgssymbolslistwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbolslist.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 
16 
17 #include "qgssymbolslistwidget.h"
18 
19 #include "qgsstylemanagerdialog.h"
20 #include "qgsstylesavedialog.h"
22 #include "qgsvectorlayer.h"
24 #include "qgsauxiliarystorage.h"
25 #include <QMessageBox>
26 
27 QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbol *symbol, QgsStyle *style, QMenu *menu, QWidget *parent, QgsVectorLayer *layer )
28  : QWidget( parent )
29  , mSymbol( symbol )
30  , mStyle( style )
31  , mAdvancedMenu( menu )
32  , mLayer( layer )
33 {
34  setupUi( this );
35  connect( mSymbolUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSymbolsListWidget::mSymbolUnitWidget_changed );
36  spinAngle->setClearValue( 0 );
37 
40 
41  mStyleItemsListWidget->setStyle( mStyle );
42  mStyleItemsListWidget->setEntityType( QgsStyle::SymbolEntity );
43  if ( mSymbol )
44  mStyleItemsListWidget->setSymbolType( mSymbol->type() );
45  mStyleItemsListWidget->setAdvancedMenu( menu );
46 
47  mClipFeaturesAction = new QAction( tr( "Clip Features to Canvas Extent" ), this );
48  mClipFeaturesAction->setCheckable( true );
49  connect( mClipFeaturesAction, &QAction::toggled, this, &QgsSymbolsListWidget::clipFeaturesToggled );
50  mStandardizeRingsAction = new QAction( tr( "Force Right-Hand-Rule Orientation" ), this );
51  mStandardizeRingsAction->setCheckable( true );
52  connect( mStandardizeRingsAction, &QAction::toggled, this, &QgsSymbolsListWidget::forceRHRToggled );
53 
54  if ( mSymbol )
55  {
56  updateSymbolInfo();
57  }
58 
59  // select correct page in stacked widget
60  // there's a correspondence between symbol type number and page numbering => exploit it!
61  stackedWidget->setCurrentIndex( symbol->type() );
63  connect( spinAngle, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSymbolsListWidget::setMarkerAngle );
64  connect( spinSize, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSymbolsListWidget::setMarkerSize );
65  connect( spinWidth, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSymbolsListWidget::setLineWidth );
66 
67  registerDataDefinedButton( mRotationDDBtn, QgsSymbolLayer::PropertyAngle );
69  registerDataDefinedButton( mSizeDDBtn, QgsSymbolLayer::PropertySize );
71  registerDataDefinedButton( mWidthDDBtn, QgsSymbolLayer::PropertyStrokeWidth );
73 
74  connect( this, &QgsSymbolsListWidget::changed, this, &QgsSymbolsListWidget::updateAssistantSymbol );
75  updateAssistantSymbol();
76 
77  btnColor->setAllowOpacity( true );
78  btnColor->setColorDialogTitle( tr( "Select Color" ) );
79  btnColor->setContext( QStringLiteral( "symbology" ) );
80 
81  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsSymbolsListWidget::opacityChanged );
82 
83  connect( mStyleItemsListWidget, &QgsStyleItemsListWidget::selectionChanged, this, &QgsSymbolsListWidget::setSymbolFromStyle );
84  connect( mStyleItemsListWidget, &QgsStyleItemsListWidget::saveEntity, this, &QgsSymbolsListWidget::saveSymbol );
85 }
86 
88 {
89  // This action was added to the menu by this widget, clean it up
90  // The menu can be passed in the constructor, so may live longer than this widget
91  mStyleItemsListWidget->advancedMenu()->removeAction( mClipFeaturesAction );
92  mStyleItemsListWidget->advancedMenu()->removeAction( mStandardizeRingsAction );
93 }
94 
95 void QgsSymbolsListWidget::registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key )
96 {
97  button->setProperty( "propertyKey", key );
98  button->registerExpressionContextGenerator( this );
99 
100  connect( button, &QgsPropertyOverrideButton::createAuxiliaryField, this, &QgsSymbolsListWidget::createAuxiliaryField );
101 }
102 
103 void QgsSymbolsListWidget::createAuxiliaryField()
104 {
105  // try to create an auxiliary layer if not yet created
106  if ( !mLayer->auxiliaryLayer() )
107  {
108  QgsNewAuxiliaryLayerDialog dlg( mLayer, this );
109  dlg.exec();
110  }
111 
112  // return if still not exists
113  if ( !mLayer->auxiliaryLayer() )
114  return;
115 
116  QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
117  QgsSymbolLayer::Property key = static_cast< QgsSymbolLayer::Property >( button->propertyKey() );
119 
120  // create property in auxiliary storage if necessary
121  if ( !mLayer->auxiliaryLayer()->exists( def ) )
122  mLayer->auxiliaryLayer()->addAuxiliaryField( def );
123 
124  // update property with join field name from auxiliary storage
125  QgsProperty property = button->toProperty();
126  property.setField( QgsAuxiliaryLayer::nameFromProperty( def, true ) );
127  property.setActive( true );
128  button->updateFieldLists();
129  button->setToProperty( property );
130 
131  QgsMarkerSymbol *markerSymbol = static_cast<QgsMarkerSymbol *>( mSymbol );
132  QgsLineSymbol *lineSymbol = static_cast<QgsLineSymbol *>( mSymbol );
133  switch ( key )
134  {
136  if ( markerSymbol )
137  markerSymbol->setDataDefinedAngle( button->toProperty() );
138  break;
139 
141  if ( markerSymbol )
142  {
143  markerSymbol->setDataDefinedSize( button->toProperty() );
144  markerSymbol->setScaleMethod( QgsSymbol::ScaleDiameter );
145  }
146  break;
147 
149  if ( lineSymbol )
150  lineSymbol->setDataDefinedWidth( button->toProperty() );
151  break;
152 
153  default:
154  break;
155  }
156 
157  emit changed();
158 }
159 
161 {
162  mContext = context;
163  const auto unitSelectionWidgets { findChildren<QgsUnitSelectionWidget *>() };
164  for ( QgsUnitSelectionWidget *unitWidget : unitSelectionWidgets )
165  {
166  unitWidget->setMapCanvas( mContext.mapCanvas() );
167  }
168 #if 0
169  Q_FOREACH ( QgsPropertyOverrideButton *ddButton, findChildren<QgsPropertyOverrideButton *>() )
170  {
171  if ( ddButton->assistant() )
172  ddButton->assistant()->setMapCanvas( mContext.mapCanvas() );
173  }
174 #endif
175 }
176 
178 {
179  return mContext;
180 }
181 
182 void QgsSymbolsListWidget::forceRHRToggled( bool checked )
183 {
184  if ( !mSymbol )
185  return;
186 
187  mSymbol->setForceRHR( checked );
188  emit changed();
189 }
190 
191 void QgsSymbolsListWidget::saveSymbol()
192 {
193  if ( !mStyle )
194  return;
195 
196  QgsStyleSaveDialog saveDlg( this );
197  saveDlg.setDefaultTags( mStyleItemsListWidget->currentTagFilter() );
198  if ( !saveDlg.exec() )
199  return;
200 
201  if ( saveDlg.name().isEmpty() )
202  return;
203 
204  // check if there is no symbol with same name
205  if ( mStyle->symbolNames().contains( saveDlg.name() ) )
206  {
207  int res = QMessageBox::warning( this, tr( "Save Symbol" ),
208  tr( "Symbol with name '%1' already exists. Overwrite?" )
209  .arg( saveDlg.name() ),
210  QMessageBox::Yes | QMessageBox::No );
211  if ( res != QMessageBox::Yes )
212  {
213  return;
214  }
215  mStyle->removeSymbol( saveDlg.name() );
216  }
217 
218  QStringList symbolTags = saveDlg.tags().split( ',' );
219 
220  // add new symbol to style and re-populate the list
221  mStyle->addSymbol( saveDlg.name(), mSymbol->clone() );
222 
223  // make sure the symbol is stored
224  mStyle->saveSymbol( saveDlg.name(), mSymbol->clone(), saveDlg.isFavorite(), symbolTags );
225 }
226 
228 {
229  if ( !mSymbol )
230  return;
231 
232  mSymbol->setClipFeaturesToExtent( checked );
233  emit changed();
234 }
235 
236 void QgsSymbolsListWidget::setSymbolColor( const QColor &color )
237 {
238  mSymbol->setColor( color );
239  emit changed();
240 }
241 
243 {
244  QgsMarkerSymbol *markerSymbol = static_cast<QgsMarkerSymbol *>( mSymbol );
245  if ( markerSymbol->angle() == angle )
246  return;
247  markerSymbol->setAngle( angle );
248  emit changed();
249 }
250 
252 {
253  QgsMarkerSymbol *markerSymbol = static_cast<QgsMarkerSymbol *>( mSymbol );
254  QgsProperty dd( mRotationDDBtn->toProperty() );
255 
256  spinAngle->setEnabled( !mRotationDDBtn->isActive() );
257 
258  QgsProperty symbolDD( markerSymbol->dataDefinedAngle() );
259 
260  if ( // shall we remove datadefined expressions for layers ?
261  ( !symbolDD && !dd )
262  // shall we set the "en masse" expression for properties ?
263  || dd )
264  {
265  markerSymbol->setDataDefinedAngle( dd );
266  emit changed();
267  }
268 }
269 
271 {
272  QgsMarkerSymbol *markerSymbol = static_cast<QgsMarkerSymbol *>( mSymbol );
273  if ( markerSymbol->size() == size )
274  return;
275  markerSymbol->setSize( size );
276  emit changed();
277 }
278 
280 {
281  QgsMarkerSymbol *markerSymbol = static_cast<QgsMarkerSymbol *>( mSymbol );
282  QgsProperty dd( mSizeDDBtn->toProperty() );
283 
284  spinSize->setEnabled( !mSizeDDBtn->isActive() );
285 
286  QgsProperty symbolDD( markerSymbol->dataDefinedSize() );
287 
288  if ( // shall we remove datadefined expressions for layers ?
289  ( !symbolDD && !dd )
290  // shall we set the "en masse" expression for properties ?
291  || dd )
292  {
293  markerSymbol->setDataDefinedSize( dd );
294  markerSymbol->setScaleMethod( QgsSymbol::ScaleDiameter );
295  emit changed();
296  }
297 }
298 
300 {
301  QgsLineSymbol *lineSymbol = static_cast<QgsLineSymbol *>( mSymbol );
302  if ( lineSymbol->width() == width )
303  return;
304  lineSymbol->setWidth( width );
305  emit changed();
306 }
307 
309 {
310  QgsLineSymbol *lineSymbol = static_cast<QgsLineSymbol *>( mSymbol );
311  QgsProperty dd( mWidthDDBtn->toProperty() );
312 
313  spinWidth->setEnabled( !mWidthDDBtn->isActive() );
314 
315  QgsProperty symbolDD( lineSymbol->dataDefinedWidth() );
316 
317  if ( // shall we remove datadefined expressions for layers ?
318  ( !symbolDD && !dd )
319  // shall we set the "en masse" expression for properties ?
320  || dd )
321  {
322  lineSymbol->setDataDefinedWidth( dd );
323  emit changed();
324  }
325 }
326 
327 void QgsSymbolsListWidget::updateAssistantSymbol()
328 {
329  mAssistantSymbol.reset( mSymbol->clone() );
330  if ( mSymbol->type() == QgsSymbol::Marker )
331  mSizeDDBtn->setSymbol( mAssistantSymbol );
332  else if ( mSymbol->type() == QgsSymbol::Line && mLayer )
333  mWidthDDBtn->setSymbol( mAssistantSymbol );
334 }
335 
336 void QgsSymbolsListWidget::mSymbolUnitWidget_changed()
337 {
338  if ( mSymbol )
339  {
340 
341  mSymbol->setOutputUnit( mSymbolUnitWidget->unit() );
342  mSymbol->setMapUnitScale( mSymbolUnitWidget->getMapUnitScale() );
343 
344  emit changed();
345  }
346 }
347 
348 void QgsSymbolsListWidget::opacityChanged( double opacity )
349 {
350  if ( mSymbol )
351  {
352  mSymbol->setOpacity( opacity );
353  emit changed();
354  }
355 }
356 
357 void QgsSymbolsListWidget::updateSymbolColor()
358 {
359  btnColor->blockSignals( true );
360  btnColor->setColor( mSymbol->color() );
361  btnColor->blockSignals( false );
362 }
363 
364 QgsExpressionContext QgsSymbolsListWidget::createExpressionContext() const
365 {
366  if ( mContext.expressionContext() )
367  return QgsExpressionContext( *mContext.expressionContext() );
368 
369  //otherwise create a default symbol context
370  QgsExpressionContext expContext( mContext.globalProjectAtlasMapLayerScopes( layer() ) );
371 
372  // additional scopes
373  const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
374  for ( const QgsExpressionContextScope &scope : constAdditionalExpressionContextScopes )
375  {
376  expContext.appendScope( new QgsExpressionContextScope( scope ) );
377  }
378 
379  expContext.setHighlightedVariables( QStringList() << QgsExpressionContext::EXPR_ORIGINAL_VALUE << QgsExpressionContext::EXPR_SYMBOL_COLOR
383  << QStringLiteral( "symbol_layer_count" ) << QStringLiteral( "symbol_layer_index" ) );
384 
385  return expContext;
386 }
387 
388 void QgsSymbolsListWidget::updateSymbolInfo()
389 {
390  updateSymbolColor();
391 
392  const auto overrideButtons {findChildren< QgsPropertyOverrideButton * >()};
393  for ( QgsPropertyOverrideButton *button : overrideButtons )
394  {
395  button->registerExpressionContextGenerator( this );
396  }
397 
398  if ( mSymbol->type() == QgsSymbol::Marker )
399  {
400  QgsMarkerSymbol *markerSymbol = static_cast<QgsMarkerSymbol *>( mSymbol );
401  spinSize->setValue( markerSymbol->size() );
402  spinAngle->setValue( markerSymbol->angle() );
403 
404  if ( mLayer )
405  {
406  QgsProperty ddSize( markerSymbol->dataDefinedSize() );
407  mSizeDDBtn->init( QgsSymbolLayer::PropertySize, ddSize, QgsSymbolLayer::propertyDefinitions(), mLayer, true );
408  spinSize->setEnabled( !mSizeDDBtn->isActive() );
409  QgsProperty ddAngle( markerSymbol->dataDefinedAngle() );
410  mRotationDDBtn->init( QgsSymbolLayer::PropertyAngle, ddAngle, QgsSymbolLayer::propertyDefinitions(), mLayer, true );
411  spinAngle->setEnabled( !mRotationDDBtn->isActive() );
412  }
413  else
414  {
415  mSizeDDBtn->setEnabled( false );
416  mRotationDDBtn->setEnabled( false );
417  }
418  }
419  else if ( mSymbol->type() == QgsSymbol::Line )
420  {
421  QgsLineSymbol *lineSymbol = static_cast<QgsLineSymbol *>( mSymbol );
422  spinWidth->setValue( lineSymbol->width() );
423 
424  if ( mLayer )
425  {
426  QgsProperty dd( lineSymbol->dataDefinedWidth() );
427  mWidthDDBtn->init( QgsSymbolLayer::PropertyStrokeWidth, dd, QgsSymbolLayer::propertyDefinitions(), mLayer, true );
428  spinWidth->setEnabled( !mWidthDDBtn->isActive() );
429  }
430  else
431  {
432  mWidthDDBtn->setEnabled( false );
433  }
434  }
435 
436  mSymbolUnitWidget->blockSignals( true );
437  mSymbolUnitWidget->setUnit( mSymbol->outputUnit() );
438  mSymbolUnitWidget->setMapUnitScale( mSymbol->mapUnitScale() );
439  mSymbolUnitWidget->blockSignals( false );
440 
441  mOpacityWidget->setOpacity( mSymbol->opacity() );
442 
443  // Clean up previous advanced symbol actions
444  const QList<QAction *> actionList( mStyleItemsListWidget->advancedMenu()->actions() );
445  for ( const auto &action : actionList )
446  {
447  if ( mClipFeaturesAction->text() == action->text() )
448  {
449  mStyleItemsListWidget->advancedMenu()->removeAction( action );
450  }
451  else if ( mStandardizeRingsAction->text() == action->text() )
452  {
453  mStyleItemsListWidget->advancedMenu()->removeAction( action );
454  }
455  }
456 
457  if ( mSymbol->type() == QgsSymbol::Line || mSymbol->type() == QgsSymbol::Fill )
458  {
459  //add clip features option for line or fill symbols
460  mStyleItemsListWidget->advancedMenu()->addAction( mClipFeaturesAction );
461  }
462  if ( mSymbol->type() == QgsSymbol::Fill )
463  {
464  mStyleItemsListWidget->advancedMenu()->addAction( mStandardizeRingsAction );
465  }
466 
467  mStyleItemsListWidget->showAdvancedButton( mAdvancedMenu || !mStyleItemsListWidget->advancedMenu()->isEmpty() );
468 
469  whileBlocking( mClipFeaturesAction )->setChecked( mSymbol->clipFeaturesToExtent() );
470  whileBlocking( mStandardizeRingsAction )->setChecked( mSymbol->forceRHR() );
471 }
472 
473 void QgsSymbolsListWidget::setSymbolFromStyle( const QString &name, QgsStyle::StyleEntity )
474 {
475  // get new instance of symbol from style
476  std::unique_ptr< QgsSymbol > s( mStyle->symbol( name ) );
477  if ( !s )
478  return;
479 
480  // remove all symbol layers from original symbolgroupsCombo
481  while ( mSymbol->symbolLayerCount() )
482  mSymbol->deleteSymbolLayer( 0 );
483  // move all symbol layers to our symbol
484  while ( s->symbolLayerCount() )
485  {
486  QgsSymbolLayer *sl = s->takeSymbolLayer( 0 );
487  mSymbol->appendSymbolLayer( sl );
488  }
489  mSymbol->setOpacity( s->opacity() );
490 
491  updateSymbolInfo();
492  emit changed();
493 }
QgsSymbolWidgetContext::globalProjectAtlasMapLayerScopes
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
Definition: qgssymbolwidgetcontext.cpp:92
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:369
QgsOpacityWidget::opacityChanged
void opacityChanged(double opacity)
Emitted when the opacity is changed in the widget, where opacity ranges from 0.0 (transparent) to 1....
QgsMarkerSymbol::setAngle
void setAngle(double symbolAngle)
Sets the angle for the whole symbol.
Definition: qgssymbol.cpp:1460
QgsSymbolWidgetContext::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:54
QgsSymbol::color
QColor color() const
Returns the symbol's color.
Definition: qgssymbol.cpp:495
QgsSymbolsListWidget::setLineWidth
void setLineWidth(double width)
Definition: qgssymbolslistwidget.cpp:299
QgsUnitTypes::RenderInches
@ RenderInches
Inches.
Definition: qgsunittypes.h:173
QgsStyleItemsListWidget::saveEntity
void saveEntity()
Emitted when the user has opted to save a new entity to the style database, by clicking the "Save" bu...
qgsstyleitemslistwidget.h
QgsMarkerSymbol::setDataDefinedAngle
void setDataDefinedAngle(const QgsProperty &property)
Set data defined angle for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1497
QgsProperty
A store for object properties.
Definition: qgsproperty.h:231
QgsSymbolsListWidget::QgsSymbolsListWidget
QgsSymbolsListWidget(QgsSymbol *symbol, QgsStyle *style, QMenu *menu, QWidget *parent, QgsVectorLayer *layer=nullptr)
Constructor for QgsSymbolsListWidget.
Definition: qgssymbolslistwidget.cpp:27
QgsExpressionContext::EXPR_ORIGINAL_VALUE
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
Definition: qgsexpressioncontext.h:721
QgsMarkerSymbol::size
double size() const
Returns the estimated size for the whole symbol, which is the maximum size of all marker symbol layer...
Definition: qgssymbol.cpp:1597
QgsPropertyOverrideButton::changed
void changed()
Emitted when property definition changes.
qgsstylemanagerdialog.h
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
QgsMarkerSymbol::dataDefinedSize
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1731
QgsLineSymbol::width
double width() const
Returns the estimated width for the whole symbol, which is the maximum width of all marker symbol lay...
Definition: qgssymbol.cpp:1946
QgsAuxiliaryLayer::exists
bool exists(const QgsPropertyDefinition &definition) const
Returns true if the property is stored in the layer already, false otherwise.
Definition: qgsauxiliarystorage.cpp:135
QgsUnitTypes::RenderPoints
@ RenderPoints
Points (e.g., for font sizes)
Definition: qgsunittypes.h:172
QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
Definition: qgsexpressioncontext.h:733
QgsSymbolWidgetContext
Definition: qgssymbolwidgetcontext.h:35
QgsSymbolSelectorDialog::context
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
Definition: qgssymbolselectordialog.cpp:815
QgsSymbol::ScaleDiameter
@ ScaleDiameter
Calculate scale by the diameter.
Definition: qgssymbol.h:99
QgsVectorLayer::auxiliaryLayer
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
Definition: qgsvectorlayer.cpp:5269
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:168
QgsPropertyOverrideButton::createAuxiliaryField
void createAuxiliaryField()
Emitted when creating a new auxiliary field.
QgsMarkerSymbol::setDataDefinedSize
void setDataDefinedSize(const QgsProperty &property)
Set data defined size for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1694
QgsPropertyOverrideButton::propertyKey
int propertyKey() const
Returns the property key linked to the button.
Definition: qgspropertyoverridebutton.h:123
QgsSymbolsListWidget::setMarkerSize
void setMarkerSize(double size)
Definition: qgssymbolslistwidget.cpp:270
QgsSymbol::mapUnitScale
QgsMapUnitScale mapUnitScale() const
Returns the map unit scale for the symbol.
Definition: qgssymbol.cpp:259
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
Definition: qgssymbol.h:63
QgsMarkerSymbol::angle
double angle() const
Returns the marker angle for the whole symbol.
Definition: qgssymbol.cpp:1473
QgsSymbol::outputUnit
QgsUnitTypes::RenderUnit outputUnit() const
Returns the units to use for sizes and widths within the symbol.
Definition: qgssymbol.cpp:238
QgsExpressionContext::EXPR_SYMBOL_COLOR
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
Definition: qgsexpressioncontext.h:723
QgsLineSymbol::setWidth
void setWidth(double width)
Sets the width for the whole line symbol.
Definition: qgssymbol.cpp:1919
qgsstylesavedialog.h
QgsStyle::symbol
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
Definition: qgsstyle.cpp:248
QgsStyle::SymbolEntity
@ SymbolEntity
Symbols.
Definition: qgsstyle.h:180
QgsPropertyOverrideButton::setToProperty
void setToProperty(const QgsProperty &property)
Sets the widget to reflect the current state of a QgsProperty.
Definition: qgspropertyoverridebutton.cpp:286
QgsPropertyOverrideButton
Definition: qgspropertyoverridebutton.h:50
QgsSymbolWidgetContext::setMapCanvas
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:49
QgsColorButton::colorChanged
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
qgsauxiliarystorage.h
QgsSymbolsListWidget::changed
void changed()
QgsSymbol::setMapUnitScale
void setMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol.
Definition: qgssymbol.cpp:292
qgsnewauxiliarylayerdialog.h
QgsSymbolLayer::propertyDefinitions
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
Definition: qgssymbollayer.cpp:220
QgsSymbol::setOpacity
void setOpacity(qreal opacity)
Sets the opacity for the symbol.
Definition: qgssymbol.h:452
QgsSymbol::setClipFeaturesToExtent
void setClipFeaturesToExtent(bool clipFeaturesToExtent)
Sets whether features drawn by the symbol should be clipped to the render context's extent.
Definition: qgssymbol.h:475
QgsSymbol::opacity
qreal opacity() const
Returns the opacity for the symbol.
Definition: qgssymbol.h:445
QgsSymbolLayer
Definition: qgssymbollayer.h:52
QgsStyle::addSymbol
bool addSymbol(const QString &name, QgsSymbol *symbol, bool update=false)
Adds a symbol to style and takes symbol's ownership.
Definition: qgsstyle.cpp:159
QgsSymbol::setOutputUnit
void setOutputUnit(QgsUnitTypes::RenderUnit unit)
Sets the units to use for sizes and widths within the symbol.
Definition: qgssymbol.cpp:283
QgsSymbol::appendSymbolLayer
bool appendSymbolLayer(QgsSymbolLayer *layer)
Appends a symbol layer at the end of the current symbol layer list.
Definition: qgssymbol.cpp:389
QgsProperty::setField
void setField(const QString &field)
Sets the field name the property references.
Definition: qgsproperty.cpp:292
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:262
QgsPropertyOverrideButton::updateFieldLists
void updateFieldLists()
Updates list of fields.
Definition: qgspropertyoverridebutton.cpp:152
QgsMarkerSymbol
Definition: qgssymbol.h:917
QgsStyleItemsListWidget::selectionChanged
void selectionChanged(const QString &name, QgsStyle::StyleEntity type)
Emitted when the selected item is changed in the widget.
QgsSymbolLayer::PropertySize
@ PropertySize
Symbol size.
Definition: qgssymbollayer.h:132
QgsSymbolsListWidget::setMarkerAngle
void setMarkerAngle(double angle)
Definition: qgssymbolslistwidget.cpp:242
QgsSymbolsListWidget::setSymbolColor
void setSymbolColor(const QColor &color)
Definition: qgssymbolslistwidget.cpp:236
QgsMarkerSymbol::setScaleMethod
void setScaleMethod(QgsSymbol::ScaleMethod scaleMethod)
Definition: qgssymbol.cpp:1787
QgsLineSymbol
Definition: qgssymbol.h:1117
QgsPropertyOverrideButton::toProperty
QgsProperty toProperty() const
Returns a QgsProperty object encapsulating the current state of the widget.
Definition: qgspropertyoverridebutton.cpp:210
QgsPropertyDefinition
Definition for a property.
Definition: qgsproperty.h:47
qgssymbolslistwidget.h
QgsLineSymbol::dataDefinedWidth
QgsProperty dataDefinedWidth() const
Returns data defined width for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:2017
QgsSymbolsListWidget::~QgsSymbolsListWidget
~QgsSymbolsListWidget() override
Definition: qgssymbolslistwidget.cpp:87
QgsUnitSelectionWidget::changed
void changed()
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::PropertyStrokeWidth
@ PropertyStrokeWidth
Stroke width.
Definition: qgssymbollayer.h:137
QgsSymbol::setForceRHR
void setForceRHR(bool force)
Sets whether polygon features drawn by the symbol should be reoriented to follow the standard right-h...
Definition: qgssymbol.h:497
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext....
Definition: qgsexpressioncontext.h:111
QgsUnitTypes::RenderPixels
@ RenderPixels
Pixels.
Definition: qgsunittypes.h:170
QgsStyle::symbolNames
QStringList symbolNames() const
Returns a list of names of symbols.
Definition: qgsstyle.cpp:264
qgsvectorlayer.h
QgsExpressionContext::EXPR_CLUSTER_SIZE
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
Definition: qgsexpressioncontext.h:735
QgsSymbolsListWidget::updateDataDefinedMarkerSize
void updateDataDefinedMarkerSize()
Definition: qgssymbolslistwidget.cpp:279
QgsExpressionContext::EXPR_GEOMETRY_PART_COUNT
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
Definition: qgsexpressioncontext.h:727
QgsSymbol::clone
virtual QgsSymbol * clone() const =0
Returns a deep copy of this symbol.
QgsStyle::removeSymbol
bool removeSymbol(const QString &name)
Removes symbol from style (and delete it)
Definition: qgsstyle.cpp:217
QgsSymbolsListWidget::clipFeaturesToggled
void clipFeaturesToggled(bool checked)
Definition: qgssymbolslistwidget.cpp:227
QgsSymbolsListWidget::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: qgssymbolslistwidget.cpp:160
QgsLineSymbol::setDataDefinedWidth
void setDataDefinedWidth(const QgsProperty &property)
Set data defined width for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1981
QgsSymbolSelectorDialog::symbol
QgsSymbol * symbol()
Returns the symbol that is currently active in the widget.
Definition: qgssymbolselectordialog.cpp:820
QgsSymbolsListWidget::layer
const QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
Definition: qgssymbolslistwidget.h:74
QgsSymbol::clipFeaturesToExtent
bool clipFeaturesToExtent() const
Returns whether features drawn by the symbol will be clipped to the render context's extent.
Definition: qgssymbol.h:486
QgsSymbol::setColor
void setColor(const QColor &color)
Sets the color for the symbol.
Definition: qgssymbol.cpp:485
QgsStyle
Definition: qgsstyle.h:159
QgsVectorLayer
Definition: qgsvectorlayer.h:385
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
QgsMarkerSymbol::dataDefinedAngle
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
Definition: qgssymbol.cpp:1526
QgsSymbol::deleteSymbolLayer
bool deleteSymbolLayer(int index)
Removes and deletes the symbol layer at the specified index.
Definition: qgssymbol.cpp:399
QgsSymbolLayer::PropertyAngle
@ PropertyAngle
Symbol angle.
Definition: qgssymbollayer.h:133
QgsUnitTypes::RenderMetersInMapUnits
@ RenderMetersInMapUnits
Meters value as Map units.
Definition: qgsunittypes.h:175
QgsSymbol::Line
@ Line
Line symbol.
Definition: qgssymbol.h:88
QgsAuxiliaryLayer::nameFromProperty
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
Definition: qgsauxiliarystorage.cpp:366
QgsSymbol::type
SymbolType type() const
Returns the symbol's type.
Definition: qgssymbol.h:122
QgsSymbol::Marker
@ Marker
Marker symbol.
Definition: qgssymbol.h:87
QgsSymbolLayer::Property
Property
Data definable properties.
Definition: qgssymbollayer.h:130
QgsStyle::saveSymbol
bool saveSymbol(const QString &name, QgsSymbol *symbol, bool favorite, const QStringList &tags)
Adds the symbol to the database with tags.
Definition: qgsstyle.cpp:183
QgsUnitTypes::RenderUnitList
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
Definition: qgsunittypes.h:239
QgsAuxiliaryLayer::addAuxiliaryField
bool addAuxiliaryField(const QgsPropertyDefinition &definition)
Adds an auxiliary field for the given property.
Definition: qgsauxiliarystorage.cpp:140
MathUtils::angle
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
QgsSymbolsListWidget::context
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
Definition: qgssymbolslistwidget.cpp:177
QgsSymbol::forceRHR
bool forceRHR() const
Returns true if polygon features drawn by the symbol will be reoriented to follow the standard right-...
Definition: qgssymbol.h:508
QgsUnitTypes::RenderMapUnits
@ RenderMapUnits
Map units.
Definition: qgsunittypes.h:169
QgsNewAuxiliaryLayerDialog
A dialog to create a new auxiliary layer.
Definition: qgsnewauxiliarylayerdialog.h:34
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
QgsSymbolsListWidget::updateDataDefinedLineWidth
void updateDataDefinedLineWidth()
Definition: qgssymbolslistwidget.cpp:308
QgsSymbol::symbolLayerCount
int symbolLayerCount() const
Returns the total number of symbol layers contained in the symbol.
Definition: qgssymbol.h:183
QgsMarkerSymbol::setSize
void setSize(double size)
Sets the size for the whole symbol.
Definition: qgssymbol.cpp:1573
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:178
QgsSymbolsListWidget::updateDataDefinedMarkerAngle
void updateDataDefinedMarkerAngle()
Definition: qgssymbolslistwidget.cpp:251