QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgssymbollayerwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbollayerwidget.cpp - symbol layer widgets
3 
4  ---------------------
5  begin : November 2009
6  copyright : (C) 2009 by Martin Dobias
7  email : wonder dot sk at gmail dot com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #include "qgssymbollayerwidget.h"
18 
19 #include "qgslinesymbollayer.h"
20 #include "qgsmarkersymbollayer.h"
21 #include "qgsfillsymbollayer.h"
23 #include "qgssymbolslistwidget.h"
25 
26 #include "characterwidget.h"
27 #include "qgsdashspacedialog.h"
29 #include "qgssvgcache.h"
30 #include "qgssymbollayerutils.h"
31 #include "qgscolorramp.h"
32 #include "qgscolorrampbutton.h"
33 #include "qgsfontutils.h"
35 #include "qgsproperty.h"
36 #include "qgsstyle.h" //for symbol selector dialog
37 #include "qgsmapcanvas.h"
38 #include "qgsapplication.h"
39 #include "qgsvectorlayer.h"
40 #include "qgssvgselectorwidget.h"
41 #include "qgslogger.h"
42 #include "qgssettings.h"
45 #include "qgsauxiliarystorage.h"
46 #include "qgsimagecache.h"
47 
48 #include <QAbstractButton>
49 #include <QButtonGroup>
50 #include <QColorDialog>
51 #include <QCursor>
52 #include <QDir>
53 #include <QFileDialog>
54 #include <QPainter>
55 #include <QStandardItemModel>
56 #include <QSvgRenderer>
57 #include <QMessageBox>
58 #include <QMenu>
59 #include <QAction>
60 #include <QInputDialog>
61 
63 {
64  if ( auto *lExpressionContext = mContext.expressionContext() )
65  return *lExpressionContext;
66 
68 
70  if ( const QgsSymbolLayer *symbolLayer = const_cast< QgsSymbolLayerWidget * >( this )->symbolLayer() )
71  {
72  //cheat a bit - set the symbol color variable to match the symbol layer's color (when we should really be using the *symbols*
73  //color, but that's not accessible here). 99% of the time these will be the same anyway
75  }
76  expContext << symbolScope;
81  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_layer_count" ), 1, true ) );
82  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_layer_index" ), 1, true ) );
83  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_marker_row" ), 1, true ) );
84  expContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "symbol_marker_column" ), 1, true ) );
85 
86  // additional scopes
87  const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
88  for ( const QgsExpressionContextScope &scope : constAdditionalExpressionContextScopes )
89  {
90  expContext.appendScope( new QgsExpressionContextScope( scope ) );
91  }
92 
93  //TODO - show actual value
94  expContext.setOriginalValueVariable( QVariant() );
95 
96  QStringList highlights;
101  << QStringLiteral( "symbol_layer_count" ) << QStringLiteral( "symbol_layer_index" );
102 
103 
104  if ( expContext.hasVariable( QStringLiteral( "zoom_level" ) ) )
105  {
106  highlights << QStringLiteral( "zoom_level" );
107  }
108  if ( expContext.hasVariable( QStringLiteral( "vector_tile_zoom" ) ) )
109  {
110  highlights << QStringLiteral( "vector_tile_zoom" );
111  }
112 
113  expContext.setHighlightedVariables( highlights );
114 
115  return expContext;
116 }
117 
119 {
120  mContext = context;
121  const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
122  for ( QgsUnitSelectionWidget *unitWidget : unitSelectionWidgets )
123  {
124  unitWidget->setMapCanvas( mContext.mapCanvas() );
125  }
126 }
127 
129 {
130  return mContext;
131 }
132 
134 {
135  button->init( key, symbolLayer()->dataDefinedProperties(), QgsSymbolLayer::propertyDefinitions(), mVectorLayer, true );
137  connect( button, &QgsPropertyOverrideButton::createAuxiliaryField, this, &QgsSymbolLayerWidget::createAuxiliaryField );
138 
139  button->registerExpressionContextGenerator( this );
140 }
141 
142 void QgsSymbolLayerWidget::createAuxiliaryField()
143 {
144  // try to create an auxiliary layer if not yet created
145  if ( !mVectorLayer->auxiliaryLayer() )
146  {
147  QgsNewAuxiliaryLayerDialog dlg( mVectorLayer, this );
148  dlg.exec();
149  }
150 
151  // return if still not exists
152  if ( !mVectorLayer->auxiliaryLayer() )
153  return;
154 
155  QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
156  QgsSymbolLayer::Property key = static_cast< QgsSymbolLayer::Property >( button->propertyKey() );
158 
159  // create property in auxiliary storage if necessary
160  if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
161  {
162  QgsNewAuxiliaryFieldDialog dlg( def, mVectorLayer, true, this );
163  if ( dlg.exec() == QDialog::Accepted )
164  def = dlg.propertyDefinition();
165  }
166 
167  // return if still not exist
168  if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
169  return;
170 
171  // update property with join field name from auxiliary storage
172  QgsProperty property = button->toProperty();
173  property.setField( QgsAuxiliaryLayer::nameFromProperty( def, true ) );
174  property.setActive( true );
175  button->updateFieldLists();
176  button->setToProperty( property );
177  symbolLayer()->setDataDefinedProperty( key, button->toProperty() );
178 
179  emit changed();
180 }
181 
183 {
184  QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
185  QgsSymbolLayer::Property key = static_cast< QgsSymbolLayer::Property >( button->propertyKey() );
186  symbolLayer()->setDataDefinedProperty( key, button->toProperty() );
187  emit changed();
188 }
189 
191  : QgsSymbolLayerWidget( parent, vl )
192 {
193  mLayer = nullptr;
194 
195  setupUi( this );
196  connect( mCustomCheckBox, &QCheckBox::stateChanged, this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
197  connect( mChangePatternButton, &QPushButton::clicked, this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
198  connect( mPenWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed );
199  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed );
200  connect( mDashPatternUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed );
201  connect( mDrawInsideCheckBox, &QCheckBox::stateChanged, this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
202  connect( mPatternOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged );
203  connect( mCheckAlignDash, &QCheckBox::toggled, this, [ = ]
204  {
205  mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
206  if ( !mCheckAlignDash->isChecked() )
207  mCheckDashCorners->setChecked( false );
208 
209  if ( mLayer )
210  {
211  mLayer->setAlignDashPattern( mCheckAlignDash->isChecked() );
212  emit changed();
213  }
214  } );
215  connect( mCheckDashCorners, &QCheckBox::toggled, this, [ = ]
216  {
217  if ( mLayer )
218  {
219  mLayer->setTweakDashPatternOnCorners( mCheckDashCorners->isChecked() );
220  emit changed();
221  }
222  } );
223 
232 
233  btnChangeColor->setAllowOpacity( true );
234  btnChangeColor->setColorDialogTitle( tr( "Select Line Color" ) );
235  btnChangeColor->setContext( QStringLiteral( "symbology" ) );
236 
237  mColorDDBtn->registerLinkedWidget( btnChangeColor );
238 
239  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconAllRings.svg" ) ), tr( "All Rings" ), QgsLineSymbolLayer::AllRings );
240  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconExteriorRing.svg" ) ), tr( "Exterior Ring Only" ), QgsLineSymbolLayer::ExteriorRingOnly );
241  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconInteriorRings.svg" ) ), tr( "Interior Rings Only" ), QgsLineSymbolLayer::InteriorRingsOnly );
242  connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ), this, [ = ]( int )
243  {
244  if ( mLayer )
245  {
246  mLayer->setRingFilter( static_cast< QgsLineSymbolLayer::RenderRingFilter >( mRingFilterComboBox->currentData().toInt() ) );
247  emit changed();
248  }
249  } );
250 
251  spinOffset->setClearValue( 0.0 );
252  spinPatternOffset->setClearValue( 0.0 );
253 
254  if ( vl && vl->geometryType() != QgsWkbTypes::PolygonGeometry )
255  {
256  //draw inside polygon checkbox only makes sense for polygon layers
257  mDrawInsideCheckBox->hide();
258  mRingFilterComboBox->hide();
259  mRingsLabel->hide();
260  }
261 
262  //make a temporary symbol for the size assistant preview
263  mAssistantPreviewSymbol.reset( new QgsLineSymbol() );
264 
265  if ( vectorLayer() )
266  mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
267 
268  connect( spinWidth, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
269  connect( btnChangeColor, &QgsColorButton::colorChanged, this, &QgsSimpleLineSymbolLayerWidget::colorChanged );
270  connect( cboPenStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
271  connect( spinOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
272  connect( cboCapStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
273  connect( cboJoinStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
274  connect( spinPatternOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
275 
277 
278  connect( this, &QgsSymbolLayerWidget::changed, this, &QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol );
279 }
280 
281 void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
282 {
283  for ( int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
284  {
285  mAssistantPreviewSymbol->deleteSymbolLayer( i );
286  }
287  mAssistantPreviewSymbol->appendSymbolLayer( mLayer->clone() );
289  if ( ddWidth )
290  mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
291 }
292 
293 
295 {
296  if ( !layer || layer->layerType() != QLatin1String( "SimpleLine" ) )
297  return;
298 
299  // layer type is correct, we can do the cast
300  mLayer = static_cast<QgsSimpleLineSymbolLayer *>( layer );
301 
302  // set units
303  mPenWidthUnitWidget->blockSignals( true );
304  mPenWidthUnitWidget->setUnit( mLayer->widthUnit() );
305  mPenWidthUnitWidget->setMapUnitScale( mLayer->widthMapUnitScale() );
306  mPenWidthUnitWidget->blockSignals( false );
307  mOffsetUnitWidget->blockSignals( true );
308  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
309  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
310  mOffsetUnitWidget->blockSignals( false );
311  mDashPatternUnitWidget->blockSignals( true );
312  mDashPatternUnitWidget->setUnit( mLayer->customDashPatternUnit() );
313  mDashPatternUnitWidget->setMapUnitScale( mLayer->customDashPatternMapUnitScale() );
314  mDashPatternUnitWidget->blockSignals( false );
315 
316  whileBlocking( mPatternOffsetUnitWidget )->setUnit( mLayer->dashPatternOffsetUnit() );
317  whileBlocking( mPatternOffsetUnitWidget )->setMapUnitScale( mLayer->dashPatternOffsetMapUnitScale() );
318 
319  // set values
320  spinWidth->blockSignals( true );
321  spinWidth->setValue( mLayer->width() );
322  spinWidth->blockSignals( false );
323  btnChangeColor->blockSignals( true );
324  btnChangeColor->setColor( mLayer->color() );
325  btnChangeColor->blockSignals( false );
326  spinOffset->blockSignals( true );
327  spinOffset->setValue( mLayer->offset() );
328  spinOffset->blockSignals( false );
329  cboPenStyle->blockSignals( true );
330  cboJoinStyle->blockSignals( true );
331  cboCapStyle->blockSignals( true );
332  cboPenStyle->setPenStyle( mLayer->penStyle() );
333  cboJoinStyle->setPenJoinStyle( mLayer->penJoinStyle() );
334  cboCapStyle->setPenCapStyle( mLayer->penCapStyle() );
335  cboPenStyle->blockSignals( false );
336  cboJoinStyle->blockSignals( false );
337  cboCapStyle->blockSignals( false );
338  whileBlocking( spinPatternOffset )->setValue( mLayer->dashPatternOffset() );
339 
340  //use a custom dash pattern?
341  bool useCustomDashPattern = mLayer->useCustomDashPattern();
342  mChangePatternButton->setEnabled( useCustomDashPattern );
343  label_3->setEnabled( !useCustomDashPattern );
344  cboPenStyle->setEnabled( !useCustomDashPattern );
345  mCustomCheckBox->blockSignals( true );
346  mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
347  mCustomCheckBox->blockSignals( false );
348 
349  //make sure height of custom dash button looks good under different platforms
350  QSize size = mChangePatternButton->minimumSizeHint();
351  int fontHeight = static_cast< int >( Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 1.4 );
352  mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
353 
354  //draw inside polygon?
355  const bool drawInsidePolygon = mLayer->drawInsidePolygon();
356  whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
357 
358  whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
359 
360  whileBlocking( mCheckAlignDash )->setChecked( mLayer->alignDashPattern() );
361  mCheckDashCorners->setEnabled( mLayer->alignDashPattern() );
362  whileBlocking( mCheckDashCorners )->setChecked( mLayer->tweakDashPatternOnCorners() && mLayer->alignDashPattern() );
363 
365 
374 
375  updateAssistantSymbol();
376 }
377 
379 {
380  return mLayer;
381 }
382 
383 void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
384 {
385  mLayer->setWidth( spinWidth->value() );
387  emit changed();
388 }
389 
390 void QgsSimpleLineSymbolLayerWidget::colorChanged( const QColor &color )
391 {
392  mLayer->setColor( color );
393  emit changed();
394 }
395 
396 void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
397 {
398  mLayer->setPenStyle( cboPenStyle->penStyle() );
399  mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
400  mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
402  emit changed();
403 }
404 
405 void QgsSimpleLineSymbolLayerWidget::offsetChanged()
406 {
407  mLayer->setOffset( spinOffset->value() );
409  emit changed();
410 }
411 
412 void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
413 {
414  mLayer->setDashPatternOffset( spinPatternOffset->value() );
416  emit changed();
417 }
418 
419 void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged( int state )
420 {
421  bool checked = ( state == Qt::Checked );
422  mChangePatternButton->setEnabled( checked );
423  label_3->setEnabled( !checked );
424  cboPenStyle->setEnabled( !checked );
425 
426  mLayer->setUseCustomDashPattern( checked );
427  emit changed();
428 }
429 
430 void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
431 {
433  if ( panel && panel->dockMode() )
434  {
436  widget->setPanelTitle( tr( "Custom Dash Pattern" ) );
437  widget->setUnit( mDashPatternUnitWidget->unit() );
438  connect( widget, &QgsPanelWidget::widgetChanged, this, [ this, widget ]()
439  {
442  } );
444  panel->openPanel( widget );
445  return;
446  }
447 
449  d.setUnit( mDashPatternUnitWidget->unit() );
450  if ( d.exec() == QDialog::Accepted )
451  {
452  mLayer->setCustomDashVector( d.dashDotVector() );
454  emit changed();
455  }
456 }
457 
458 void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
459 {
460  if ( mLayer )
461  {
462  mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
463  mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
465  emit changed();
466  }
467 }
468 
469 void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
470 {
471  if ( mLayer )
472  {
473  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
474  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
475  emit changed();
476  }
477 }
478 
479 void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
480 {
481  if ( mLayer )
482  {
483  mLayer->setCustomDashPatternUnit( mDashPatternUnitWidget->unit() );
484  mLayer->setCustomDashPatternMapUnitScale( mDashPatternUnitWidget->getMapUnitScale() );
486  emit changed();
487  }
488 }
489 
490 void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged( int state )
491 {
492  bool checked = ( state == Qt::Checked );
493  mLayer->setDrawInsidePolygon( checked );
494  emit changed();
495 }
496 
497 void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
498 {
499  if ( mLayer )
500  {
501  mLayer->setDashPatternOffsetUnit( mPatternOffsetUnitWidget->unit() );
502  mLayer->setDashPatternOffsetMapUnitScale( mPatternOffsetUnitWidget->getMapUnitScale() );
504  emit changed();
505  }
506 }
507 
509 {
510  if ( !mLayer )
511  {
512  return;
513  }
514  std::unique_ptr< QgsSimpleLineSymbolLayer > layerCopy( mLayer->clone() );
515  if ( !layerCopy )
516  {
517  return;
518  }
519  QColor color = qApp->palette().color( QPalette::WindowText );
520  layerCopy->setColor( color );
521  // reset offset, we don't want to show that in the preview
522  layerCopy->setOffset( 0 );
523  layerCopy->setUseCustomDashPattern( true );
524 
525  QSize currentIconSize;
526  //icon size is button size with a small margin
527 #ifdef Q_OS_WIN
528  currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
529 #else
530  currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
531 #endif
532 
533  if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
534  {
535  return;
536  }
537 
538  //create an icon pixmap
539  std::unique_ptr< QgsLineSymbol > previewSymbol = qgis::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << layerCopy.release() );
540  const QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( previewSymbol.get(), currentIconSize );
541  mChangePatternButton->setIconSize( currentIconSize );
542  mChangePatternButton->setIcon( icon );
543 
544  // set tooltip
545  // create very large preview image
546 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
547  int width = static_cast< int >( Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 23 );
548 #else
549  int width = static_cast< int >( Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 23 );
550 #endif
551  int height = static_cast< int >( width / 1.61803398875 ); // golden ratio
552 
553  QPixmap pm = QgsSymbolLayerUtils::symbolPreviewPixmap( previewSymbol.get(), QSize( width, height ), height / 20 );
554  QByteArray data;
555  QBuffer buffer( &data );
556  pm.save( &buffer, "PNG", 100 );
557  mChangePatternButton->setToolTip( QStringLiteral( "<img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) ) );
558 }
559 
561 {
562  QgsSymbolLayerWidget::resizeEvent( event );
563  // redraw custom dash pattern icon -- the button size has changed
565 }
566 
567 
569 
570 
572  : QgsSymbolLayerWidget( parent, vl )
573 {
574  mLayer = nullptr;
575 
576  setupUi( this );
577  connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
578  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
579  connect( mStrokeWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed );
580  connect( mStrokeStyleComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
581  connect( mStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
582  connect( mHorizontalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
583  connect( mVerticalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
590 
591  btnChangeColorFill->setAllowOpacity( true );
592  btnChangeColorFill->setColorDialogTitle( tr( "Select Fill Color" ) );
593  btnChangeColorFill->setContext( QStringLiteral( "symbology" ) );
594  btnChangeColorFill->setShowNoColor( true );
595  btnChangeColorFill->setNoColorString( tr( "Transparent Fill" ) );
596  btnChangeColorStroke->setAllowOpacity( true );
597  btnChangeColorStroke->setColorDialogTitle( tr( "Select Stroke Color" ) );
598  btnChangeColorStroke->setContext( QStringLiteral( "symbology" ) );
599  btnChangeColorStroke->setShowNoColor( true );
600  btnChangeColorStroke->setNoColorString( tr( "Transparent Stroke" ) );
601 
602  mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
603  mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
604 
605  spinOffsetX->setClearValue( 0.0 );
606  spinOffsetY->setClearValue( 0.0 );
607  spinAngle->setClearValue( 0.0 );
608 
609  //make a temporary symbol for the size assistant preview
610  mAssistantPreviewSymbol.reset( new QgsMarkerSymbol() );
611 
612  if ( vectorLayer() )
613  mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
614 
615  int size = lstNames->iconSize().width();
616 
617 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
618  size = std::max( 30, static_cast< int >( std::round( Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 3 ) ) );
619 #else
620  size = std::max( 30, static_cast< int >( std::round( Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 3 ) ) );
621 #endif
622 
623  lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
624  lstNames->setIconSize( QSize( size, size ) );
625 
626  double markerSize = size * 0.8;
628  for ( QgsSimpleMarkerSymbolLayerBase::Shape shape : shapes )
629  {
630  QgsSimpleMarkerSymbolLayer *lyr = new QgsSimpleMarkerSymbolLayer( shape, markerSize );
632  lyr->setColor( QColor( 200, 200, 200 ) );
633  lyr->setStrokeColor( QColor( 0, 0, 0 ) );
634  QIcon icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon( lyr, QgsUnitTypes::RenderPixels, QSize( size, size ) );
635  QListWidgetItem *item = new QListWidgetItem( icon, QString(), lstNames );
636  item->setData( Qt::UserRole, static_cast< int >( shape ) );
637  item->setToolTip( QgsSimpleMarkerSymbolLayerBase::encodeShape( shape ) );
638  delete lyr;
639  }
640  // show at least 3 rows
641  lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
642 
643  connect( lstNames, &QListWidget::currentRowChanged, this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
644  connect( btnChangeColorStroke, &QgsColorButton::colorChanged, this, &QgsSimpleMarkerSymbolLayerWidget::setColorStroke );
646  connect( cboJoinStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
647  connect( spinSize, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
648  connect( spinAngle, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
649  connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
650  connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
651  connect( this, &QgsSymbolLayerWidget::changed, this, &QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol );
652 }
653 
655 {
656  if ( layer->layerType() != QLatin1String( "SimpleMarker" ) )
657  return;
658 
659  // layer type is correct, we can do the cast
660  mLayer = static_cast<QgsSimpleMarkerSymbolLayer *>( layer );
661 
662  // set values
664  for ( int i = 0; i < lstNames->count(); ++i )
665  {
666  if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
667  {
668  lstNames->setCurrentRow( i );
669  break;
670  }
671  }
672  btnChangeColorStroke->blockSignals( true );
673  btnChangeColorStroke->setColor( mLayer->strokeColor() );
674  btnChangeColorStroke->blockSignals( false );
675  btnChangeColorFill->blockSignals( true );
676  btnChangeColorFill->setColor( mLayer->fillColor() );
677  btnChangeColorFill->setEnabled( QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( mLayer->shape() ) );
678  btnChangeColorFill->blockSignals( false );
679  spinSize->blockSignals( true );
680  spinSize->setValue( mLayer->size() );
681  spinSize->blockSignals( false );
682  spinAngle->blockSignals( true );
683  spinAngle->setValue( mLayer->angle() );
684  spinAngle->blockSignals( false );
685  mStrokeStyleComboBox->blockSignals( true );
686  mStrokeStyleComboBox->setPenStyle( mLayer->strokeStyle() );
687  mStrokeStyleComboBox->blockSignals( false );
688  mStrokeWidthSpinBox->blockSignals( true );
689  mStrokeWidthSpinBox->setValue( mLayer->strokeWidth() );
690  mStrokeWidthSpinBox->blockSignals( false );
691  cboJoinStyle->blockSignals( true );
692  cboJoinStyle->setPenJoinStyle( mLayer->penJoinStyle() );
693  cboJoinStyle->blockSignals( false );
694 
695  // without blocking signals the value gets changed because of slot setOffset()
696  spinOffsetX->blockSignals( true );
697  spinOffsetX->setValue( mLayer->offset().x() );
698  spinOffsetX->blockSignals( false );
699  spinOffsetY->blockSignals( true );
700  spinOffsetY->setValue( mLayer->offset().y() );
701  spinOffsetY->blockSignals( false );
702 
703  mSizeUnitWidget->blockSignals( true );
704  mSizeUnitWidget->setUnit( mLayer->sizeUnit() );
705  mSizeUnitWidget->setMapUnitScale( mLayer->sizeMapUnitScale() );
706  mSizeUnitWidget->blockSignals( false );
707  mOffsetUnitWidget->blockSignals( true );
708  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
709  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
710  mOffsetUnitWidget->blockSignals( false );
711  mStrokeWidthUnitWidget->blockSignals( true );
712  mStrokeWidthUnitWidget->setUnit( mLayer->strokeWidthUnit() );
713  mStrokeWidthUnitWidget->setMapUnitScale( mLayer->strokeWidthMapUnitScale() );
714  mStrokeWidthUnitWidget->blockSignals( false );
715 
716  //anchor points
717  mHorizontalAnchorComboBox->blockSignals( true );
718  mVerticalAnchorComboBox->blockSignals( true );
719  mHorizontalAnchorComboBox->setCurrentIndex( mLayer->horizontalAnchorPoint() );
720  mVerticalAnchorComboBox->setCurrentIndex( mLayer->verticalAnchorPoint() );
721  mHorizontalAnchorComboBox->blockSignals( false );
722  mVerticalAnchorComboBox->blockSignals( false );
723 
735 
736  updateAssistantSymbol();
737 }
738 
740 {
741  return mLayer;
742 }
743 
744 void QgsSimpleMarkerSymbolLayerWidget::setShape()
745 {
746  mLayer->setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
747  btnChangeColorFill->setEnabled( QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( mLayer->shape() ) );
748  emit changed();
749 }
750 
752 {
753  mLayer->setStrokeColor( color );
754  emit changed();
755 }
756 
758 {
759  mLayer->setColor( color );
760  emit changed();
761 }
762 
763 void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
764 {
765  mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
766  emit changed();
767 }
768 
769 void QgsSimpleMarkerSymbolLayerWidget::setSize()
770 {
771  mLayer->setSize( spinSize->value() );
772  emit changed();
773 }
774 
775 void QgsSimpleMarkerSymbolLayerWidget::setAngle()
776 {
777  mLayer->setAngle( spinAngle->value() );
778  emit changed();
779 }
780 
781 void QgsSimpleMarkerSymbolLayerWidget::setOffset()
782 {
783  mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
784  emit changed();
785 }
786 
787 void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged( int index )
788 {
789  Q_UNUSED( index )
790 
791  if ( mLayer )
792  {
793  mLayer->setStrokeStyle( mStrokeStyleComboBox->penStyle() );
794  emit changed();
795  }
796 }
797 
798 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged( double d )
799 {
800  if ( mLayer )
801  {
802  mLayer->setStrokeWidth( d );
803  emit changed();
804  }
805 }
806 
807 void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
808 {
809  if ( mLayer )
810  {
811  mLayer->setSizeUnit( mSizeUnitWidget->unit() );
812  mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
813  emit changed();
814  }
815 }
816 
817 void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
818 {
819  if ( mLayer )
820  {
821  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
822  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
823  emit changed();
824  }
825 }
826 
827 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
828 {
829  if ( mLayer )
830  {
831  mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
832  mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
833  emit changed();
834  }
835 }
836 
837 void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
838 {
839  if ( mLayer )
840  {
842  emit changed();
843  }
844 }
845 
846 void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
847 {
848  if ( mLayer )
849  {
851  emit changed();
852  }
853 }
854 
855 void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
856 {
857  for ( int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
858  {
859  mAssistantPreviewSymbol->deleteSymbolLayer( i );
860  }
861  mAssistantPreviewSymbol->appendSymbolLayer( mLayer->clone() );
863  if ( ddSize )
864  mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
865 }
866 
867 
869 
871  : QgsSymbolLayerWidget( parent, vl )
872 {
873  mLayer = nullptr;
874 
875  setupUi( this );
876  connect( mStrokeWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed );
877  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed );
882 
883  btnChangeColor->setAllowOpacity( true );
884  btnChangeColor->setColorDialogTitle( tr( "Select Fill Color" ) );
885  btnChangeColor->setContext( QStringLiteral( "symbology" ) );
886  btnChangeColor->setShowNoColor( true );
887  btnChangeColor->setNoColorString( tr( "Transparent Fill" ) );
888  btnChangeStrokeColor->setAllowOpacity( true );
889  btnChangeStrokeColor->setColorDialogTitle( tr( "Select Stroke Color" ) );
890  btnChangeStrokeColor->setContext( QStringLiteral( "symbology" ) );
891  btnChangeStrokeColor->setShowNoColor( true );
892  btnChangeStrokeColor->setNoColorString( tr( "Transparent Stroke" ) );
893 
894  spinOffsetX->setClearValue( 0.0 );
895  spinOffsetY->setClearValue( 0.0 );
896 
898  connect( cboFillStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
899  connect( btnChangeStrokeColor, &QgsColorButton::colorChanged, this, &QgsSimpleFillSymbolLayerWidget::setStrokeColor );
900  connect( spinStrokeWidth, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
901  connect( cboStrokeStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
902  connect( cboJoinStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
903  connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
904  connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
905 
906  mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
907  mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
908 }
909 
911 {
912  if ( layer->layerType() != QLatin1String( "SimpleFill" ) )
913  return;
914 
915  // layer type is correct, we can do the cast
916  mLayer = static_cast<QgsSimpleFillSymbolLayer *>( layer );
917 
918  // set values
919  btnChangeColor->blockSignals( true );
920  btnChangeColor->setColor( mLayer->color() );
921  btnChangeColor->blockSignals( false );
922  cboFillStyle->blockSignals( true );
923  cboFillStyle->setBrushStyle( mLayer->brushStyle() );
924  cboFillStyle->blockSignals( false );
925  btnChangeStrokeColor->blockSignals( true );
926  btnChangeStrokeColor->setColor( mLayer->strokeColor() );
927  btnChangeStrokeColor->blockSignals( false );
928  cboStrokeStyle->blockSignals( true );
929  cboStrokeStyle->setPenStyle( mLayer->strokeStyle() );
930  cboStrokeStyle->blockSignals( false );
931  spinStrokeWidth->blockSignals( true );
932  spinStrokeWidth->setValue( mLayer->strokeWidth() );
933  spinStrokeWidth->blockSignals( false );
934  cboJoinStyle->blockSignals( true );
935  cboJoinStyle->setPenJoinStyle( mLayer->penJoinStyle() );
936  cboJoinStyle->blockSignals( false );
937  spinOffsetX->blockSignals( true );
938  spinOffsetX->setValue( mLayer->offset().x() );
939  spinOffsetX->blockSignals( false );
940  spinOffsetY->blockSignals( true );
941  spinOffsetY->setValue( mLayer->offset().y() );
942  spinOffsetY->blockSignals( false );
943 
944  mStrokeWidthUnitWidget->blockSignals( true );
945  mStrokeWidthUnitWidget->setUnit( mLayer->strokeWidthUnit() );
946  mStrokeWidthUnitWidget->setMapUnitScale( mLayer->strokeWidthMapUnitScale() );
947  mStrokeWidthUnitWidget->blockSignals( false );
948  mOffsetUnitWidget->blockSignals( true );
949  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
950  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
951  mOffsetUnitWidget->blockSignals( false );
952 
960 }
961 
963 {
964  return mLayer;
965 }
966 
967 void QgsSimpleFillSymbolLayerWidget::setColor( const QColor &color )
968 {
969  mLayer->setColor( color );
970  emit changed();
971 }
972 
974 {
975  mLayer->setStrokeColor( color );
976  emit changed();
977 }
978 
979 void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
980 {
981  mLayer->setBrushStyle( cboFillStyle->brushStyle() );
982  emit changed();
983 }
984 
985 void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
986 {
987  mLayer->setStrokeWidth( spinStrokeWidth->value() );
988  emit changed();
989 }
990 
991 void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
992 {
993  mLayer->setStrokeStyle( cboStrokeStyle->penStyle() );
994  mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
995  emit changed();
996 }
997 
998 void QgsSimpleFillSymbolLayerWidget::offsetChanged()
999 {
1000  mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1001  emit changed();
1002 }
1003 
1004 void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1005 {
1006  if ( mLayer )
1007  {
1008  mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
1009  mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
1010  emit changed();
1011  }
1012 }
1013 
1014 void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1015 {
1016  if ( mLayer )
1017  {
1018  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1019  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1020  emit changed();
1021  }
1022 }
1023 
1025 
1027  : QgsSymbolLayerWidget( parent, vl )
1028 {
1029  mLayer = nullptr;
1030 
1031  setupUi( this );
1032  connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
1033  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
1034  connect( mHorizontalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1035  connect( mVerticalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1040 
1041  spinOffsetX->setClearValue( 0.0 );
1042  spinOffsetY->setClearValue( 0.0 );
1043  spinAngle->setClearValue( 0.0 );
1044 
1045  //make a temporary symbol for the size assistant preview
1046  mAssistantPreviewSymbol.reset( new QgsMarkerSymbol() );
1047 
1048  if ( vectorLayer() )
1049  mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1050 
1051  int size = lstNames->iconSize().width();
1052 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
1053  size = std::max( 30, static_cast< int >( std::round( Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 3 ) ) );
1054 #else
1055  size = std::max( 30, static_cast< int >( std::round( Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 3 ) ) );
1056 #endif
1057  lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1058  lstNames->setIconSize( QSize( size, size ) );
1059 
1060  double markerSize = size * 0.8;
1062  for ( QgsSimpleMarkerSymbolLayerBase::Shape shape : shapes )
1063  {
1064  QgsSimpleMarkerSymbolLayer *lyr = new QgsSimpleMarkerSymbolLayer( shape, markerSize );
1066  lyr->setColor( QColor( 200, 200, 200 ) );
1067  lyr->setStrokeColor( QColor( 0, 0, 0 ) );
1068  QIcon icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon( lyr, QgsUnitTypes::RenderPixels, QSize( size, size ) );
1069  QListWidgetItem *item = new QListWidgetItem( icon, QString(), lstNames );
1070  item->setData( Qt::UserRole, static_cast< int >( shape ) );
1071  item->setToolTip( QgsSimpleMarkerSymbolLayerBase::encodeShape( shape ) );
1072  delete lyr;
1073  }
1074  // show at least 3 rows
1075  lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1076 
1077  connect( lstNames, &QListWidget::currentRowChanged, this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1078  connect( spinSize, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1079  connect( spinAngle, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1080  connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1081  connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1082  connect( this, &QgsSymbolLayerWidget::changed, this, &QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol );
1083 }
1084 
1086 {
1087  if ( layer->layerType() != QLatin1String( "FilledMarker" ) )
1088  return;
1089 
1090  // layer type is correct, we can do the cast
1091  mLayer = static_cast<QgsFilledMarkerSymbolLayer *>( layer );
1092 
1093  // set values
1095  for ( int i = 0; i < lstNames->count(); ++i )
1096  {
1097  if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1098  {
1099  lstNames->setCurrentRow( i );
1100  break;
1101  }
1102  }
1103  whileBlocking( spinSize )->setValue( mLayer->size() );
1104  whileBlocking( spinAngle )->setValue( mLayer->angle() );
1105  whileBlocking( spinOffsetX )->setValue( mLayer->offset().x() );
1106  whileBlocking( spinOffsetY )->setValue( mLayer->offset().y() );
1107 
1108  mSizeUnitWidget->blockSignals( true );
1109  mSizeUnitWidget->setUnit( mLayer->sizeUnit() );
1110  mSizeUnitWidget->setMapUnitScale( mLayer->sizeMapUnitScale() );
1111  mSizeUnitWidget->blockSignals( false );
1112  mOffsetUnitWidget->blockSignals( true );
1113  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
1114  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
1115  mOffsetUnitWidget->blockSignals( false );
1116 
1117  //anchor points
1118  whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mLayer->horizontalAnchorPoint() );
1119  whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mLayer->verticalAnchorPoint() );
1120 
1127 
1128  updateAssistantSymbol();
1129 }
1130 
1132 {
1133  return mLayer;
1134 }
1135 
1136 void QgsFilledMarkerSymbolLayerWidget::setShape()
1137 {
1138  mLayer->setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
1139  emit changed();
1140 }
1141 
1142 void QgsFilledMarkerSymbolLayerWidget::setSize()
1143 {
1144  mLayer->setSize( spinSize->value() );
1145  emit changed();
1146 }
1147 
1148 void QgsFilledMarkerSymbolLayerWidget::setAngle()
1149 {
1150  mLayer->setAngle( spinAngle->value() );
1151  emit changed();
1152 }
1153 
1154 void QgsFilledMarkerSymbolLayerWidget::setOffset()
1155 {
1156  mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1157  emit changed();
1158 }
1159 
1160 void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1161 {
1162  if ( mLayer )
1163  {
1164  mLayer->setSizeUnit( mSizeUnitWidget->unit() );
1165  mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
1166  emit changed();
1167  }
1168 }
1169 
1170 void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1171 {
1172  if ( mLayer )
1173  {
1174  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1175  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1176  emit changed();
1177  }
1178 }
1179 
1180 void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
1181 {
1182  if ( mLayer )
1183  {
1185  emit changed();
1186  }
1187 }
1188 
1189 void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
1190 {
1191  if ( mLayer )
1192  {
1194  emit changed();
1195  }
1196 }
1197 
1198 void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1199 {
1200  for ( int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1201  {
1202  mAssistantPreviewSymbol->deleteSymbolLayer( i );
1203  }
1204  mAssistantPreviewSymbol->appendSymbolLayer( mLayer->clone() );
1206  if ( ddSize )
1207  mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1208 }
1209 
1210 
1212 
1214  : QgsSymbolLayerWidget( parent, vl )
1215 {
1216  mLayer = nullptr;
1217 
1218  setupUi( this );
1219  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed );
1220  connect( mSpinAngle, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1223 
1224  btnColorRamp->setShowGradientOnly( true );
1225 
1226  btnChangeColor->setAllowOpacity( true );
1227  btnChangeColor->setColorDialogTitle( tr( "Select Gradient Color" ) );
1228  btnChangeColor->setContext( QStringLiteral( "symbology" ) );
1229  btnChangeColor->setShowNoColor( true );
1230  btnChangeColor->setNoColorString( tr( "Transparent" ) );
1231  btnChangeColor2->setAllowOpacity( true );
1232  btnChangeColor2->setColorDialogTitle( tr( "Select Gradient Color" ) );
1233  btnChangeColor2->setContext( QStringLiteral( "symbology" ) );
1234  btnChangeColor2->setShowNoColor( true );
1235  btnChangeColor2->setNoColorString( tr( "Transparent" ) );
1236 
1237  mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1238  mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1239 
1240  spinOffsetX->setClearValue( 0.0 );
1241  spinOffsetY->setClearValue( 0.0 );
1242  mSpinAngle->setClearValue( 0.0 );
1243 
1247  connect( cboGradientType, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGradientFillSymbolLayerWidget::setGradientType );
1248  connect( cboCoordinateMode, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGradientFillSymbolLayerWidget::setCoordinateMode );
1249  connect( cboGradientSpread, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGradientFillSymbolLayerWidget::setGradientSpread );
1250  connect( radioTwoColor, &QAbstractButton::toggled, this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1251  connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1252  connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1253  connect( spinRefPoint1X, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1254  connect( spinRefPoint1Y, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1255  connect( checkRefPoint1Centroid, &QAbstractButton::toggled, this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1256  connect( spinRefPoint2X, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1257  connect( spinRefPoint2Y, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1258  connect( checkRefPoint2Centroid, &QAbstractButton::toggled, this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1259 }
1260 
1262 {
1263  if ( layer->layerType() != QLatin1String( "GradientFill" ) )
1264  return;
1265 
1266  // layer type is correct, we can do the cast
1267  mLayer = static_cast<QgsGradientFillSymbolLayer *>( layer );
1268 
1269  // set values
1270  btnChangeColor->blockSignals( true );
1271  btnChangeColor->setColor( mLayer->color() );
1272  btnChangeColor->blockSignals( false );
1273  btnChangeColor2->blockSignals( true );
1274  btnChangeColor2->setColor( mLayer->color2() );
1275  btnChangeColor2->blockSignals( false );
1276 
1278  {
1279  radioTwoColor->setChecked( true );
1280  btnColorRamp->setEnabled( false );
1281  }
1282  else
1283  {
1284  radioColorRamp->setChecked( true );
1285  btnChangeColor->setEnabled( false );
1286  btnChangeColor2->setEnabled( false );
1287  }
1288 
1289  // set source color ramp
1290  if ( mLayer->colorRamp() )
1291  {
1292  btnColorRamp->blockSignals( true );
1293  btnColorRamp->setColorRamp( mLayer->colorRamp() );
1294  btnColorRamp->blockSignals( false );
1295  }
1296 
1297  cboGradientType->blockSignals( true );
1298  switch ( mLayer->gradientType() )
1299  {
1301  cboGradientType->setCurrentIndex( 0 );
1302  break;
1304  cboGradientType->setCurrentIndex( 1 );
1305  break;
1307  cboGradientType->setCurrentIndex( 2 );
1308  break;
1309  }
1310  cboGradientType->blockSignals( false );
1311 
1312  cboCoordinateMode->blockSignals( true );
1313  switch ( mLayer->coordinateMode() )
1314  {
1316  cboCoordinateMode->setCurrentIndex( 1 );
1317  checkRefPoint1Centroid->setEnabled( false );
1318  checkRefPoint2Centroid->setEnabled( false );
1319  break;
1321  default:
1322  cboCoordinateMode->setCurrentIndex( 0 );
1323  break;
1324  }
1325  cboCoordinateMode->blockSignals( false );
1326 
1327  cboGradientSpread->blockSignals( true );
1328  switch ( mLayer->gradientSpread() )
1329  {
1331  cboGradientSpread->setCurrentIndex( 0 );
1332  break;
1334  cboGradientSpread->setCurrentIndex( 1 );
1335  break;
1337  cboGradientSpread->setCurrentIndex( 2 );
1338  break;
1339  }
1340  cboGradientSpread->blockSignals( false );
1341 
1342  spinRefPoint1X->blockSignals( true );
1343  spinRefPoint1X->setValue( mLayer->referencePoint1().x() );
1344  spinRefPoint1X->blockSignals( false );
1345  spinRefPoint1Y->blockSignals( true );
1346  spinRefPoint1Y->setValue( mLayer->referencePoint1().y() );
1347  spinRefPoint1Y->blockSignals( false );
1348  checkRefPoint1Centroid->blockSignals( true );
1349  checkRefPoint1Centroid->setChecked( mLayer->referencePoint1IsCentroid() );
1351  {
1352  spinRefPoint1X->setEnabled( false );
1353  spinRefPoint1Y->setEnabled( false );
1354  }
1355  checkRefPoint1Centroid->blockSignals( false );
1356  spinRefPoint2X->blockSignals( true );
1357  spinRefPoint2X->setValue( mLayer->referencePoint2().x() );
1358  spinRefPoint2X->blockSignals( false );
1359  spinRefPoint2Y->blockSignals( true );
1360  spinRefPoint2Y->setValue( mLayer->referencePoint2().y() );
1361  spinRefPoint2Y->blockSignals( false );
1362  checkRefPoint2Centroid->blockSignals( true );
1363  checkRefPoint2Centroid->setChecked( mLayer->referencePoint2IsCentroid() );
1365  {
1366  spinRefPoint2X->setEnabled( false );
1367  spinRefPoint2Y->setEnabled( false );
1368  }
1369  checkRefPoint2Centroid->blockSignals( false );
1370 
1371  spinOffsetX->blockSignals( true );
1372  spinOffsetX->setValue( mLayer->offset().x() );
1373  spinOffsetX->blockSignals( false );
1374  spinOffsetY->blockSignals( true );
1375  spinOffsetY->setValue( mLayer->offset().y() );
1376  spinOffsetY->blockSignals( false );
1377  mSpinAngle->blockSignals( true );
1378  mSpinAngle->setValue( mLayer->angle() );
1379  mSpinAngle->blockSignals( false );
1380 
1381  mOffsetUnitWidget->blockSignals( true );
1382  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
1383  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
1384  mOffsetUnitWidget->blockSignals( false );
1385 
1399 }
1400 
1402 {
1403  return mLayer;
1404 }
1405 
1407 {
1408  mLayer->setColor( color );
1409  emit changed();
1410 }
1411 
1413 {
1414  mLayer->setColor2( color );
1415  emit changed();
1416 }
1417 
1418 void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1419 {
1420  if ( radioTwoColor->isChecked() )
1421  {
1423  }
1424  else
1425  {
1427  }
1428  emit changed();
1429 }
1430 
1432 {
1433  if ( btnColorRamp->isNull() )
1434  return;
1435 
1436  mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
1437  emit changed();
1438 }
1439 
1441 {
1442  switch ( index )
1443  {
1444  case 0:
1446  //set sensible default reference points
1447  spinRefPoint1X->setValue( 0.5 );
1448  spinRefPoint1Y->setValue( 0 );
1449  spinRefPoint2X->setValue( 0.5 );
1450  spinRefPoint2Y->setValue( 1 );
1451  break;
1452  case 1:
1454  //set sensible default reference points
1455  spinRefPoint1X->setValue( 0 );
1456  spinRefPoint1Y->setValue( 0 );
1457  spinRefPoint2X->setValue( 1 );
1458  spinRefPoint2Y->setValue( 1 );
1459  break;
1460  case 2:
1462  spinRefPoint1X->setValue( 0.5 );
1463  spinRefPoint1Y->setValue( 0.5 );
1464  spinRefPoint2X->setValue( 1 );
1465  spinRefPoint2Y->setValue( 1 );
1466  break;
1467  }
1468  emit changed();
1469 }
1470 
1472 {
1473 
1474  switch ( index )
1475  {
1476  case 0:
1477  //feature coordinate mode
1479  //allow choice of centroid reference positions
1480  checkRefPoint1Centroid->setEnabled( true );
1481  checkRefPoint2Centroid->setEnabled( true );
1482  break;
1483  case 1:
1484  //viewport coordinate mode
1486  //disable choice of centroid reference positions
1487  checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1488  checkRefPoint1Centroid->setEnabled( false );
1489  checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1490  checkRefPoint2Centroid->setEnabled( false );
1491  break;
1492  }
1493 
1494  emit changed();
1495 }
1496 
1498 {
1499  switch ( index )
1500  {
1501  case 0:
1503  break;
1504  case 1:
1506  break;
1507  case 2:
1509  break;
1510  }
1511 
1512  emit changed();
1513 }
1514 
1515 void QgsGradientFillSymbolLayerWidget::offsetChanged()
1516 {
1517  mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1518  emit changed();
1519 }
1520 
1521 void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1522 {
1523  mLayer->setReferencePoint1( QPointF( spinRefPoint1X->value(), spinRefPoint1Y->value() ) );
1524  mLayer->setReferencePoint1IsCentroid( checkRefPoint1Centroid->isChecked() );
1525  mLayer->setReferencePoint2( QPointF( spinRefPoint2X->value(), spinRefPoint2Y->value() ) );
1526  mLayer->setReferencePoint2IsCentroid( checkRefPoint2Centroid->isChecked() );
1527  emit changed();
1528 }
1529 
1530 void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged( double value )
1531 {
1532  mLayer->setAngle( value );
1533  emit changed();
1534 }
1535 
1536 void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1537 {
1538  if ( mLayer )
1539  {
1540  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1541  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1542  emit changed();
1543  }
1544 }
1545 
1547 
1549  : QgsSymbolLayerWidget( parent, vl )
1550 {
1551  mLayer = nullptr;
1552 
1553  setupUi( this );
1554  connect( mSpinBlurRadius, qgis::overload< int >::of( &QSpinBox::valueChanged ), this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1555  connect( mSpinMaxDistance, qgis::overload< double >::of( &QDoubleSpinBox::valueChanged ), this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1556  connect( mDistanceUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed );
1557  connect( mRadioUseWholeShape, &QRadioButton::toggled, this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1558  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed );
1559  connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged, this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1564 
1565  QButtonGroup *group1 = new QButtonGroup( this );
1566  group1->addButton( radioColorRamp );
1567  group1->addButton( radioTwoColor );
1568  QButtonGroup *group2 = new QButtonGroup( this );
1569  group2->addButton( mRadioUseMaxDistance );
1570  group2->addButton( mRadioUseWholeShape );
1571  btnChangeColor->setAllowOpacity( true );
1572  btnChangeColor->setColorDialogTitle( tr( "Select Gradient Color" ) );
1573  btnChangeColor->setContext( QStringLiteral( "symbology" ) );
1574  btnChangeColor->setShowNoColor( true );
1575  btnChangeColor->setNoColorString( tr( "Transparent" ) );
1576  btnChangeColor2->setAllowOpacity( true );
1577  btnChangeColor2->setColorDialogTitle( tr( "Select Gradient Color" ) );
1578  btnChangeColor2->setContext( QStringLiteral( "symbology" ) );
1579  btnChangeColor2->setShowNoColor( true );
1580  btnChangeColor2->setNoColorString( tr( "Transparent" ) );
1581 
1582  mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1583  mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1584 
1585  spinOffsetX->setClearValue( 0.0 );
1586  spinOffsetY->setClearValue( 0.0 );
1587  mSpinMaxDistance->setClearValue( 5.0 );
1588 
1589  btnColorRamp->setShowGradientOnly( true );
1590 
1591  connect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsShapeburstFillSymbolLayerWidget::applyColorRamp );
1592 
1595  connect( radioTwoColor, &QAbstractButton::toggled, this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1596  connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1597  connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1598 
1599  connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1600  connect( mSpinBlurRadius, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1601 }
1602 
1604 {
1605  if ( layer->layerType() != QLatin1String( "ShapeburstFill" ) )
1606  return;
1607 
1608  // layer type is correct, we can do the cast
1609  mLayer = static_cast<QgsShapeburstFillSymbolLayer *>( layer );
1610 
1611  // set values
1612  btnChangeColor->blockSignals( true );
1613  btnChangeColor->setColor( mLayer->color() );
1614  btnChangeColor->blockSignals( false );
1615  btnChangeColor2->blockSignals( true );
1616  btnChangeColor2->setColor( mLayer->color2() );
1617  btnChangeColor2->blockSignals( false );
1618 
1620  {
1621  radioTwoColor->setChecked( true );
1622  btnColorRamp->setEnabled( false );
1623  }
1624  else
1625  {
1626  radioColorRamp->setChecked( true );
1627  btnChangeColor->setEnabled( false );
1628  btnChangeColor2->setEnabled( false );
1629  }
1630 
1631  mSpinBlurRadius->blockSignals( true );
1632  mBlurSlider->blockSignals( true );
1633  mSpinBlurRadius->setValue( mLayer->blurRadius() );
1634  mBlurSlider->setValue( mLayer->blurRadius() );
1635  mSpinBlurRadius->blockSignals( false );
1636  mBlurSlider->blockSignals( false );
1637 
1638  mSpinMaxDistance->blockSignals( true );
1639  mSpinMaxDistance->setValue( mLayer->maxDistance() );
1640  mSpinMaxDistance->blockSignals( false );
1641 
1642  mRadioUseWholeShape->blockSignals( true );
1643  mRadioUseMaxDistance->blockSignals( true );
1644  if ( mLayer->useWholeShape() )
1645  {
1646  mRadioUseWholeShape->setChecked( true );
1647  mSpinMaxDistance->setEnabled( false );
1648  mDistanceUnitWidget->setEnabled( false );
1649  }
1650  else
1651  {
1652  mRadioUseMaxDistance->setChecked( true );
1653  mSpinMaxDistance->setEnabled( true );
1654  mDistanceUnitWidget->setEnabled( true );
1655  }
1656  mRadioUseWholeShape->blockSignals( false );
1657  mRadioUseMaxDistance->blockSignals( false );
1658 
1659  mDistanceUnitWidget->blockSignals( true );
1660  mDistanceUnitWidget->setUnit( mLayer->distanceUnit() );
1661  mDistanceUnitWidget->setMapUnitScale( mLayer->distanceMapUnitScale() );
1662  mDistanceUnitWidget->blockSignals( false );
1663 
1664  mIgnoreRingsCheckBox->blockSignals( true );
1665  mIgnoreRingsCheckBox->setCheckState( mLayer->ignoreRings() ? Qt::Checked : Qt::Unchecked );
1666  mIgnoreRingsCheckBox->blockSignals( false );
1667 
1668  // set source color ramp
1669  if ( mLayer->colorRamp() )
1670  {
1671  btnColorRamp->blockSignals( true );
1672  btnColorRamp->setColorRamp( mLayer->colorRamp() );
1673  btnColorRamp->blockSignals( false );
1674  }
1675 
1676  spinOffsetX->blockSignals( true );
1677  spinOffsetX->setValue( mLayer->offset().x() );
1678  spinOffsetX->blockSignals( false );
1679  spinOffsetY->blockSignals( true );
1680  spinOffsetY->setValue( mLayer->offset().y() );
1681  spinOffsetY->blockSignals( false );
1682  mOffsetUnitWidget->blockSignals( true );
1683  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
1684  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
1685  mOffsetUnitWidget->blockSignals( false );
1686 
1694 }
1695 
1697 {
1698  return mLayer;
1699 }
1700 
1702 {
1703  if ( mLayer )
1704  {
1705  mLayer->setColor( color );
1706  emit changed();
1707  }
1708 }
1709 
1711 {
1712  if ( mLayer )
1713  {
1714  mLayer->setColor2( color );
1715  emit changed();
1716  }
1717 }
1718 
1719 void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1720 {
1721  if ( !mLayer )
1722  {
1723  return;
1724  }
1725 
1726  if ( radioTwoColor->isChecked() )
1727  {
1729  }
1730  else
1731  {
1733  }
1734  emit changed();
1735 }
1736 
1737 void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged( int value )
1738 {
1739  if ( mLayer )
1740  {
1741  mLayer->setBlurRadius( value );
1742  emit changed();
1743  }
1744 }
1745 
1746 void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged( double value )
1747 {
1748  if ( mLayer )
1749  {
1750  mLayer->setMaxDistance( value );
1751  emit changed();
1752  }
1753 }
1754 
1755 void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1756 {
1757  if ( mLayer )
1758  {
1759  mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
1760  mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
1761  emit changed();
1762  }
1763 }
1764 
1765 void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled( bool value )
1766 {
1767  if ( mLayer )
1768  {
1769  mLayer->setUseWholeShape( value );
1770  mDistanceUnitWidget->setEnabled( !value );
1771  emit changed();
1772  }
1773 }
1774 
1775 void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1776 {
1777  QgsColorRamp *ramp = btnColorRamp->colorRamp();
1778  if ( !ramp )
1779  return;
1780 
1781  mLayer->setColorRamp( ramp );
1782  emit changed();
1783 }
1784 
1785 void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1786 {
1787  if ( mLayer )
1788  {
1789  mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1790  emit changed();
1791  }
1792 }
1793 
1794 void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1795 {
1796  if ( mLayer )
1797  {
1798  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1799  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1800  emit changed();
1801  }
1802 }
1803 
1804 
1805 void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged( int state )
1806 {
1807  bool checked = ( state == Qt::Checked );
1808  mLayer->setIgnoreRings( checked );
1809  emit changed();
1810 }
1811 
1813 
1815  : QgsSymbolLayerWidget( parent, vl )
1816 {
1817  mLayer = nullptr;
1818 
1819  setupUi( this );
1820  connect( mIntervalUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed );
1821  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed );
1822  connect( mOffsetAlongLineUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed );
1823  connect( mAverageAngleUnit, &QgsUnitSelectionWidget::changed, this, &QgsMarkerLineSymbolLayerWidget::averageAngleUnitChanged );
1832 
1833  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconAllRings.svg" ) ), tr( "All Rings" ), QgsLineSymbolLayer::AllRings );
1834  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconExteriorRing.svg" ) ), tr( "Exterior Ring Only" ), QgsLineSymbolLayer::ExteriorRingOnly );
1835  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconInteriorRings.svg" ) ), tr( "Interior Rings Only" ), QgsLineSymbolLayer::InteriorRingsOnly );
1836  connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ), this, [ = ]( int )
1837  {
1838  if ( mLayer )
1839  {
1840  mLayer->setRingFilter( static_cast< QgsLineSymbolLayer::RenderRingFilter >( mRingFilterComboBox->currentData().toInt() ) );
1841  emit changed();
1842  }
1843  } );
1844 
1845  spinOffset->setClearValue( 0.0 );
1846 
1847 
1848  if ( vl && vl->geometryType() != QgsWkbTypes::PolygonGeometry )
1849  {
1850  mRingFilterComboBox->hide();
1851  mRingsLabel->hide();
1852  }
1853 
1854  mSpinAverageAngleLength->setClearValue( 4.0 );
1855 
1856  connect( spinInterval, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsMarkerLineSymbolLayerWidget::setInterval );
1857  connect( mSpinOffsetAlongLine, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsMarkerLineSymbolLayerWidget::setOffsetAlongLine );
1858  connect( chkRotateMarker, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1859  connect( spinOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1860  connect( mSpinAverageAngleLength, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsMarkerLineSymbolLayerWidget::setAverageAngle );
1861  connect( radInterval, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1862  connect( radVertex, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1863  connect( radVertexLast, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1864  connect( radVertexFirst, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1865  connect( radCentralPoint, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1866  connect( radCurvePoint, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1867  connect( radSegmentCentralPoint, &QAbstractButton::clicked, this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1868 }
1869 
1871 {
1872  if ( layer->layerType() != QLatin1String( "MarkerLine" ) )
1873  return;
1874 
1875  // layer type is correct, we can do the cast
1876  mLayer = static_cast<QgsMarkerLineSymbolLayer *>( layer );
1877 
1878  // set values
1879  spinInterval->blockSignals( true );
1880  spinInterval->setValue( mLayer->interval() );
1881  spinInterval->blockSignals( false );
1882  mSpinOffsetAlongLine->blockSignals( true );
1883  mSpinOffsetAlongLine->setValue( mLayer->offsetAlongLine() );
1884  mSpinOffsetAlongLine->blockSignals( false );
1885  chkRotateMarker->blockSignals( true );
1886  chkRotateMarker->setChecked( mLayer->rotateSymbols() );
1887  chkRotateMarker->blockSignals( false );
1888  spinOffset->blockSignals( true );
1889  spinOffset->setValue( mLayer->offset() );
1890  spinOffset->blockSignals( false );
1892  radInterval->setChecked( true );
1894  radVertex->setChecked( true );
1896  radVertexLast->setChecked( true );
1898  radCentralPoint->setChecked( true );
1900  radCurvePoint->setChecked( true );
1902  radSegmentCentralPoint->setChecked( true );
1903  else
1904  radVertexFirst->setChecked( true );
1905 
1906  // set units
1907  mIntervalUnitWidget->blockSignals( true );
1908  mIntervalUnitWidget->setUnit( mLayer->intervalUnit() );
1909  mIntervalUnitWidget->setMapUnitScale( mLayer->intervalMapUnitScale() );
1910  mIntervalUnitWidget->blockSignals( false );
1911  mOffsetUnitWidget->blockSignals( true );
1912  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
1913  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
1914  mOffsetUnitWidget->blockSignals( false );
1915  mOffsetAlongLineUnitWidget->blockSignals( true );
1916  mOffsetAlongLineUnitWidget->setUnit( mLayer->offsetAlongLineUnit() );
1917  mOffsetAlongLineUnitWidget->setMapUnitScale( mLayer->offsetAlongLineMapUnitScale() );
1918  mOffsetAlongLineUnitWidget->blockSignals( false );
1919 
1920  whileBlocking( mAverageAngleUnit )->setUnit( mLayer->averageAngleUnit() );
1921  whileBlocking( mAverageAngleUnit )->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
1922  whileBlocking( mSpinAverageAngleLength )->setValue( mLayer->averageAngleLength() );
1923 
1924  whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
1925 
1926  setPlacement(); // update gui
1927 
1933 }
1934 
1936 {
1937  return mLayer;
1938 }
1939 
1941 {
1942  mLayer->setInterval( val );
1943  emit changed();
1944 }
1945 
1947 {
1948  mLayer->setOffsetAlongLine( val );
1949  emit changed();
1950 }
1951 
1952 void QgsMarkerLineSymbolLayerWidget::setRotate()
1953 {
1954  mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
1955  mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
1956 
1957  mLayer->setRotateSymbols( chkRotateMarker->isChecked() );
1958  emit changed();
1959 }
1960 
1961 void QgsMarkerLineSymbolLayerWidget::setOffset()
1962 {
1963  mLayer->setOffset( spinOffset->value() );
1964  emit changed();
1965 }
1966 
1967 void QgsMarkerLineSymbolLayerWidget::setPlacement()
1968 {
1969  bool interval = radInterval->isChecked();
1970  spinInterval->setEnabled( interval );
1971  mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1972  mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
1973  mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
1974  mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
1975  //mLayer->setPlacement( interval ? QgsMarkerLineSymbolLayer::Interval : QgsMarkerLineSymbolLayer::Vertex );
1976  if ( radInterval->isChecked() )
1978  else if ( radVertex->isChecked() )
1980  else if ( radVertexLast->isChecked() )
1982  else if ( radVertexFirst->isChecked() )
1984  else if ( radCurvePoint->isChecked() )
1986  else if ( radSegmentCentralPoint->isChecked() )
1988  else
1990 
1991  emit changed();
1992 }
1993 
1994 void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
1995 {
1996  if ( mLayer )
1997  {
1998  mLayer->setIntervalUnit( mIntervalUnitWidget->unit() );
1999  mLayer->setIntervalMapUnitScale( mIntervalUnitWidget->getMapUnitScale() );
2000  emit changed();
2001  }
2002 }
2003 
2004 void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2005 {
2006  if ( mLayer )
2007  {
2008  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2009  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2010  emit changed();
2011  }
2012 }
2013 
2014 void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2015 {
2016  if ( mLayer )
2017  {
2018  mLayer->setOffsetAlongLineUnit( mOffsetAlongLineUnitWidget->unit() );
2019  mLayer->setOffsetAlongLineMapUnitScale( mOffsetAlongLineUnitWidget->getMapUnitScale() );
2020  }
2021  emit changed();
2022 }
2023 
2024 void QgsMarkerLineSymbolLayerWidget::averageAngleUnitChanged()
2025 {
2026  if ( mLayer )
2027  {
2028  mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
2029  mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
2030  }
2031  emit changed();
2032 }
2033 
2034 void QgsMarkerLineSymbolLayerWidget::setAverageAngle( double val )
2035 {
2036  if ( mLayer )
2037  {
2038  mLayer->setAverageAngleLength( val );
2039  emit changed();
2040  }
2041 }
2042 
2043 
2045 
2047  : QgsSymbolLayerWidget( parent, vl )
2048 {
2049  mLayer = nullptr;
2050 
2051  setupUi( this );
2052  connect( mIntervalUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsHashedLineSymbolLayerWidget::mIntervalUnitWidget_changed );
2053  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsHashedLineSymbolLayerWidget::mOffsetUnitWidget_changed );
2054  connect( mOffsetAlongLineUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsHashedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed );
2055  connect( mAverageAngleUnit, &QgsUnitSelectionWidget::changed, this, &QgsHashedLineSymbolLayerWidget::averageAngleUnitChanged );
2056  connect( mHashLengthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsHashedLineSymbolLayerWidget::hashLengthUnitWidgetChanged );
2067 
2068  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconAllRings.svg" ) ), tr( "All Rings" ), QgsLineSymbolLayer::AllRings );
2069  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconExteriorRing.svg" ) ), tr( "Exterior Ring Only" ), QgsLineSymbolLayer::ExteriorRingOnly );
2070  mRingFilterComboBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "mIconInteriorRings.svg" ) ), tr( "Interior Rings Only" ), QgsLineSymbolLayer::InteriorRingsOnly );
2071  connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ), this, [ = ]( int )
2072  {
2073  if ( mLayer )
2074  {
2075  mLayer->setRingFilter( static_cast< QgsLineSymbolLayer::RenderRingFilter >( mRingFilterComboBox->currentData().toInt() ) );
2076  emit changed();
2077  }
2078  } );
2079 
2080  spinOffset->setClearValue( 0.0 );
2081 
2082 
2083  if ( vl && vl->geometryType() != QgsWkbTypes::PolygonGeometry )
2084  {
2085  mRingFilterComboBox->hide();
2086  mRingsLabel->hide();
2087  }
2088 
2089  mHashRotationSpinBox->setClearValue( 0 );
2090  mSpinAverageAngleLength->setClearValue( 4.0 );
2091 
2092  connect( spinInterval, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsHashedLineSymbolLayerWidget::setInterval );
2093  connect( mSpinOffsetAlongLine, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsHashedLineSymbolLayerWidget::setOffsetAlongLine );
2094  connect( mSpinHashLength, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsHashedLineSymbolLayerWidget::setHashLength );
2095  connect( mHashRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsHashedLineSymbolLayerWidget::setHashAngle );
2096  connect( chkRotateMarker, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setRotate );
2097  connect( spinOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsHashedLineSymbolLayerWidget::setOffset );
2098  connect( mSpinAverageAngleLength, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsHashedLineSymbolLayerWidget::setAverageAngle );
2099  connect( radInterval, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2100  connect( radVertex, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2101  connect( radVertexLast, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2102  connect( radVertexFirst, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2103  connect( radCentralPoint, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2104  connect( radCurvePoint, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2105  connect( radSegmentCentralPoint, &QAbstractButton::clicked, this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2106 }
2107 
2109 {
2110  if ( layer->layerType() != QLatin1String( "HashLine" ) )
2111  return;
2112 
2113  // layer type is correct, we can do the cast
2114  mLayer = static_cast<QgsHashedLineSymbolLayer *>( layer );
2115 
2116  // set values
2117  spinInterval->blockSignals( true );
2118  spinInterval->setValue( mLayer->interval() );
2119  spinInterval->blockSignals( false );
2120  mSpinOffsetAlongLine->blockSignals( true );
2121  mSpinOffsetAlongLine->setValue( mLayer->offsetAlongLine() );
2122  mSpinOffsetAlongLine->blockSignals( false );
2123  whileBlocking( mSpinHashLength )->setValue( mLayer->hashLength() );
2124  whileBlocking( mHashRotationSpinBox )->setValue( mLayer->hashAngle() );
2125  chkRotateMarker->blockSignals( true );
2126  chkRotateMarker->setChecked( mLayer->rotateSymbols() );
2127  chkRotateMarker->blockSignals( false );
2128  spinOffset->blockSignals( true );
2129  spinOffset->setValue( mLayer->offset() );
2130  spinOffset->blockSignals( false );
2132  radInterval->setChecked( true );
2133  else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::Vertex )
2134  radVertex->setChecked( true );
2136  radVertexLast->setChecked( true );
2138  radCentralPoint->setChecked( true );
2140  radCurvePoint->setChecked( true );
2142  radSegmentCentralPoint->setChecked( true );
2143  else
2144  radVertexFirst->setChecked( true );
2145 
2146  // set units
2147  mIntervalUnitWidget->blockSignals( true );
2148  mIntervalUnitWidget->setUnit( mLayer->intervalUnit() );
2149  mIntervalUnitWidget->setMapUnitScale( mLayer->intervalMapUnitScale() );
2150  mIntervalUnitWidget->blockSignals( false );
2151  mOffsetUnitWidget->blockSignals( true );
2152  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2153  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2154  mOffsetUnitWidget->blockSignals( false );
2155  mOffsetAlongLineUnitWidget->blockSignals( true );
2156  mOffsetAlongLineUnitWidget->setUnit( mLayer->offsetAlongLineUnit() );
2157  mOffsetAlongLineUnitWidget->setMapUnitScale( mLayer->offsetAlongLineMapUnitScale() );
2158  mOffsetAlongLineUnitWidget->blockSignals( false );
2159  whileBlocking( mAverageAngleUnit )->setUnit( mLayer->averageAngleUnit() );
2160  whileBlocking( mAverageAngleUnit )->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
2161  whileBlocking( mSpinAverageAngleLength )->setValue( mLayer->averageAngleLength() );
2162  whileBlocking( mHashLengthUnitWidget )->setUnit( mLayer->hashLengthUnit() );
2163  whileBlocking( mHashLengthUnitWidget )->setMapUnitScale( mLayer->hashLengthMapUnitScale() );
2164 
2165  whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
2166 
2167  setPlacement(); // update gui
2168 
2176 }
2177 
2179 {
2180  return mLayer;
2181 }
2182 
2183 void QgsHashedLineSymbolLayerWidget::setInterval( double val )
2184 {
2185  mLayer->setInterval( val );
2186  emit changed();
2187 }
2188 
2189 void QgsHashedLineSymbolLayerWidget::setOffsetAlongLine( double val )
2190 {
2191  mLayer->setOffsetAlongLine( val );
2192  emit changed();
2193 }
2194 
2195 void QgsHashedLineSymbolLayerWidget::setHashLength( double val )
2196 {
2197  mLayer->setHashLength( val );
2198  emit changed();
2199 }
2200 
2201 void QgsHashedLineSymbolLayerWidget::setHashAngle( double val )
2202 {
2203  mLayer->setHashAngle( val );
2204  emit changed();
2205 }
2206 
2207 void QgsHashedLineSymbolLayerWidget::setRotate()
2208 {
2209  mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
2210  mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2211 
2212  mLayer->setRotateSymbols( chkRotateMarker->isChecked() );
2213  emit changed();
2214 }
2215 
2216 void QgsHashedLineSymbolLayerWidget::setOffset()
2217 {
2218  mLayer->setOffset( spinOffset->value() );
2219  emit changed();
2220 }
2221 
2222 void QgsHashedLineSymbolLayerWidget::setPlacement()
2223 {
2224  bool interval = radInterval->isChecked();
2225  spinInterval->setEnabled( interval );
2226  mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
2227  mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2228  mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
2229  mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2230  //mLayer->setPlacement( interval ? QgsMarkerLineSymbolLayer::Interval : QgsMarkerLineSymbolLayer::Vertex );
2231  if ( radInterval->isChecked() )
2233  else if ( radVertex->isChecked() )
2235  else if ( radVertexLast->isChecked() )
2237  else if ( radVertexFirst->isChecked() )
2239  else if ( radCurvePoint->isChecked() )
2241  else if ( radSegmentCentralPoint->isChecked() )
2243  else
2245 
2246  emit changed();
2247 }
2248 
2249 void QgsHashedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2250 {
2251  if ( mLayer )
2252  {
2253  mLayer->setIntervalUnit( mIntervalUnitWidget->unit() );
2254  mLayer->setIntervalMapUnitScale( mIntervalUnitWidget->getMapUnitScale() );
2255  emit changed();
2256  }
2257 }
2258 
2259 void QgsHashedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2260 {
2261  if ( mLayer )
2262  {
2263  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2264  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2265  emit changed();
2266  }
2267 }
2268 
2269 void QgsHashedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2270 {
2271  if ( mLayer )
2272  {
2273  mLayer->setOffsetAlongLineUnit( mOffsetAlongLineUnitWidget->unit() );
2274  mLayer->setOffsetAlongLineMapUnitScale( mOffsetAlongLineUnitWidget->getMapUnitScale() );
2275  }
2276  emit changed();
2277 }
2278 
2279 void QgsHashedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2280 {
2281  if ( mLayer )
2282  {
2283  mLayer->setHashLengthUnit( mHashLengthUnitWidget->unit() );
2284  mLayer->setHashLengthMapUnitScale( mHashLengthUnitWidget->getMapUnitScale() );
2285  }
2286  emit changed();
2287 }
2288 
2289 void QgsHashedLineSymbolLayerWidget::averageAngleUnitChanged()
2290 {
2291  if ( mLayer )
2292  {
2293  mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
2294  mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
2295  }
2296  emit changed();
2297 }
2298 
2299 void QgsHashedLineSymbolLayerWidget::setAverageAngle( double val )
2300 {
2301  if ( mLayer )
2302  {
2303  mLayer->setAverageAngleLength( val );
2304  emit changed();
2305  }
2306 }
2307 
2309 
2310 
2312  : QgsSymbolLayerWidget( parent, vl )
2313 {
2314  mLayer = nullptr;
2315 
2316  setupUi( this );
2317 
2318  mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible( true );
2319  mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral( "/UI/lastSVGMarkerDir" ) );
2320 
2321  connect( mSvgSelectorWidget->sourceLineEdit(), &QgsSvgSourceLineEdit::sourceChanged, this, &QgsSvgMarkerSymbolLayerWidget::svgSourceChanged );
2322  connect( mChangeColorButton, &QgsColorButton::colorChanged, this, &QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged );
2323  connect( mChangeStrokeColorButton, &QgsColorButton::colorChanged, this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2324  connect( mStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2325  connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
2326  connect( mStrokeWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed );
2327  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
2328  connect( mHorizontalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2329  connect( mVerticalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2336  mChangeColorButton->setAllowOpacity( true );
2337  mChangeColorButton->setColorDialogTitle( tr( "Select Fill color" ) );
2338  mChangeColorButton->setContext( QStringLiteral( "symbology" ) );
2339  mChangeStrokeColorButton->setAllowOpacity( true );
2340  mChangeStrokeColorButton->setColorDialogTitle( tr( "Select Stroke Color" ) );
2341  mChangeStrokeColorButton->setContext( QStringLiteral( "symbology" ) );
2342 
2343  mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2344  mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2345 
2346  spinOffsetX->setClearValue( 0.0 );
2347  spinOffsetY->setClearValue( 0.0 );
2348  spinAngle->setClearValue( 0.0 );
2349 
2350  connect( spinWidth, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2351  connect( spinHeight, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2352  connect( mLockAspectRatio, static_cast < void ( QgsRatioLockButton::* )( bool ) > ( &QgsRatioLockButton::lockChanged ), this, &QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged );
2353  connect( spinAngle, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2354  connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2355  connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2356  connect( this, &QgsSymbolLayerWidget::changed, this, &QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol );
2357 
2358  connect( mSvgSelectorWidget, &QgsSvgSelectorWidget::svgSelected, this, &QgsSvgMarkerSymbolLayerWidget::setSvgPath );
2359 
2360 
2361  //make a temporary symbol for the size assistant preview
2362  mAssistantPreviewSymbol.reset( new QgsMarkerSymbol() );
2363 
2364  if ( vectorLayer() )
2365  {
2366  mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2367  mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2368  }
2369 }
2370 
2371 #include <QTime>
2372 #include <QAbstractListModel>
2373 #include <QPixmapCache>
2374 #include <QStyle>
2375 
2376 
2377 
2378 
2379 void QgsSvgMarkerSymbolLayerWidget::setGuiForSvg( const QgsSvgMarkerSymbolLayer *layer, bool skipDefaultColors )
2380 {
2381  if ( !layer )
2382  {
2383  return;
2384  }
2385 
2386  //activate gui for svg parameters only if supported by the svg file
2387  bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2388  QColor defaultFill, defaultStroke;
2389  double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2390  bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2391  QgsApplication::svgCache()->containsParams( layer->path(), hasFillParam, hasDefaultFillColor, defaultFill,
2392  hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2393  hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2394  hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2395  hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2396  mChangeColorButton->setEnabled( hasFillParam );
2397  mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2398  mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2399  mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2400  mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2401 
2402  if ( hasFillParam )
2403  {
2404  QColor fill = layer->fillColor();
2405  double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2406  if ( hasDefaultFillColor && !skipDefaultColors )
2407  {
2408  fill = defaultFill;
2409  }
2410  fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2411  mChangeColorButton->setColor( fill );
2412  }
2413  if ( hasStrokeParam )
2414  {
2415  QColor stroke = layer->strokeColor();
2416  double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2417  if ( hasDefaultStrokeColor && !skipDefaultColors )
2418  {
2419  stroke = defaultStroke;
2420  }
2421  stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2422  mChangeStrokeColorButton->setColor( stroke );
2423  }
2424 
2425  whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->path() );
2426 
2427  mStrokeWidthSpinBox->blockSignals( true );
2428  mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->strokeWidth() );
2429  mStrokeWidthSpinBox->blockSignals( false );
2430 
2431  bool preservedAspectRatio = layer->preservedAspectRatio();
2432  spinHeight->blockSignals( true );
2433  if ( preservedAspectRatio )
2434  {
2435  spinHeight->setValue( layer->size() * layer->defaultAspectRatio() );
2436  }
2437  else
2438  {
2439  spinHeight->setValue( layer->size() * layer->fixedAspectRatio() );
2440  }
2441  spinHeight->setEnabled( layer->defaultAspectRatio() > 0.0 );
2442  spinHeight->blockSignals( false );
2443  whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2444 }
2445 
2446 void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2447 {
2448  for ( int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
2449  {
2450  mAssistantPreviewSymbol->deleteSymbolLayer( i );
2451  }
2452  mAssistantPreviewSymbol->appendSymbolLayer( mLayer->clone() );
2454  if ( ddSize )
2455  mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2456 }
2457 
2458 
2460 {
2461  if ( !layer )
2462  {
2463  return;
2464  }
2465 
2466  if ( layer->layerType() != QLatin1String( "SvgMarker" ) )
2467  return;
2468 
2469  // layer type is correct, we can do the cast
2470  mLayer = static_cast<QgsSvgMarkerSymbolLayer *>( layer );
2471 
2472  // set values
2473  mSvgSelectorWidget->setSvgPath( mLayer->path() );
2474 
2475  spinWidth->blockSignals( true );
2476  spinWidth->setValue( mLayer->size() );
2477  spinWidth->blockSignals( false );
2478  spinAngle->blockSignals( true );
2479  spinAngle->setValue( mLayer->angle() );
2480  spinAngle->blockSignals( false );
2481 
2482  // without blocking signals the value gets changed because of slot setOffset()
2483  spinOffsetX->blockSignals( true );
2484  spinOffsetX->setValue( mLayer->offset().x() );
2485  spinOffsetX->blockSignals( false );
2486  spinOffsetY->blockSignals( true );
2487  spinOffsetY->setValue( mLayer->offset().y() );
2488  spinOffsetY->blockSignals( false );
2489 
2490  mSizeUnitWidget->blockSignals( true );
2491  mSizeUnitWidget->setUnit( mLayer->sizeUnit() );
2492  mSizeUnitWidget->setMapUnitScale( mLayer->sizeMapUnitScale() );
2493  mSizeUnitWidget->blockSignals( false );
2494  mStrokeWidthUnitWidget->blockSignals( true );
2495  mStrokeWidthUnitWidget->setUnit( mLayer->strokeWidthUnit() );
2496  mStrokeWidthUnitWidget->setMapUnitScale( mLayer->strokeWidthMapUnitScale() );
2497  mStrokeWidthUnitWidget->blockSignals( false );
2498  mOffsetUnitWidget->blockSignals( true );
2499  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2500  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2501  mOffsetUnitWidget->blockSignals( false );
2502 
2503  //anchor points
2504  mHorizontalAnchorComboBox->blockSignals( true );
2505  mVerticalAnchorComboBox->blockSignals( true );
2506  mHorizontalAnchorComboBox->setCurrentIndex( mLayer->horizontalAnchorPoint() );
2507  mVerticalAnchorComboBox->setCurrentIndex( mLayer->verticalAnchorPoint() );
2508  mHorizontalAnchorComboBox->blockSignals( false );
2509  mVerticalAnchorComboBox->blockSignals( false );
2510 
2511  setGuiForSvg( mLayer, true );
2512 
2522 
2523  registerDataDefinedButton( mSvgSelectorWidget->sourceLineEdit()->propertyOverrideToolButton(), QgsSymbolLayer::PropertyName );
2524 
2525  updateAssistantSymbol();
2526 }
2527 
2529 {
2530  return mLayer;
2531 }
2532 
2534 {
2536  mSvgSelectorWidget->sourceLineEdit()->setMessageBar( context.messageBar() );
2537 }
2538 
2540 {
2541  mLayer->setPath( name );
2542  whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2543 
2544  setGuiForSvg( mLayer );
2545  emit changed();
2546 }
2547 
2548 void QgsSvgMarkerSymbolLayerWidget::setWidth()
2549 {
2550  double defaultAspectRatio = mLayer->defaultAspectRatio();
2551  double fixedAspectRatio = 0.0;
2552  spinHeight->blockSignals( true );
2553  if ( defaultAspectRatio <= 0.0 )
2554  {
2555  spinHeight->setValue( spinWidth->value() );
2556  }
2557  else if ( mLockAspectRatio->locked() )
2558  {
2559  spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2560  }
2561  else
2562  {
2563  fixedAspectRatio = spinHeight->value() / spinWidth->value();
2564  }
2565  spinHeight->blockSignals( false );
2566  mLayer->setSize( spinWidth->value() );
2567  mLayer->setFixedAspectRatio( fixedAspectRatio );
2568  emit changed();
2569 }
2570 
2571 void QgsSvgMarkerSymbolLayerWidget::setHeight()
2572 {
2573  double defaultAspectRatio = mLayer->defaultAspectRatio();
2574  double fixedAspectRatio = 0.0;
2575  spinWidth->blockSignals( true );
2576  if ( defaultAspectRatio <= 0.0 )
2577  {
2578  spinWidth->setValue( spinHeight->value() );
2579  }
2580  else if ( mLockAspectRatio->locked() )
2581  {
2582  spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2583  }
2584  else
2585  {
2586  fixedAspectRatio = spinHeight->value() / spinWidth->value();
2587  }
2588  spinWidth->blockSignals( false );
2589  mLayer->setSize( spinWidth->value() );
2590  mLayer->setFixedAspectRatio( fixedAspectRatio );
2591  emit changed();
2592 }
2593 
2594 void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged( const bool locked )
2595 {
2596  //spinHeight->setEnabled( !locked );
2597  double defaultAspectRatio = mLayer->defaultAspectRatio();
2598  if ( defaultAspectRatio <= 0.0 )
2599  {
2600  whileBlocking( mLockAspectRatio )->setLocked( true );
2601  }
2602  else if ( locked )
2603  {
2604  mLayer->setFixedAspectRatio( 0.0 );
2605  setWidth();
2606  }
2607  else
2608  {
2609  mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
2610  }
2611  //emit changed();
2612 }
2613 
2614 void QgsSvgMarkerSymbolLayerWidget::setAngle()
2615 {
2616  mLayer->setAngle( spinAngle->value() );
2617  emit changed();
2618 }
2619 
2620 void QgsSvgMarkerSymbolLayerWidget::setOffset()
2621 {
2622  mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2623  emit changed();
2624 }
2625 
2626 void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged( const QString &text )
2627 {
2628  mLayer->setPath( text );
2629  setGuiForSvg( mLayer );
2630  emit changed();
2631 }
2632 
2633 void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged( const QColor &color )
2634 {
2635  if ( !mLayer )
2636  {
2637  return;
2638  }
2639 
2640  mLayer->setFillColor( color );
2641  emit changed();
2642 }
2643 
2644 void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged( const QColor &color )
2645 {
2646  if ( !mLayer )
2647  {
2648  return;
2649  }
2650 
2651  mLayer->setStrokeColor( color );
2652  emit changed();
2653 }
2654 
2655 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged( double d )
2656 {
2657  if ( mLayer )
2658  {
2659  mLayer->setStrokeWidth( d );
2660  emit changed();
2661  }
2662 }
2663 
2664 void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2665 {
2666  if ( mLayer )
2667  {
2668  mLayer->setSizeUnit( mSizeUnitWidget->unit() );
2669  mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
2670  emit changed();
2671  }
2672 }
2673 
2674 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2675 {
2676  if ( mLayer )
2677  {
2678  mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
2679  mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
2680  emit changed();
2681  }
2682 }
2683 
2684 void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2685 {
2686  if ( mLayer )
2687  {
2688  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2689  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2690  emit changed();
2691  }
2692 }
2693 
2694 void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
2695 {
2696  if ( mLayer )
2697  {
2699  emit changed();
2700  }
2701 }
2702 
2703 void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
2704 {
2705  if ( mLayer )
2706  {
2708  emit changed();
2709  }
2710 }
2711 
2713 
2715 {
2716  mLayer = nullptr;
2717  setupUi( this );
2718 
2719  mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible( true );
2720 
2721  connect( mTextureWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2722  connect( mSvgSelectorWidget->sourceLineEdit(), &QgsSvgSourceLineEdit::sourceChanged, this, &QgsSVGFillSymbolLayerWidget::svgSourceChanged );
2723  connect( mRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2724  connect( mChangeColorButton, &QgsColorButton::colorChanged, this, &QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged );
2725  connect( mChangeStrokeColorButton, &QgsColorButton::colorChanged, this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2726  connect( mStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2727  connect( mTextureWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed );
2728  connect( mSvgStrokeWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed );
2733 
2734  mRotationSpinBox->setClearValue( 0.0 );
2735 
2736  mChangeColorButton->setColorDialogTitle( tr( "Select Fill Color" ) );
2737  mChangeColorButton->setContext( QStringLiteral( "symbology" ) );
2738  mChangeStrokeColorButton->setColorDialogTitle( tr( "Select Stroke Color" ) );
2739  mChangeStrokeColorButton->setContext( QStringLiteral( "symbology" ) );
2740 
2741  mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2742  mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2743 
2744  connect( mSvgSelectorWidget, &QgsSvgSelectorWidget::svgSelected, this, &QgsSVGFillSymbolLayerWidget::setFile );
2745 
2746 }
2747 
2749 {
2750  if ( !layer )
2751  {
2752  return;
2753  }
2754 
2755  if ( layer->layerType() != QLatin1String( "SVGFill" ) )
2756  {
2757  return;
2758  }
2759 
2760  mLayer = dynamic_cast<QgsSVGFillSymbolLayer *>( layer );
2761  if ( mLayer )
2762  {
2763  double width = mLayer->patternWidth();
2764  mTextureWidthSpinBox->blockSignals( true );
2765  mTextureWidthSpinBox->setValue( width );
2766  mTextureWidthSpinBox->blockSignals( false );
2767  whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( mLayer->svgFilePath() );
2768  mRotationSpinBox->blockSignals( true );
2769  mRotationSpinBox->setValue( mLayer->angle() );
2770  mRotationSpinBox->blockSignals( false );
2771  mTextureWidthUnitWidget->blockSignals( true );
2772  mTextureWidthUnitWidget->setUnit( mLayer->patternWidthUnit() );
2773  mTextureWidthUnitWidget->setMapUnitScale( mLayer->patternWidthMapUnitScale() );
2774  mTextureWidthUnitWidget->blockSignals( false );
2775  mSvgStrokeWidthUnitWidget->blockSignals( true );
2776  mSvgStrokeWidthUnitWidget->setUnit( mLayer->svgStrokeWidthUnit() );
2777  mSvgStrokeWidthUnitWidget->setMapUnitScale( mLayer->svgStrokeWidthMapUnitScale() );
2778  mSvgStrokeWidthUnitWidget->blockSignals( false );
2779  mChangeColorButton->blockSignals( true );
2780  mChangeColorButton->setColor( mLayer->svgFillColor() );
2781  mChangeColorButton->blockSignals( false );
2782  mChangeStrokeColorButton->blockSignals( true );
2783  mChangeStrokeColorButton->setColor( mLayer->svgStrokeColor() );
2784  mChangeStrokeColorButton->blockSignals( false );
2785  mStrokeWidthSpinBox->blockSignals( true );
2786  mStrokeWidthSpinBox->setValue( mLayer->svgStrokeWidth() );
2787  mStrokeWidthSpinBox->blockSignals( false );
2788  }
2789  updateParamGui( false );
2790 
2796 
2797  registerDataDefinedButton( mSvgSelectorWidget->sourceLineEdit()->propertyOverrideToolButton(), QgsSymbolLayer::PropertyFile );
2798 }
2799 
2801 {
2802  return mLayer;
2803 }
2804 
2806 {
2808  mSvgSelectorWidget->sourceLineEdit()->setMessageBar( context.messageBar() );
2809 }
2810 
2811 void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged( double d )
2812 {
2813  if ( mLayer )
2814  {
2815  mLayer->setPatternWidth( d );
2816  emit changed();
2817  }
2818 }
2819 
2820 void QgsSVGFillSymbolLayerWidget::svgSourceChanged( const QString &text )
2821 {
2822  if ( !mLayer )
2823  {
2824  return;
2825  }
2826 
2827  mLayer->setSvgFilePath( text );
2828  updateParamGui();
2829  emit changed();
2830 }
2831 
2832 void QgsSVGFillSymbolLayerWidget::setFile( const QString &name )
2833 {
2834  mLayer->setSvgFilePath( name );
2835  whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2836 
2837  updateParamGui();
2838  emit changed();
2839 }
2840 
2841 
2842 void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged( double d )
2843 {
2844  if ( mLayer )
2845  {
2846  mLayer->setAngle( d );
2847  emit changed();
2848  }
2849 }
2850 
2852 {
2853  //activate gui for svg parameters only if supported by the svg file
2854  bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2855  QColor defaultFill, defaultStroke;
2856  double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2857  bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2858  QgsApplication::svgCache()->containsParams( mSvgSelectorWidget->sourceLineEdit()->source(), hasFillParam, hasDefaultFillColor, defaultFill,
2859  hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2860  hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2861  hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2862  hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2863  if ( resetValues )
2864  {
2865  QColor fill = mChangeColorButton->color();
2866  double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2867  if ( hasDefaultFillColor )
2868  {
2869  fill = defaultFill;
2870  }
2871  fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2872  mChangeColorButton->setColor( fill );
2873  }
2874  mChangeColorButton->setEnabled( hasFillParam );
2875  mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2876  if ( resetValues )
2877  {
2878  QColor stroke = mChangeStrokeColorButton->color();
2879  double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2880  if ( hasDefaultStrokeColor )
2881  {
2882  stroke = defaultStroke;
2883  }
2884  stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2885  mChangeStrokeColorButton->setColor( stroke );
2886  }
2887  mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2888  mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2889  if ( hasDefaultStrokeWidth && resetValues )
2890  {
2891  mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2892  }
2893  mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2894 }
2895 
2896 void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged( const QColor &color )
2897 {
2898  if ( !mLayer )
2899  {
2900  return;
2901  }
2902 
2903  mLayer->setSvgFillColor( color );
2904  emit changed();
2905 }
2906 
2907 void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged( const QColor &color )
2908 {
2909  if ( !mLayer )
2910  {
2911  return;
2912  }
2913 
2914  mLayer->setSvgStrokeColor( color );
2915  emit changed();
2916 }
2917 
2918 void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged( double d )
2919 {
2920  if ( mLayer )
2921  {
2922  mLayer->setSvgStrokeWidth( d );
2923  emit changed();
2924  }
2925 }
2926 
2927 void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
2928 {
2929  if ( mLayer )
2930  {
2931  mLayer->setPatternWidthUnit( mTextureWidthUnitWidget->unit() );
2932  mLayer->setPatternWidthMapUnitScale( mTextureWidthUnitWidget->getMapUnitScale() );
2933  emit changed();
2934  }
2935 }
2936 
2937 void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
2938 {
2939  if ( mLayer )
2940  {
2941  mLayer->setSvgStrokeWidthUnit( mSvgStrokeWidthUnitWidget->unit() );
2942  mLayer->setSvgStrokeWidthMapUnitScale( mSvgStrokeWidthUnitWidget->getMapUnitScale() );
2943  emit changed();
2944  }
2945 }
2946 
2948 
2950  QgsSymbolLayerWidget( parent, vl )
2951 {
2952  setupUi( this );
2953  connect( mAngleSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
2954  connect( mDistanceSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
2955  connect( mOffsetSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
2956  connect( mDistanceUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed );
2957  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed );
2962  mOffsetSpinBox->setClearValue( 0 );
2963  mAngleSpinBox->setClearValue( 0 );
2964 }
2965 
2967 {
2968  if ( layer->layerType() != QLatin1String( "LinePatternFill" ) )
2969  {
2970  return;
2971  }
2972 
2973  QgsLinePatternFillSymbolLayer *patternLayer = static_cast<QgsLinePatternFillSymbolLayer *>( layer );
2974  if ( patternLayer )
2975  {
2976  mLayer = patternLayer;
2977  mAngleSpinBox->blockSignals( true );
2978  mAngleSpinBox->setValue( mLayer->lineAngle() );
2979  mAngleSpinBox->blockSignals( false );
2980  mDistanceSpinBox->blockSignals( true );
2981  mDistanceSpinBox->setValue( mLayer->distance() );
2982  mDistanceSpinBox->blockSignals( false );
2983  mOffsetSpinBox->blockSignals( true );
2984  mOffsetSpinBox->setValue( mLayer->offset() );
2985  mOffsetSpinBox->blockSignals( false );
2986 
2987  //units
2988  mDistanceUnitWidget->blockSignals( true );
2989  mDistanceUnitWidget->setUnit( mLayer->distanceUnit() );
2990  mDistanceUnitWidget->setMapUnitScale( mLayer->distanceMapUnitScale() );
2991  mDistanceUnitWidget->blockSignals( false );
2992  mOffsetUnitWidget->blockSignals( true );
2993  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2994  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2995  mOffsetUnitWidget->blockSignals( false );
2996  }
2997 
3000 }
3001 
3003 {
3004  return mLayer;
3005 }
3006 
3007 void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged( double d )
3008 {
3009  if ( mLayer )
3010  {
3011  mLayer->setLineAngle( d );
3012  emit changed();
3013  }
3014 }
3015 
3016 void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged( double d )
3017 {
3018  if ( mLayer )
3019  {
3020  mLayer->setDistance( d );
3021  emit changed();
3022  }
3023 }
3024 
3025 void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged( double d )
3026 {
3027  if ( mLayer )
3028  {
3029  mLayer->setOffset( d );
3030  emit changed();
3031  }
3032 }
3033 
3034 void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3035 {
3036  if ( mLayer )
3037  {
3038  mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
3039  mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
3040  emit changed();
3041  }
3042 }
3043 
3044 void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3045 {
3046  if ( mLayer )
3047  {
3048  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3049  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3050  emit changed();
3051  }
3052 }
3053 
3055 
3057  QgsSymbolLayerWidget( parent, vl )
3058 {
3059  setupUi( this );
3060  connect( mHorizontalDistanceSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3061  connect( mVerticalDistanceSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3062  connect( mHorizontalDisplacementSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3063  connect( mVerticalDisplacementSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3064  connect( mHorizontalOffsetSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3065  connect( mVerticalOffsetSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3066  connect( mHorizontalDistanceUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3067  connect( mVerticalDistanceUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3068  connect( mHorizontalDisplacementUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3069  connect( mVerticalDisplacementUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3070  connect( mHorizontalOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3071  connect( mVerticalOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3084 }
3085 
3086 
3088 {
3089  if ( !layer || layer->layerType() != QLatin1String( "PointPatternFill" ) )
3090  {
3091  return;
3092  }
3093 
3094  mLayer = static_cast<QgsPointPatternFillSymbolLayer *>( layer );
3095  whileBlocking( mHorizontalDistanceSpinBox )->setValue( mLayer->distanceX() );
3096  whileBlocking( mVerticalDistanceSpinBox )->setValue( mLayer->distanceY() );
3097  whileBlocking( mHorizontalDisplacementSpinBox )->setValue( mLayer->displacementX() );
3098  whileBlocking( mVerticalDisplacementSpinBox )->setValue( mLayer->displacementY() );
3099  whileBlocking( mHorizontalOffsetSpinBox )->setValue( mLayer->offsetX() );
3100  whileBlocking( mVerticalOffsetSpinBox )->setValue( mLayer->offsetY() );
3101 
3102  mHorizontalDistanceUnitWidget->blockSignals( true );
3103  mHorizontalDistanceUnitWidget->setUnit( mLayer->distanceXUnit() );
3104  mHorizontalDistanceUnitWidget->setMapUnitScale( mLayer->distanceXMapUnitScale() );
3105  mHorizontalDistanceUnitWidget->blockSignals( false );
3106  mVerticalDistanceUnitWidget->blockSignals( true );
3107  mVerticalDistanceUnitWidget->setUnit( mLayer->distanceYUnit() );
3108  mVerticalDistanceUnitWidget->setMapUnitScale( mLayer->distanceYMapUnitScale() );
3109  mVerticalDistanceUnitWidget->blockSignals( false );
3110  mHorizontalDisplacementUnitWidget->blockSignals( true );
3111  mHorizontalDisplacementUnitWidget->setUnit( mLayer->displacementXUnit() );
3112  mHorizontalDisplacementUnitWidget->setMapUnitScale( mLayer->displacementXMapUnitScale() );
3113  mHorizontalDisplacementUnitWidget->blockSignals( false );
3114  mVerticalDisplacementUnitWidget->blockSignals( true );
3115  mVerticalDisplacementUnitWidget->setUnit( mLayer->displacementYUnit() );
3116  mVerticalDisplacementUnitWidget->setMapUnitScale( mLayer->displacementYMapUnitScale() );
3117  mVerticalDisplacementUnitWidget->blockSignals( false );
3118  mHorizontalOffsetUnitWidget->blockSignals( true );
3119  mHorizontalOffsetUnitWidget->setUnit( mLayer->offsetXUnit() );
3120  mHorizontalOffsetUnitWidget->setMapUnitScale( mLayer->offsetXMapUnitScale() );
3121  mHorizontalOffsetUnitWidget->blockSignals( false );
3122  mVerticalOffsetUnitWidget->blockSignals( true );
3123  mVerticalOffsetUnitWidget->setUnit( mLayer->offsetYUnit() );
3124  mVerticalOffsetUnitWidget->setMapUnitScale( mLayer->offsetYMapUnitScale() );
3125  mVerticalOffsetUnitWidget->blockSignals( false );
3126 
3127  registerDataDefinedButton( mHorizontalDistanceDDBtn, QgsSymbolLayer::PropertyDistanceX );
3129  registerDataDefinedButton( mHorizontalDisplacementDDBtn, QgsSymbolLayer::PropertyDisplacementX );
3133 }
3134 
3136 {
3137  return mLayer;
3138 }
3139 
3140 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged( double d )
3141 {
3142  if ( mLayer )
3143  {
3144  mLayer->setDistanceX( d );
3145  emit changed();
3146  }
3147 }
3148 
3149 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged( double d )
3150 {
3151  if ( mLayer )
3152  {
3153  mLayer->setDistanceY( d );
3154  emit changed();
3155  }
3156 }
3157 
3158 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged( double d )
3159 {
3160  if ( mLayer )
3161  {
3162  mLayer->setDisplacementX( d );
3163  emit changed();
3164  }
3165 }
3166 
3167 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged( double d )
3168 {
3169  if ( mLayer )
3170  {
3171  mLayer->setDisplacementY( d );
3172  emit changed();
3173  }
3174 }
3175 
3176 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged( double d )
3177 {
3178  if ( mLayer )
3179  {
3180  mLayer->setOffsetX( d );
3181  emit changed();
3182  }
3183 }
3184 
3185 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged( double d )
3186 {
3187  if ( mLayer )
3188  {
3189  mLayer->setOffsetY( d );
3190  emit changed();
3191  }
3192 }
3193 
3194 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3195 {
3196  if ( mLayer )
3197  {
3198  mLayer->setDistanceXUnit( mHorizontalDistanceUnitWidget->unit() );
3199  mLayer->setDistanceXMapUnitScale( mHorizontalDistanceUnitWidget->getMapUnitScale() );
3200  emit changed();
3201  }
3202 }
3203 
3204 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3205 {
3206  if ( mLayer )
3207  {
3208  mLayer->setDistanceYUnit( mVerticalDistanceUnitWidget->unit() );
3209  mLayer->setDistanceYMapUnitScale( mVerticalDistanceUnitWidget->getMapUnitScale() );
3210  emit changed();
3211  }
3212 }
3213 
3214 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3215 {
3216  if ( mLayer )
3217  {
3218  mLayer->setDisplacementXUnit( mHorizontalDisplacementUnitWidget->unit() );
3219  mLayer->setDisplacementXMapUnitScale( mHorizontalDisplacementUnitWidget->getMapUnitScale() );
3220  emit changed();
3221  }
3222 }
3223 
3224 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3225 {
3226  if ( mLayer )
3227  {
3228  mLayer->setDisplacementYUnit( mVerticalDisplacementUnitWidget->unit() );
3229  mLayer->setDisplacementYMapUnitScale( mVerticalDisplacementUnitWidget->getMapUnitScale() );
3230  emit changed();
3231  }
3232 }
3233 
3234 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3235 {
3236  if ( mLayer )
3237  {
3238  mLayer->setOffsetXUnit( mHorizontalOffsetUnitWidget->unit() );
3239  mLayer->setOffsetXMapUnitScale( mHorizontalOffsetUnitWidget->getMapUnitScale() );
3240  emit changed();
3241  }
3242 }
3243 
3244 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3245 {
3246  if ( mLayer )
3247  {
3248  mLayer->setOffsetYUnit( mVerticalOffsetUnitWidget->unit() );
3249  mLayer->setOffsetYMapUnitScale( mVerticalOffsetUnitWidget->getMapUnitScale() );
3250  emit changed();
3251  }
3252 }
3253 
3255 
3257  : QgsSymbolLayerWidget( parent, vl )
3258 {
3259  mLayer = nullptr;
3260 
3261  setupUi( this );
3262  connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
3263  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
3264  connect( mStrokeWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed );
3265  connect( mStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3266  connect( mHorizontalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3267  connect( mVerticalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3274 
3275  widgetChar = new CharacterWidget();
3276  scrollArea->setWidget( widgetChar );
3277  scrollArea->setVerticalOnly( true );
3278 
3279  btnColor->setAllowOpacity( true );
3280  btnColor->setColorDialogTitle( tr( "Select Symbol Fill Color" ) );
3281  btnColor->setContext( QStringLiteral( "symbology" ) );
3282  btnStrokeColor->setAllowOpacity( true );
3283  btnStrokeColor->setColorDialogTitle( tr( "Select Symbol Stroke Color" ) );
3284  btnStrokeColor->setContext( QStringLiteral( "symbology" ) );
3285 
3286  mColorDDBtn->registerLinkedWidget( btnColor );
3287  mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3288 
3289  spinOffsetX->setClearValue( 0.0 );
3290  spinOffsetY->setClearValue( 0.0 );
3291  spinAngle->setClearValue( 0.0 );
3292 
3293  //make a temporary symbol for the size assistant preview
3294  mAssistantPreviewSymbol.reset( new QgsMarkerSymbol() );
3295 
3296  if ( vectorLayer() )
3297  mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3298 
3299  connect( cboFont, &QFontComboBox::currentFontChanged, this, &QgsFontMarkerSymbolLayerWidget::setFontFamily );
3300  connect( mFontStyleComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3301  connect( spinSize, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFontMarkerSymbolLayerWidget::setSize );
3302  connect( cboJoinStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3305  connect( cboJoinStyle, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3306  connect( spinAngle, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFontMarkerSymbolLayerWidget::setAngle );
3307  connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3308  connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3310  connect( mCharLineEdit, &QLineEdit::textChanged, this, &QgsFontMarkerSymbolLayerWidget::setCharacterFromText );
3311 
3312  connect( this, &QgsSymbolLayerWidget::changed, this, &QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol );
3313 }
3314 
3316 {
3317  if ( layer->layerType() != QLatin1String( "FontMarker" ) )
3318  return;
3319 
3320  // layer type is correct, we can do the cast
3321  mLayer = static_cast<QgsFontMarkerSymbolLayer *>( layer );
3322 
3323  mRefFont.setFamily( mLayer->fontFamily() );
3324  mRefFont.setStyleName( QgsFontUtils::translateNamedStyle( mLayer->fontStyle() ) );
3325 
3326  mFontStyleComboBox->blockSignals( true );
3327  populateFontStyleComboBox();
3328  mFontStyleComboBox->blockSignals( false );
3329 
3330  // set values
3331  whileBlocking( cboFont )->setCurrentFont( mRefFont );
3332  whileBlocking( spinSize )->setValue( mLayer->size() );
3333  whileBlocking( btnColor )->setColor( mLayer->color() );
3334  whileBlocking( btnStrokeColor )->setColor( mLayer->strokeColor() );
3335  whileBlocking( mStrokeWidthSpinBox )->setValue( mLayer->strokeWidth() );
3336  whileBlocking( spinAngle )->setValue( mLayer->angle() );
3337 
3338  widgetChar->blockSignals( true );
3339  widgetChar->setFont( mRefFont );
3340  if ( mLayer->character().length() == 1 )
3341  {
3342  widgetChar->setCharacter( mLayer->character().at( 0 ) );
3343  }
3344  widgetChar->blockSignals( false );
3345  whileBlocking( mCharLineEdit )->setText( mLayer->character() );
3346  mCharPreview->setFont( mRefFont );
3347 
3348  //block
3349  whileBlocking( spinOffsetX )->setValue( mLayer->offset().x() );
3350  whileBlocking( spinOffsetY )->setValue( mLayer->offset().y() );
3351 
3352  mSizeUnitWidget->blockSignals( true );
3353  mSizeUnitWidget->setUnit( mLayer->sizeUnit() );
3354  mSizeUnitWidget->setMapUnitScale( mLayer->sizeMapUnitScale() );
3355  mSizeUnitWidget->blockSignals( false );
3356 
3357  mStrokeWidthUnitWidget->blockSignals( true );
3358  mStrokeWidthUnitWidget->setUnit( mLayer->strokeWidthUnit() );
3359  mStrokeWidthUnitWidget->setMapUnitScale( mLayer->strokeWidthMapUnitScale() );
3360  mStrokeWidthUnitWidget->blockSignals( false );
3361 
3362  mOffsetUnitWidget->blockSignals( true );
3363  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
3364  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
3365  mOffsetUnitWidget->blockSignals( false );
3366 
3367  whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
3368 
3369  //anchor points
3370  whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mLayer->horizontalAnchorPoint() );
3371  whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mLayer->verticalAnchorPoint() );
3372 
3385 
3386  updateAssistantSymbol();
3387 }
3388 
3390 {
3391  return mLayer;
3392 }
3393 
3395 {
3396  if ( mLayer )
3397  {
3398  mLayer->setFontFamily( font.family() );
3399  mRefFont.setFamily( font.family() );
3400  widgetChar->setFont( mRefFont );
3401  mCharPreview->setFont( mRefFont );
3402  populateFontStyleComboBox();
3403  emit changed();
3404  }
3405 }
3406 
3407 void QgsFontMarkerSymbolLayerWidget::setFontStyle( const QString &style )
3408 {
3409  if ( mLayer )
3410  {
3411  QgsFontUtils::updateFontViaStyle( mRefFont, style );
3413  widgetChar->setFont( mRefFont );
3414  mCharPreview->setFont( mRefFont );
3415  emit changed();
3416  }
3417 }
3418 
3419 void QgsFontMarkerSymbolLayerWidget::setColor( const QColor &color )
3420 {
3421  mLayer->setColor( color );
3422  emit changed();
3423 }
3424 
3426 {
3427  mLayer->setStrokeColor( color );
3428  emit changed();
3429 }
3430 
3432 {
3433  mLayer->setSize( size );
3434  //widgetChar->updateSize(size);
3435  emit changed();
3436 }
3437 
3439 {
3440  mLayer->setAngle( angle );
3441  emit changed();
3442 }
3443 
3445 {
3446  mCharPreview->setText( text );
3447 
3448  if ( text.isEmpty() )
3449  return;
3450 
3451  // take the last character of a string for a better experience when users cycle through several characters on their keyboard
3452  QString character = text;
3453  if ( text.contains( QRegularExpression( QStringLiteral( "^0x[0-9a-fA-F]{1,4}$" ) ) ) )
3454  {
3455  bool ok = false;
3456  unsigned int value = text.toUInt( &ok, 0 );
3457  if ( ok )
3458  {
3459  character = QChar( value );
3460  mCharPreview->setText( character );
3461  }
3462  }
3463 
3464  if ( character != mLayer->character() )
3465  {
3466  mLayer->setCharacter( character );
3467  if ( mLayer->character().length() == 1 )
3468  {
3469  whileBlocking( widgetChar )->setCharacter( mLayer->character().at( 0 ) );
3470  }
3471  else
3472  {
3474  }
3475  emit changed();
3476  }
3477 }
3478 
3480 {
3481  if ( mLayer->character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3482  {
3483  mCharLineEdit->insert( chr );
3484  return;
3485  }
3486 
3487  mLayer->setCharacter( chr );
3488  whileBlocking( mCharLineEdit )->setText( chr );
3489  mCharPreview->setText( chr );
3490  emit changed();
3491 }
3492 
3493 void QgsFontMarkerSymbolLayerWidget::setOffset()
3494 {
3495  mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3496  emit changed();
3497 }
3498 
3499 void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3500 {
3501  mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
3502  emit changed();
3503 }
3504 
3505 void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3506 {
3507  if ( mLayer )
3508  {
3509  mLayer->setSizeUnit( mSizeUnitWidget->unit() );
3510  mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3511  emit changed();
3512  }
3513 }
3514 
3515 void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3516 {
3517  if ( mLayer )
3518  {
3519  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3520  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3521  emit changed();
3522  }
3523 }
3524 
3525 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3526 {
3527  if ( mLayer )
3528  {
3529  mLayer->setStrokeWidthUnit( mSizeUnitWidget->unit() );
3530  mLayer->setStrokeWidthMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3531  emit changed();
3532  }
3533 }
3534 
3535 void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3536 {
3537  mFontStyleComboBox->clear();
3538  QStringList styles = mFontDB.styles( mRefFont.family() );
3539  const auto constStyles = styles;
3540  for ( const QString &style : constStyles )
3541  {
3542  mFontStyleComboBox->addItem( style );
3543  }
3544 
3545  QString targetStyle = mFontDB.styleString( mRefFont );
3546  if ( !styles.contains( targetStyle ) )
3547  {
3548  QFont f = QFont( mRefFont.family() );
3549  targetStyle = QFontInfo( f ).styleName();
3550  mRefFont.setStyleName( targetStyle );
3551  }
3552  int curIndx = 0;
3553  int stylIndx = mFontStyleComboBox->findText( targetStyle );
3554  if ( stylIndx > -1 )
3555  {
3556  curIndx = stylIndx;
3557  }
3558 
3559  mFontStyleComboBox->setCurrentIndex( curIndx );
3560 }
3561 
3562 void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged( int index )
3563 {
3564  Q_UNUSED( index );
3565  setFontStyle( mFontStyleComboBox->currentText() );
3566 }
3567 
3568 void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
3569 {
3570  if ( mLayer )
3571  {
3573  emit changed();
3574  }
3575 }
3576 
3577 void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
3578 {
3579  if ( mLayer )
3580  {
3582  emit changed();
3583  }
3584 }
3585 
3586 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged( double d )
3587 {
3588  if ( mLayer )
3589  {
3590  mLayer->setStrokeWidth( d );
3591  emit changed();
3592  }
3593 }
3594 
3595 void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3596 {
3597  for ( int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
3598  {
3599  mAssistantPreviewSymbol->deleteSymbolLayer( i );
3600  }
3601  mAssistantPreviewSymbol->appendSymbolLayer( mLayer->clone() );
3603  if ( ddSize )
3604  mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3605 }
3606 
3608 
3609 
3611  : QgsSymbolLayerWidget( parent, vl )
3612 {
3613  mLayer = nullptr;
3614 
3615  setupUi( this );
3616  connect( mDrawInsideCheckBox, &QCheckBox::stateChanged, this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3617  connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged, this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3618  connect( mClipPointsCheckBox, &QCheckBox::stateChanged, this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3619  connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged, this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3620 }
3621 
3623 {
3624  if ( layer->layerType() != QLatin1String( "CentroidFill" ) )
3625  return;
3626 
3627  // layer type is correct, we can do the cast
3628  mLayer = static_cast<QgsCentroidFillSymbolLayer *>( layer );
3629 
3630  // set values
3631  whileBlocking( mDrawInsideCheckBox )->setChecked( mLayer->pointOnSurface() );
3632  whileBlocking( mDrawAllPartsCheckBox )->setChecked( mLayer->pointOnAllParts() );
3633  whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
3634  whileBlocking( mClipOnCurrentPartOnlyCheckBox )->setChecked( mLayer->clipOnCurrentPartOnly() );
3635 }
3636 
3638 {
3639  return mLayer;
3640 }
3641 
3642 void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged( int state )
3643 {
3644  mLayer->setPointOnSurface( state == Qt::Checked );
3645  emit changed();
3646 }
3647 
3648 void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged( int state )
3649 {
3650  mLayer->setPointOnAllParts( state == Qt::Checked );
3651  emit changed();
3652 }
3653 
3654 void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged( int state )
3655 {
3656  mLayer->setClipPoints( state == Qt::Checked );
3657  emit changed();
3658 }
3659 
3660 void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged( int state )
3661 {
3662  mLayer->setClipOnCurrentPartOnly( state == Qt::Checked );
3663  emit changed();
3664 }
3665 
3667 
3669  : QgsSymbolLayerWidget( parent, vl )
3670 {
3671  mLayer = nullptr;
3672 
3673  setupUi( this );
3674 
3675  mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral( "/UI/lastRasterMarkerImageDir" ) );
3676 
3677  connect( mImageSourceLineEdit, &QgsImageSourceLineEdit::sourceChanged, this, &QgsRasterMarkerSymbolLayerWidget::imageSourceChanged );
3678  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
3679  connect( mRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3680  connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
3681  connect( mWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3682  connect( mHeightSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3683  connect( mLockAspectRatio, static_cast < void ( QgsRatioLockButton::* )( bool ) > ( &QgsRatioLockButton::lockChanged ), this, &QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio );
3684 
3689 
3690  mSpinOffsetX->setClearValue( 0.0 );
3691  mSpinOffsetY->setClearValue( 0.0 );
3692  mRotationSpinBox->setClearValue( 0.0 );
3693 
3694  connect( mSpinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3695  connect( mSpinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3696  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsRasterMarkerSymbolLayerWidget::setOpacity );
3697 
3698  connect( mHorizontalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3699  connect( mVerticalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3700 }
3701 
3703 {
3704  if ( !layer )
3705  {
3706  return;
3707  }
3708 
3709  if ( layer->layerType() != QLatin1String( "RasterMarker" ) )
3710  return;
3711 
3712  // layer type is correct, we can do the cast
3713  mLayer = static_cast<QgsRasterMarkerSymbolLayer *>( layer );
3714 
3715  // set values
3716  whileBlocking( mImageSourceLineEdit )->setSource( mLayer->path() );
3717 
3718  whileBlocking( mWidthSpinBox )->setValue( mLayer->size() );
3719  bool preservedAspectRatio = mLayer->preservedAspectRatio();
3720  mHeightSpinBox->blockSignals( true );
3721  if ( preservedAspectRatio )
3722  {
3723  mHeightSpinBox->setValue( mLayer->size() );
3724  }
3725  else
3726  {
3727  mHeightSpinBox->setValue( mLayer->size() * mLayer->fixedAspectRatio() );
3728  }
3729  mHeightSpinBox->setEnabled( mLayer->defaultAspectRatio() > 0.0 );
3730  mHeightSpinBox->blockSignals( false );
3731  whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
3732 
3733  whileBlocking( mRotationSpinBox )->setValue( mLayer->angle() );
3734  whileBlocking( mOpacityWidget )->setOpacity( mLayer->opacity() );
3735 
3736  whileBlocking( mSpinOffsetX )->setValue( mLayer->offset().x() );
3737  whileBlocking( mSpinOffsetY )->setValue( mLayer->offset().y() );
3738 
3739  mSizeUnitWidget->blockSignals( true );
3740  mSizeUnitWidget->setUnit( mLayer->sizeUnit() );
3741  mSizeUnitWidget->setMapUnitScale( mLayer->sizeMapUnitScale() );
3742  mSizeUnitWidget->blockSignals( false );
3743  mOffsetUnitWidget->blockSignals( true );
3744  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
3745  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
3746  mOffsetUnitWidget->blockSignals( false );
3747 
3748  //anchor points
3749  whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mLayer->horizontalAnchorPoint() );
3750  whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mLayer->verticalAnchorPoint() );
3751 
3760 
3761  updatePreviewImage();
3762 }
3763 
3765 {
3766  return mLayer;
3767 }
3768 
3770 {
3772  mImageSourceLineEdit->setMessageBar( context.messageBar() );
3773 }
3774 
3775 void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged( const QString &text )
3776 {
3777  mLayer->setPath( text );
3778  updatePreviewImage();
3779  emit changed();
3780 }
3781 
3782 void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
3783 {
3784  bool fitsInCache = false;
3785  QImage image = QgsApplication::imageCache()->pathAsImage( mLayer->path(), QSize( 150, 150 ), true, 1.0, fitsInCache );
3786  if ( image.isNull() )
3787  {
3788  mLabelImagePreview->setPixmap( QPixmap() );
3789  return;
3790  }
3791 
3792  QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3793  previewImage.fill( Qt::transparent );
3794  QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3795  QPainter p;
3796  p.begin( &previewImage );
3797  //draw a checkerboard background
3798  uchar pixDataRGB[] = { 150, 150, 150, 150,
3799  100, 100, 100, 150,
3800  100, 100, 100, 150,
3801  150, 150, 150, 150
3802  };
3803  QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3804  QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3805  QBrush checkerBrush;
3806  checkerBrush.setTexture( pix );
3807  p.fillRect( imageRect, checkerBrush );
3808 
3809  if ( mLayer->opacity() < 1.0 )
3810  {
3811  p.setOpacity( mLayer->opacity() );
3812  }
3813 
3814  p.drawImage( imageRect.left(), imageRect.top(), image );
3815  p.end();
3816  mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3817 }
3818 
3819 void QgsRasterMarkerSymbolLayerWidget::setWidth()
3820 {
3821  double defaultAspectRatio = mLayer->defaultAspectRatio();
3822  double fixedAspectRatio = 0.0;
3823  mHeightSpinBox->blockSignals( true );
3824  if ( defaultAspectRatio <= 0.0 )
3825  {
3826  mHeightSpinBox->setValue( mWidthSpinBox->value() );
3827  }
3828  else if ( mLockAspectRatio->locked() )
3829  {
3830  mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
3831  }
3832  else
3833  {
3834  fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3835  }
3836  mHeightSpinBox->blockSignals( false );
3837  mLayer->setSize( mWidthSpinBox->value() );
3838  mLayer->setFixedAspectRatio( fixedAspectRatio );
3839  emit changed();
3840 }
3841 
3842 void QgsRasterMarkerSymbolLayerWidget::setHeight()
3843 {
3844  double defaultAspectRatio = mLayer->defaultAspectRatio();
3845  double fixedAspectRatio = 0.0;
3846  mWidthSpinBox->blockSignals( true );
3847  if ( defaultAspectRatio <= 0.0 )
3848  {
3849  mWidthSpinBox->setValue( mHeightSpinBox->value() );
3850  }
3851  else if ( mLockAspectRatio->locked() )
3852  {
3853  mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
3854  }
3855  else
3856  {
3857  fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3858  }
3859  mWidthSpinBox->blockSignals( false );
3860  mLayer->setSize( mWidthSpinBox->value() );
3861  mLayer->setFixedAspectRatio( fixedAspectRatio );
3862  emit changed();
3863 }
3864 
3865 void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio( const bool locked )
3866 {
3867  double defaultAspectRatio = mLayer->defaultAspectRatio();
3868  if ( defaultAspectRatio <= 0.0 )
3869  {
3870  whileBlocking( mLockAspectRatio )->setLocked( true );
3871  }
3872  else if ( locked )
3873  {
3874  mLayer->setFixedAspectRatio( 0.0 );
3875  setWidth();
3876  }
3877  else
3878  {
3879  mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
3880  }
3881 }
3882 
3883 void QgsRasterMarkerSymbolLayerWidget::setAngle()
3884 {
3885  mLayer->setAngle( mRotationSpinBox->value() );
3886  emit changed();
3887 }
3888 
3889 void QgsRasterMarkerSymbolLayerWidget::setOpacity( double value )
3890 {
3891  mLayer->setOpacity( value );
3892  emit changed();
3893  updatePreviewImage();
3894 }
3895 
3896 void QgsRasterMarkerSymbolLayerWidget::setOffset()
3897 {
3898  mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
3899  emit changed();
3900 }
3901 
3902 void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3903 {
3904  if ( mLayer )
3905  {
3906  mLayer->setSizeUnit( mSizeUnitWidget->unit() );
3907  mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3908  emit changed();
3909  }
3910 }
3911 
3912 void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3913 {
3914  if ( mLayer )
3915  {
3916  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3917  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3918  emit changed();
3919  }
3920 }
3921 
3922 void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
3923 {
3924  if ( mLayer )
3925  {
3927  emit changed();
3928  }
3929 }
3930 
3931 void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
3932 {
3933  if ( mLayer )
3934  {
3936  emit changed();
3937  }
3938 }
3939 
3941 
3943  : QgsSymbolLayerWidget( parent, vl )
3944 {
3945  mLayer = nullptr;
3946  setupUi( this );
3947 
3948  mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral( "/UI/lastRasterMarkerImageDir" ) );
3949  connect( mImageSourceLineEdit, &QgsImageSourceLineEdit::sourceChanged, this, &QgsRasterFillSymbolLayerWidget::imageSourceChanged );
3950 
3951  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed );
3952  connect( mRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
3953  connect( mWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed );
3954  connect( mWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged );
3955 
3960 
3961  mSpinOffsetX->setClearValue( 0.0 );
3962  mSpinOffsetY->setClearValue( 0.0 );
3963  mRotationSpinBox->setClearValue( 0.0 );
3964 
3965  connect( cboCoordinateMode, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
3966  connect( mSpinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3967  connect( mSpinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3968  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsRasterFillSymbolLayerWidget::opacityChanged );
3969 }
3970 
3971 
3973 {
3974  if ( !layer )
3975  {
3976  return;
3977  }
3978 
3979  if ( layer->layerType() != QLatin1String( "RasterFill" ) )
3980  {
3981  return;
3982  }
3983 
3984  mLayer = dynamic_cast<QgsRasterFillSymbolLayer *>( layer );
3985  if ( !mLayer )
3986  {
3987  return;
3988  }
3989 
3990  whileBlocking( mImageSourceLineEdit )->setSource( mLayer->imageFilePath() );
3991 
3992  cboCoordinateMode->blockSignals( true );
3993  switch ( mLayer->coordinateMode() )
3994  {
3996  cboCoordinateMode->setCurrentIndex( 1 );
3997  break;
3999  default:
4000  cboCoordinateMode->setCurrentIndex( 0 );
4001  break;
4002  }
4003  cboCoordinateMode->blockSignals( false );
4004  whileBlocking( mOpacityWidget )->setOpacity( mLayer->opacity() );
4005  whileBlocking( mRotationSpinBox )->setValue( mLayer->angle() );
4006 
4007  whileBlocking( mSpinOffsetX )->setValue( mLayer->offset().x() );
4008  whileBlocking( mSpinOffsetY )->setValue( mLayer->offset().y() );
4009  mOffsetUnitWidget->blockSignals( true );
4010  mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
4011  mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
4012  mOffsetUnitWidget->blockSignals( false );
4013 
4014  whileBlocking( mWidthSpinBox )->setValue( mLayer->width() );
4015  mWidthUnitWidget->blockSignals( true );
4016  mWidthUnitWidget->setUnit( mLayer->widthUnit() );
4017  mWidthUnitWidget->setMapUnitScale( mLayer->widthMapUnitScale() );
4018  mWidthUnitWidget->blockSignals( false );
4019 
4020  updatePreviewImage();
4021 
4027 }
4028 
4030 {
4031  return mLayer;
4032 }
4033 
4034 void QgsRasterFillSymbolLayerWidget::imageSourceChanged( const QString &text )
4035 {
4036  mLayer->setImageFilePath( text );
4037  updatePreviewImage();
4038  emit changed();
4039 }
4040 
4041 void QgsRasterFillSymbolLayerWidget::setCoordinateMode( int index )
4042 {
4043  switch ( index )
4044  {
4045  case 0:
4046  //feature coordinate mode
4048  break;
4049  case 1:
4050  //viewport coordinate mode
4052  break;
4053  }
4054 
4055  emit changed();
4056 }
4057 
4058 void QgsRasterFillSymbolLayerWidget::opacityChanged( double value )
4059 {
4060  if ( !mLayer )
4061  {
4062  return;
4063  }
4064 
4065  mLayer->setOpacity( value );
4066  emit changed();
4067  updatePreviewImage();
4068 }
4069 
4070 void QgsRasterFillSymbolLayerWidget::offsetChanged()
4071 {
4072  mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4073  emit changed();
4074 }
4075 
4076 void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4077 {
4078  if ( !mLayer )
4079  {
4080  return;
4081  }
4082  mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4083  mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4084  emit changed();
4085 }
4086 
4087 void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged( double d )
4088 {
4089  if ( mLayer )
4090  {
4091  mLayer->setAngle( d );
4092  emit changed();
4093  }
4094 }
4095 
4096 void QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed()
4097 {
4098  if ( !mLayer )
4099  {
4100  return;
4101  }
4102  mLayer->setWidthUnit( mWidthUnitWidget->unit() );
4103  mLayer->setWidthMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4104  emit changed();
4105 }
4106 
4107 void QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged( double d )
4108 {
4109  if ( !mLayer )
4110  {
4111  return;
4112  }
4113  mLayer->setWidth( d );
4114  emit changed();
4115 }
4116 
4117 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4118 {
4119  bool fitsInCache = false;
4120  QImage image = QgsApplication::imageCache()->pathAsImage( mLayer->imageFilePath(), QSize( 150, 150 ), true, 1.0, fitsInCache );
4121  if ( image.isNull() )
4122  {
4123  mLabelImagePreview->setPixmap( QPixmap() );
4124  return;
4125  }
4126 
4127  QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4128  previewImage.fill( Qt::transparent );
4129  QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4130  QPainter p;
4131  p.begin( &previewImage );
4132  //draw a checkerboard background
4133  uchar pixDataRGB[] = { 150, 150, 150, 150,
4134  100, 100, 100, 150,
4135  100, 100, 100, 150,
4136  150, 150, 150, 150
4137  };
4138  QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4139  QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4140  QBrush checkerBrush;
4141  checkerBrush.setTexture( pix );
4142  p.fillRect( imageRect, checkerBrush );
4143 
4144  if ( mLayer->opacity() < 1.0 )
4145  {
4146  p.setOpacity( mLayer->opacity() );
4147  }
4148 
4149  p.drawImage( imageRect.left(), imageRect.top(), image );
4150  p.end();
4151  mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4152 }
4153 
4154 
4156  : QgsSymbolLayerWidget( parent, vl )
4157 
4158 {
4159  setupUi( this );
4160  modificationExpressionSelector->setMultiLine( true );
4161  modificationExpressionSelector->setLayer( const_cast<QgsVectorLayer *>( vl ) );
4162  modificationExpressionSelector->registerExpressionContextGenerator( this );
4163  cbxGeometryType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPolygonLayer.svg" ) ), tr( "Polygon / MultiPolygon" ), QgsSymbol::Fill );
4164  cbxGeometryType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconLineLayer.svg" ) ), tr( "LineString / MultiLineString" ), QgsSymbol::Line );
4165  cbxGeometryType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPointLayer.svg" ) ), tr( "Point / MultiPoint" ), QgsSymbol::Marker );
4166  connect( modificationExpressionSelector, &QgsExpressionLineEdit::expressionChanged, this, &QgsGeometryGeneratorSymbolLayerWidget::updateExpression );
4167  connect( cbxGeometryType, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
4168 }
4169 
4171 {
4172  mLayer = static_cast<QgsGeometryGeneratorSymbolLayer *>( l );
4173  modificationExpressionSelector->setExpression( mLayer->geometryExpression() );
4174  cbxGeometryType->setCurrentIndex( cbxGeometryType->findData( mLayer->symbolType() ) );
4175 }
4176 
4178 {
4179  return mLayer;
4180 }
4181 
4182 void QgsGeometryGeneratorSymbolLayerWidget::updateExpression( const QString &string )
4183 {
4184  mLayer->setGeometryExpression( string );
4185 
4186  emit changed();
4187 }
4188 
4189 void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
4190 {
4191  mLayer->setSymbolType( static_cast<QgsSymbol::SymbolType>( cbxGeometryType->currentData().toInt() ) );
4192 
4193  emit symbolChanged();
4194 }
4195 
4196 //
4197 // QgsRandomMarkerFillSymbolLayerWidget
4198 //
4199 
4200 
4202  QgsSymbolLayerWidget( parent, vl )
4203 {
4204  setupUi( this );
4205 
4206  mCountMethodComboBox->addItem( tr( "Absolute Count" ), QgsRandomMarkerFillSymbolLayer::AbsoluteCount );
4207  mCountMethodComboBox->addItem( tr( "Density-based Count" ), QgsRandomMarkerFillSymbolLayer::DensityBasedCount );
4208 
4209  mPointCountSpinBox->setShowClearButton( true );
4210  mPointCountSpinBox->setClearValue( 100 );
4211  mSeedSpinBox->setShowClearButton( true );
4212  mSeedSpinBox->setClearValue( 0 );
4213 
4214  connect( mCountMethodComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
4215  connect( mPointCountSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
4216  connect( mDensityAreaSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
4217  connect( mSeedSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
4218  connect( mClipPointsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
4219  {
4220  if ( mLayer )
4221  {
4222  mLayer->setClipPoints( checked );
4223  emit changed();
4224  }
4225  } );
4226 
4229 
4230  connect( mDensityAreaUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged );
4231 }
4232 
4234 {
4235  if ( !layer || layer->layerType() != QLatin1String( "RandomMarkerFill" ) )
4236  {
4237  return;
4238  }
4239 
4240  mLayer = static_cast<QgsRandomMarkerFillSymbolLayer *>( layer );
4241  whileBlocking( mPointCountSpinBox )->setValue( mLayer->pointCount() );
4242  whileBlocking( mSeedSpinBox )->setValue( mLayer->seed() );
4243  whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
4244 
4245  bool showDensityBasedCountWidgets = false;
4246  switch ( mLayer->countMethod() )
4247  {
4249  showDensityBasedCountWidgets = true;
4250  break;
4252  break;
4253  }
4254  mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4255  mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4256  mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4257  mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4258 
4259  whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData( mLayer->countMethod() ) );
4260  whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
4261  mDensityAreaUnitWidget->blockSignals( true );
4262  mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
4263  mDensityAreaUnitWidget->setMapUnitScale( mLayer->densityAreaUnitScale() );
4264  mDensityAreaUnitWidget->blockSignals( false );
4265 
4270 }
4271 
4273 {
4274  return mLayer;
4275 }
4276 
4277 void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged( int )
4278 {
4279 
4280  bool showDensityBasedCountWidgets = false;
4281  switch ( static_cast< QgsRandomMarkerFillSymbolLayer::CountMethod >( mCountMethodComboBox->currentData().toInt() ) )
4282  {
4284  showDensityBasedCountWidgets = true;
4285  break;
4287  break;
4288  }
4289  mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4290  mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4291  mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4292  mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4293 
4294  if ( mLayer )
4295  {
4296  mLayer->setCountMethod( static_cast< QgsRandomMarkerFillSymbolLayer::CountMethod >( mCountMethodComboBox->currentData().toInt() ) );
4297  emit changed();
4298  }
4299 }
4300 
4301 void QgsRandomMarkerFillSymbolLayerWidget::countChanged( int d )
4302 {
4303  if ( mLayer )
4304  {
4305  mLayer->setPointCount( d );
4306  emit changed();
4307  }
4308 }
4309 
4310 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged( double d )
4311 {
4312  if ( mLayer )
4313  {
4314  mLayer->setDensityArea( d );
4315  emit changed();
4316  }
4317 }
4318 
4319 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
4320 {
4321  if ( mLayer )
4322  {
4323  mLayer->setDensityAreaUnit( mDensityAreaUnitWidget->unit() );
4324  mLayer->setDensityAreaUnitScale( mDensityAreaUnitWidget->getMapUnitScale() );
4325  emit changed();
4326  }
4327 }
4328 
4329 void QgsRandomMarkerFillSymbolLayerWidget::seedChanged( int d )
4330 {
4331  if ( mLayer )
4332  {
4333  mLayer->setSeed( d );
4334  emit changed();
4335  }
4336 }
QgsFilledMarkerSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:1085
QgsCentroidFillSymbolLayer::pointOnAllParts
bool pointOnAllParts() const
Returns whether a point is drawn for all parts or only on the biggest part of multi-part features.
Definition: qgsfillsymbollayer.h:2060
QgsSymbolLayer::PropertyDashPatternOffset
@ PropertyDashPatternOffset
Dash pattern offset.
Definition: qgssymbollayer.h:191
QgsLinePatternFillSymbolLayer::setMapUnitScale
void setMapUnitScale(const QgsMapUnitScale &scale) override
Definition: qgsfillsymbollayer.cpp:2458
CharacterWidget::setFont
void setFont(const QFont &font)
Sets the font to show in the widget.
Definition: characterwidget.cpp:66
QgsSymbolWidgetContext::globalProjectAtlasMapLayerScopes
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
Definition: qgssymbolwidgetcontext.cpp:92
QgsSVGFillSymbolLayer::setSvgStrokeColor
void setSvgStrokeColor(const QColor &c)
Sets the stroke color used for rendering the SVG content.
Definition: qgsfillsymbollayer.h:1138
QgsSimpleFillSymbolLayer::strokeColor
QColor strokeColor() const override
Gets stroke color.
Definition: qgsfillsymbollayer.h:81
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:370
QgsGradientFillSymbolLayer::gradientType
GradientType gradientType() const
Type of gradient, e.g., linear or radial.
Definition: qgsfillsymbollayer.h:270
QgsOpacityWidget::opacityChanged
void opacityChanged(double opacity)
Emitted when the opacity is changed in the widget, where opacity ranges from 0.0 (transparent) to 1....
QgsPointPatternFillSymbolLayer
Definition: qgsfillsymbollayer.h:1540
QgsSymbolLayer::PropertyHorizontalAnchor
@ PropertyHorizontalAnchor
Horizontal anchor point.
Definition: qgssymbollayer.h:174
QgsSimpleFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:962
CharacterWidget::clearCharacter
void clearCharacter()
Clears the currently selected character in the widget.
Definition: characterwidget.cpp:131
QgsColorRamp
Abstract base class for color ramps.
Definition: qgscolorramp.h:32
qgsexpressioncontextutils.h
QgsRasterMarkerSymbolLayer::defaultAspectRatio
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
Definition: qgsmarkersymbollayer.h:725
QgsPointPatternFillSymbolLayer::displacementY
double displacementY() const
Definition: qgsfillsymbollayer.h:1577
QgsSymbolWidgetContext::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:54
QgsShapeburstFillSymbolLayerWidget::mLayer
QgsShapeburstFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:442
QgsGradientFillSymbolLayer::setReferencePoint2
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
Definition: qgsfillsymbollayer.h:315
qgssymbollayerwidget.h
QgsMarkerSymbolLayer::setSizeUnit
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's size.
Definition: qgssymbollayer.h:670
QgsRandomMarkerFillSymbolLayer::setDensityAreaUnitScale
void setDensityAreaUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the density area.
Definition: qgsfillsymbollayer.h:1954
QgsSimpleLineSymbolLayer::setAlignDashPattern
void setAlignDashPattern(bool enabled)
Sets whether dash patterns should be aligned to the start and end of lines, by applying subtle tweaks...
Definition: qgslinesymbollayer.cpp:994
qgssvgcache.h
QgsSVGFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:2800
QgsShapeburstFillSymbolLayer::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsfillsymbollayer.h:659
QgsRasterFillSymbolLayer::setWidthUnit
void setWidthUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units for the image's width.
Definition: qgsfillsymbollayer.h:967
QgsUnitTypes::RenderInches
@ RenderInches
Inches.
Definition: qgsunittypes.h:173
QgsPointPatternFillSymbolLayer::setOffsetYMapUnitScale
void setOffsetYMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the vertical offset for rows in the pattern.
Definition: qgsfillsymbollayer.h:1747
QgsLineSymbolLayer::setWidthUnit
void setWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line's width.
Definition: qgssymbollayer.h:1041
QgsRasterMarkerSymbolLayerWidget::QgsRasterMarkerSymbolLayerWidget
QgsRasterMarkerSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsRasterMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:3668
QgsSimpleLineSymbolLayer::dashPatternOffsetMapUnitScale
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale the dash pattern offset value.
Definition: qgslinesymbollayer.h:256
QgsSymbolLayer::PropertyBlurRadius
@ PropertyBlurRadius
Shapeburst blur radius.
Definition: qgssymbollayer.h:158
QgsGradientFillSymbolLayer::offset
QPointF offset() const
Returns the offset by which polygons will be translated during rendering.
Definition: qgsfillsymbollayer.h:340
QgsShapeburstFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:1603
QgsMarkerSymbolLayer::setHorizontalAnchorPoint
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
Definition: qgssymbollayer.h:770
QgsSimpleLineSymbolLayer::dashPatternOffset
double dashPatternOffset() const
Returns the dash pattern offset, which dictates how far along the dash pattern the pattern should sta...
Definition: qgslinesymbollayer.h:209
QgsMarkerSymbolLayer::VerticalAnchorPoint
VerticalAnchorPoint
Symbol vertical anchor points.
Definition: qgssymbollayer.h:595
QgsTemplatedLineSymbolLayerBase::setOffsetAlongLine
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the symbol placement.
Definition: qgslinesymbollayer.h:501
QgsLineSymbolLayer::RenderRingFilter
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon's rings.
Definition: qgssymbollayer.h:906
QgsSymbolLayer::PropertyLineDistance
@ PropertyLineDistance
Distance between lines, or length of lines for hash line symbols.
Definition: qgssymbollayer.h:148
QgsSvgMarkerSymbolLayerWidget::setSvgPath
void setSvgPath(const QString &name)
Sets the SVG path.
Definition: qgssymbollayerwidget.cpp:2539
QgsLinePatternFillSymbolLayerWidget::QgsLinePatternFillSymbolLayerWidget
QgsLinePatternFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsLinePatternFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:2949
QgsSymbolLayer::PropertyShapeburstUseWholeShape
@ PropertyShapeburstUseWholeShape
Shapeburst use whole shape.
Definition: qgssymbollayer.h:159
QgsMarkerLineSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:1935
QgsFilledMarkerSymbolLayer
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
Definition: qgsmarkersymbollayer.h:427
QgsSimpleFillSymbolLayer::strokeWidthMapUnitScale
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Definition: qgsfillsymbollayer.h:130
QgsTemplatedLineSymbolLayerBase::averageAngleMapUnitScale
const QgsMapUnitScale & averageAngleMapUnitScale() const
Returns the map unit scale for the length over which the line's direction is averaged when calculatin...
Definition: qgslinesymbollayer.h:593
QgsSimpleMarkerSymbolLayer::setStrokeWidthMapUnitScale
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the width of the marker's stroke.
Definition: qgsmarkersymbollayer.h:354
QgsSymbolLayerWidget::vectorLayer
const QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
Definition: qgssymbollayerwidget.h:72
QgsMarkerSymbolLayer::size
double size() const
Returns the symbol size.
Definition: qgssymbollayer.h:661
QgsSymbolLayer::dataDefinedProperties
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
Definition: qgssymbollayer.h:486
QgsGradientFillSymbolLayer::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
Definition: qgsfillsymbollayer.h:354
QgsProperty
A store for object properties.
Definition: qgsproperty.h:232
QgsFontMarkerSymbolLayer::strokeColor
QColor strokeColor() const override
Gets stroke color.
Definition: qgsmarkersymbollayer.h:887
QgsSymbolLayer::PropertyClipPoints
@ PropertyClipPoints
Whether markers should be clipped to polygon boundaries.
Definition: qgssymbollayer.h:187
QgsSymbolLayer::PropertyGradientReference2IsCentroid
@ PropertyGradientReference2IsCentroid
Gradient reference point 2 is centroid.
Definition: qgssymbollayer.h:157
QgsApplication::getThemeIcon
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
Definition: qgsapplication.cpp:626
QgsHashedLineSymbolLayer::setHashLengthUnit
void setHashLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the length of hash symbols.
Definition: qgslinesymbollayer.h:854
QgsRasterFillSymbolLayer::opacity
double opacity() const
Returns the opacity for the raster image used in the fill.
Definition: qgsfillsymbollayer.h:884
QgsRasterMarkerSymbolLayer::opacity
double opacity() const
Returns the marker opacity.
Definition: qgsmarkersymbollayer.h:712
QgsSimpleMarkerSymbolLayer::strokeStyle
Qt::PenStyle strokeStyle() const
Returns the marker's stroke style (e.g., solid, dashed, etc)
Definition: qgsmarkersymbollayer.h:282
QgsFontMarkerSymbolLayer::setStrokeWidth
void setStrokeWidth(double width)
Set's the marker's stroke width.
Definition: qgsmarkersymbollayer.h:910
QgsRasterFillSymbolLayer::Feature
@ Feature
Tiling is based on feature bounding box.
Definition: qgsfillsymbollayer.h:806
QgsSimpleMarkerSymbolLayer::penJoinStyle
Qt::PenJoinStyle penJoinStyle() const
Returns the marker's stroke join style (e.g., miter, bevel, etc).
Definition: qgsmarkersymbollayer.h:301
QgsSymbolLayerWidget::changed
void changed()
Should be emitted whenever configuration changes happened on this symbol layer configuration.
QgsLineSymbolLayer::widthMapUnitScale
const QgsMapUnitScale & widthMapUnitScale() const
Definition: qgssymbollayer.h:1050
QgsSimpleLineSymbolLayer::penCapStyle
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
Definition: qgslinesymbollayer.h:120
QgsLinePatternFillSymbolLayer::setOffsetUnit
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line pattern's offset.
Definition: qgsfillsymbollayer.h:1468
QgsSymbolLayer::PropertyAverageAngleLength
@ PropertyAverageAngleLength
Length to average symbol angles over.
Definition: qgssymbollayer.h:173
QgsGeometryGeneratorSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:4170
QgsSVGFillSymbolLayer::svgStrokeWidth
double svgStrokeWidth() const
Returns the stroke width used for rendering the SVG content.
Definition: qgsfillsymbollayer.h:1172
QgsGradientFillSymbolLayer::setCoordinateMode
void setCoordinateMode(GradientCoordinateMode coordinateMode)
Definition: qgsfillsymbollayer.h:300
QgsRasterMarkerSymbolLayerWidget::setContext
void setContext(const QgsSymbolWidgetContext &context) override
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Definition: qgssymbollayerwidget.cpp:3769
QgsExpressionContext::EXPR_ORIGINAL_VALUE
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
Definition: qgsexpressioncontext.h:721
QgsLineSymbolLayer::setRingFilter
void setRingFilter(QgsLineSymbolLayer::RenderRingFilter filter)
Sets the line symbol layer's ring filter, which controls which rings are rendered when the line symbo...
Definition: qgssymbollayer.cpp:437
QgsLinePatternFillSymbolLayer::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the pattern's line offset.
Definition: qgsfillsymbollayer.h:1493
QgsSVGFillSymbolLayer::setSvgFillColor
void setSvgFillColor(const QColor &c)
Sets the fill color used for rendering the SVG content.
Definition: qgsfillsymbollayer.h:1117
QgsSimpleFillSymbolLayer::setStrokeWidthUnit
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the width of the fill's stroke.
Definition: qgsfillsymbollayer.h:121
QgsRandomMarkerFillSymbolLayer::densityAreaUnitScale
const QgsMapUnitScale & densityAreaUnitScale() const
Returns the map scale for the density area.
Definition: qgsfillsymbollayer.h:1962
QgsCentroidFillSymbolLayerWidget::mLayer
QgsCentroidFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:1082
QgsLineSymbolLayer::width
virtual double width() const
Returns the estimated width for the line symbol layer.
Definition: qgssymbollayer.h:965
QgsSimpleMarkerSymbolLayer::strokeWidthMapUnitScale
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the map scale for the width of the marker's stroke.
Definition: qgsmarkersymbollayer.h:362
QgsRandomMarkerFillSymbolLayer::CountMethod
CountMethod
Methods to define the number of points randomly filling the polygon.
Definition: qgsfillsymbollayer.h:1816
qgsmapcanvas.h
QgsShapeburstFillSymbolLayer::setIgnoreRings
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading.
Definition: qgsfillsymbollayer.h:613
QgsExpressionContextScope::addVariable
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Definition: qgsexpressioncontext.cpp:93
QgsRasterFillSymbolLayer::setWidthMapUnitScale
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width.
Definition: qgsfillsymbollayer.h:985
QgsTemplatedLineSymbolLayerBase::offsetAlongLineUnit
QgsUnitTypes::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for symbols.
Definition: qgslinesymbollayer.h:509
QgsSymbolLayerWidget::symbolLayer
virtual QgsSymbolLayer * symbolLayer()=0
QgsPointPatternFillSymbolLayer::setDistanceYMapUnitScale
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsfillsymbollayer.h:1650
QgsPropertyOverrideButton::changed
void changed()
Emitted when property definition changes.
QgsSVGFillSymbolLayerWidget::updateParamGui
void updateParamGui(bool resetValues=true)
Enables or disables svg fill color, stroke color and stroke width based on whether the svg file suppo...
Definition: qgssymbollayerwidget.cpp:2851
QgsPanelWidget::findParentPanel
static QgsPanelWidget * findParentPanel(QWidget *widget)
Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
Definition: qgspanelwidget.cpp:49
QgsGradientFillSymbolLayer
Definition: qgsfillsymbollayer.h:205
QgsFontMarkerSymbolLayer::character
QString character() const
Returns the character(s) used when rendering points.
Definition: qgsmarkersymbollayer.h:878
QgsGradientFillSymbolLayer::gradientColorType
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
Definition: qgsfillsymbollayer.h:274
QgsHashedLineSymbolLayer
Line symbol layer type which draws repeating line sections along a line feature.
Definition: qgslinesymbollayer.h:783
QgsSVGFillSymbolLayer::svgStrokeWidthUnit
QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const
Returns the units for the stroke width.
Definition: qgsfillsymbollayer.h:1226
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
QgsSimpleLineSymbolLayer::setMapUnitScale
void setMapUnitScale(const QgsMapUnitScale &scale) override
Definition: qgslinesymbollayer.cpp:63
QgsSimpleFillSymbolLayer::strokeWidthUnit
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the width of the fill's stroke.
Definition: qgsfillsymbollayer.h:127
QgsLinePatternFillSymbolLayer::distance
double distance() const
Returns the distance between lines in the fill pattern.
Definition: qgsfillsymbollayer.h:1350
QgsSimpleLineSymbolLayer::setCustomDashPatternMapUnitScale
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for lengths used in the custom dash pattern.
Definition: qgslinesymbollayer.h:167
CharacterWidget
A widget for displaying characters available in a preset font, and allowing users to select an indivi...
Definition: characterwidget.h:70
QgsSimpleLineSymbolLayer::setPenJoinStyle
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
Definition: qgslinesymbollayer.h:113
QgsPointPatternFillSymbolLayer::offsetYUnit
QgsUnitTypes::RenderUnit offsetYUnit() const
Returns the units for the vertical offset for rows in the pattern.
Definition: qgsfillsymbollayer.h:1738
QgsSymbolLayer::PropertyFontFamily
@ PropertyFontFamily
Font family.
Definition: qgssymbollayer.h:189
QgsSimpleFillSymbolLayer::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
Definition: qgsfillsymbollayer.h:151
QgsSymbolLayer::setColor
virtual void setColor(const QColor &color)
The fill color.
Definition: qgssymbollayer.h:232
QgsSymbolLayer::PropertyFillStyle
@ PropertyFillStyle
Fill style (eg solid, dots)
Definition: qgssymbollayer.h:144
QgsSymbolLayer::PropertyGradientReference2Y
@ PropertyGradientReference2Y
Gradient reference point 2 y.
Definition: qgssymbollayer.h:155
QgsShapeburstFillSymbolLayer::setColor2
void setColor2(const QColor &color2)
Sets the color for the endpoint of the shapeburst fill.
Definition: qgsfillsymbollayer.h:595
QgsSimpleFillSymbolLayer::offset
QPointF offset()
Returns the offset by which polygons will be translated during rendering.
Definition: qgsfillsymbollayer.h:114
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
QgsSimpleLineSymbolLayer::penJoinStyle
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
Definition: qgslinesymbollayer.h:106
QgsSymbolLayer::color
virtual QColor color() const
The fill color.
Definition: qgssymbollayer.h:227
QgsSymbolLayer::PropertyFillColor
@ PropertyFillColor
Fill color.
Definition: qgssymbollayer.h:135
QgsLinePatternFillSymbolLayer::lineAngle
double lineAngle() const
Returns the angle for the parallel lines used to fill the symbol.
Definition: qgsfillsymbollayer.h:1335
QgsLineSymbolLayer::setWidth
virtual void setWidth(double width)
Sets the width of the line symbol layer.
Definition: qgssymbollayer.h:954
QgsUnitTypes::RenderPoints
@ RenderPoints
Points (e.g., for font sizes)
Definition: qgsunittypes.h:172
QgsExpressionContext::lastScope
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
Definition: qgsexpressioncontext.cpp:373
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
QgsShapeburstFillSymbolLayer::setMaxDistance
void setMaxDistance(double maxDistance)
Sets the maximum distance to shape inside of the shape from the polygon's boundary.
Definition: qgsfillsymbollayer.h:511
QgsMarkerSymbolLayer::setAngle
void setAngle(double angle)
Sets the rotation angle for the marker.
Definition: qgssymbollayer.h:627
QgsSymbolLayerWidget
Definition: qgssymbollayerwidget.h:35
QgsSimpleLineSymbolLayer::tweakDashPatternOnCorners
bool tweakDashPatternOnCorners() const
Returns true if dash patterns tweaks should be applied on sharp corners, to ensure that a double-leng...
Definition: qgslinesymbollayer.cpp:999
QgsSymbolWidgetContext
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Definition: qgssymbolwidgetcontext.h:36
QgsSimpleFillSymbolLayer::setBrushStyle
void setBrushStyle(Qt::BrushStyle style)
Definition: qgsfillsymbollayer.h:79
characterwidget.h
QgsSvgMarkerSymbolLayer::setPath
void setPath(const QString &path)
Set the marker SVG path.
Definition: qgsmarkersymbollayer.cpp:1867
QgsPanelWidget::openPanel
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
Definition: qgspanelwidget.cpp:79
QgsSymbolLayer::PropertyGradientReference1IsCentroid
@ PropertyGradientReference1IsCentroid
Gradient reference point 1 is centroid.
Definition: qgssymbollayer.h:156
QgsRasterFillSymbolLayer::setOpacity
void setOpacity(double opacity)
Sets the opacity for the raster image used in the fill.
Definition: qgsfillsymbollayer.cpp:4182
QgsFilledMarkerSymbolLayerWidget::mLayer
QgsFilledMarkerSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:328
QgsLinePatternFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:2966
qgsmarkersymbollayer.h
QgsSvgMarkerSymbolLayer::fixedAspectRatio
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
Definition: qgsmarkersymbollayer.h:564
QgsHashedLineSymbolLayer::setHashLengthMapUnitScale
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
Definition: qgslinesymbollayer.h:869
QgsSVGFillSymbolLayer::svgFillColor
QColor svgFillColor() const
Returns the fill color used for rendering the SVG content.
Definition: qgsfillsymbollayer.h:1127
QgsUnitTypes::RenderPercentage
@ RenderPercentage
Percentage of another measurement (e.g., canvas size, feature size)
Definition: qgsunittypes.h:171
QgsSymbolLayer::PropertyDisplacementX
@ PropertyDisplacementX
Horizontal displacement.
Definition: qgssymbollayer.h:165
QgsSVGFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:2748
QgsGradientFillSymbolLayer::Conical
@ Conical
Definition: qgsfillsymbollayer.h:218
qgsnewauxiliaryfielddialog.h
QgsLineSymbolLayer::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line's offset.
Definition: qgssymbollayer.h:1015
QgsTemplatedLineSymbolLayerBase::Vertex
@ Vertex
Place symbols on every vertex in the line.
Definition: qgslinesymbollayer.h:390
QgsGeometryGeneratorSymbolLayer::setSymbolType
void setSymbolType(QgsSymbol::SymbolType symbolType)
Set the type of symbol which should be created.
Definition: qgsgeometrygeneratorsymbollayer.cpp:60
QgsRasterFillSymbolLayer
A class for filling symbols with a repeated raster image.
Definition: qgsfillsymbollayer.h:800
QgsSimpleLineSymbolLayer::drawInsidePolygon
bool drawInsidePolygon() const
Returns true if the line should only be drawn inside polygons, and any portion of the line which fall...
Definition: qgslinesymbollayer.h:278
QgsGeometryGeneratorSymbolLayer::geometryExpression
QString geometryExpression() const
Gets the expression to generate this geometry.
Definition: qgsgeometrygeneratorsymbollayer.h:70
QgsRasterFillSymbolLayer::setOffset
void setOffset(QPointF offset)
Sets the offset for the fill.
Definition: qgsfillsymbollayer.h:893
QgsRasterMarkerSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:3764
QgsFontMarkerSymbolLayerWidget::setAngle
void setAngle(double angle)
Definition: qgssymbollayerwidget.cpp:3438
QgsSimpleMarkerSymbolLayer::setColor
void setColor(const QColor &color) override
The fill color.
Definition: qgsmarkersymbollayer.cpp:1518
QgsHashedLineSymbolLayer::hashLength
double hashLength() const
Returns the length of hash symbols.
Definition: qgslinesymbollayer.h:840
QgsLinePatternFillSymbolLayer::offset
double offset() const
Returns the offset distance for lines within the fill, which is the distance to offset the parallel l...
Definition: qgsfillsymbollayer.h:1395
QgsHashedLineSymbolLayer::hashAngle
double hashAngle() const
Returns the angle to use when drawing the hashed lines sections, in degrees clockwise.
Definition: qgslinesymbollayer.cpp:2619
QgsSimpleMarkerSymbolLayer::setStrokeStyle
void setStrokeStyle(Qt::PenStyle strokeStyle)
Sets the marker's stroke style (e.g., solid, dashed, etc)
Definition: qgsmarkersymbollayer.h:292
QgsSimpleLineSymbolLayer::useCustomDashPattern
bool useCustomDashPattern() const
Returns true if the line uses a custom dash pattern.
Definition: qgslinesymbollayer.h:135
QgsPointPatternFillSymbolLayer::setOffsetX
void setOffsetX(double offset)
Sets the horizontal offset values for points in the pattern.
Definition: qgsfillsymbollayer.h:1587
QgsDashSpaceWidget::dashDotVector
QVector< qreal > dashDotVector() const
Returns the dash pattern as a list of numbers.
Definition: qgsdashspacedialog.cpp:70
QgsVectorLayer::auxiliaryLayer
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
Definition: qgsvectorlayer.cpp:5293
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:168
QgsPropertyOverrideButton::createAuxiliaryField
void createAuxiliaryField()
Emitted when creating a new auxiliary field.
QgsLinePatternFillSymbolLayer::setLineAngle
void setLineAngle(double a)
Sets the angle for the parallel lines used to fill the symbol.
Definition: qgsfillsymbollayer.h:1326
QgsPropertyOverrideButton::propertyKey
int propertyKey() const
Returns the property key linked to the button.
Definition: qgspropertyoverridebutton.h:123
QgsSimpleFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:910
QgsPointPatternFillSymbolLayer::offsetY
double offsetY() const
Returns the vertical offset values for points in the pattern.
Definition: qgsfillsymbollayer.h:1612
QgsCentroidFillSymbolLayer::setPointOnSurface
void setPointOnSurface(bool pointOnSurface)
Definition: qgsfillsymbollayer.h:2045
QgsSymbolLayer::PropertyInterval
@ PropertyInterval
Line marker interval.
Definition: qgssymbollayer.h:171
QgsFontMarkerSymbolLayer::setCharacter
void setCharacter(QString chr)
Sets the character(s) used when rendering points.
Definition: qgsmarkersymbollayer.h:885
QgsTemplatedLineSymbolLayerBase::placement
Placement placement() const
Returns the placement of the symbols.
Definition: qgslinesymbollayer.h:470
QgsRasterMarkerSymbolLayer::setOpacity
void setOpacity(double opacity)
Set the marker opacity.
Definition: qgsmarkersymbollayer.h:719
QgsShapeburstFillSymbolLayerWidget::setColor
void setColor(const QColor &color)
Definition: qgssymbollayerwidget.cpp:1701
QgsExpressionContext::EXPR_GEOMETRY_PART_NUM
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
Definition: qgsexpressioncontext.h:729
QgsSimpleLineSymbolLayer::setDashPatternOffsetUnit
void setDashPatternOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the dash pattern offset.
Definition: qgslinesymbollayer.h:234
QgsSymbolLayer::PropertyCapStyle
@ PropertyCapStyle
Line cap style.
Definition: qgssymbollayer.h:169
QgsGradientFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:1261
QgsRasterFillSymbolLayer::width
double width() const
Returns the width used for scaling the image used in the fill.
Definition: qgsfillsymbollayer.h:958
QgsFontMarkerSymbolLayer::setStrokeColor
void setStrokeColor(const QColor &color) override
Set stroke color.
Definition: qgsmarkersymbollayer.h:888
CharacterWidget::characterSelected
void characterSelected(QChar character)
Emitted when a character is selected in the widget.
QgsSimpleMarkerSymbolLayer::clone
QgsSimpleMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Definition: qgsmarkersymbollayer.cpp:1086
QgsSimpleLineSymbolLayer::setUseCustomDashPattern
void setUseCustomDashPattern(bool b)
Sets whether the line uses a custom dash pattern.
Definition: qgslinesymbollayer.h:143
QgsMarkerLineSymbolLayer
Line symbol layer type which draws repeating marker symbols along a line feature.
Definition: qgslinesymbollayer.h:694
qgsfontutils.h
QgsFontMarkerSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:3315
QgsTemplatedLineSymbolLayerBase::CurvePoint
@ CurvePoint
Place symbols at every virtual curve point in the line (used when rendering curved geometry types onl...
Definition: qgslinesymbollayer.h:394
QgsSymbolLayer::PropertyStrokeColor
@ PropertyStrokeColor
Stroke color.
Definition: qgssymbollayer.h:136
QgsPointPatternFillSymbolLayer::distanceXMapUnitScale
const QgsMapUnitScale & distanceXMapUnitScale() const
Definition: qgsfillsymbollayer.h:1633
QgsSvgMarkerSymbolLayer::setMapUnitScale
void setMapUnitScale(const QgsMapUnitScale &scale) override
Definition: qgsmarkersymbollayer.cpp:2258
QgsSVGFillSymbolLayer::patternWidth
double patternWidth() const
Returns the width of the rendered SVG content within the fill (i.e.
Definition: qgsfillsymbollayer.h:1106
QgsPointPatternFillSymbolLayer::setDistanceY
void setDistanceY(double d)
Definition: qgsfillsymbollayer.h:1572
QgsDashSpaceDialog
A dialog to enter a custom dash space pattern for lines.
Definition: qgsdashspacedialog.h:61
QgsGradientFillSymbolLayer::Feature
@ Feature
Definition: qgsfillsymbollayer.h:223
QgsExpressionContext::EXPR_SYMBOL_COLOR
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
Definition: qgsexpressioncontext.h:723
QgsSimpleLineSymbolLayer::customDashVector
QVector< qreal > customDashVector() const
Returns the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ...
Definition: qgslinesymbollayer.h:181
QgsRandomMarkerFillSymbolLayerWidget::QgsRandomMarkerFillSymbolLayerWidget
QgsRandomMarkerFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsRandomMarkerFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:4201
QgsSVGFillSymbolLayer::setPatternWidthUnit
void setPatternWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the width of the SVG images in the pattern.
Definition: qgsfillsymbollayer.h:1181
QgsLineSymbolLayer::setOffset
void setOffset(double offset)
Sets the line's offset.
Definition: qgssymbollayer.h:999
QgsGradientFillSymbolLayer::setGradientSpread
void setGradientSpread(GradientSpread gradientSpread)
Definition: qgsfillsymbollayer.h:304
QgsPanelWidget::dockMode
bool dockMode()
Returns the dock mode state.
Definition: qgspanelwidget.h:83
QgsFontMarkerSymbolLayer::setFontStyle
void setFontStyle(const QString &style)
Sets the font style for the font which will be used to render the point.
Definition: qgsmarkersymbollayer.h:871
QgsLinePatternFillSymbolLayer::setDistance
void setDistance(double d)
Sets the distance between lines in the fill pattern.
Definition: qgsfillsymbollayer.h:1343
QgsRandomMarkerFillSymbolLayer::AbsoluteCount
@ AbsoluteCount
The point count is used as an absolute count of markers.
Definition: qgsfillsymbollayer.h:1817
QgsTemplatedLineSymbolLayerBase::setPlacement
void setPlacement(Placement placement)
Sets the placement of the symbols.
Definition: qgslinesymbollayer.h:476
QgsSimpleFillSymbolLayer::setStrokeWidthMapUnitScale
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsfillsymbollayer.h:129
QgsWkbTypes::PolygonGeometry
@ PolygonGeometry
Definition: qgswkbtypes.h:144
QgsFontMarkerSymbolLayer::clone
QgsFontMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Definition: qgsmarkersymbollayer.cpp:3309
QgsLineSymbolLayer::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the line's offset.
Definition: qgssymbollayer.h:1023
QgsSvgCache::containsParams
void containsParams(const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasStrokeParam, QColor &defaultStrokeColor, bool &hasStrokeWidthParam, double &defaultStrokeWidth, bool blocking=false) const
Tests if an svg file contains parameters for fill, stroke color, stroke width.
Definition: qgssvgcache.cpp:225
QgsPropertyOverrideButton::setToProperty
void setToProperty(const QgsProperty &property)
Sets the widget to reflect the current state of a QgsProperty.
Definition: qgspropertyoverridebutton.cpp:286
QgsSimpleFillSymbolLayerWidget::setColor
void setColor(const QColor &color)
Definition: qgssymbollayerwidget.cpp:967
QgsSimpleMarkerSymbolLayer::setStrokeWidthUnit
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit u)
Sets the unit for the width of the marker's stroke.
Definition: qgsmarkersymbollayer.h:337
QgsPointPatternFillSymbolLayer::distanceY
double distanceY() const
Definition: qgsfillsymbollayer.h:1571
QgsPropertyCollection::property
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
Definition: qgspropertycollection.cpp:214
QgsPropertyOverrideButton
A button for controlling property overrides which may apply to a widget.
Definition: qgspropertyoverridebutton.h:51
QgsColorButton::colorChanged
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
QgsSvgMarkerSymbolLayer::setStrokeWidthUnit
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the stroke width.
Definition: qgsmarkersymbollayer.h:588
QgsGradientFillSymbolLayer::referencePoint1
QPointF referencePoint1() const
Definition: qgsfillsymbollayer.h:308
QgsSymbolLayer::PropertyFontStyle
@ PropertyFontStyle
Font style.
Definition: qgssymbollayer.h:190
QgsSvgMarkerSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:2528
QgsSVGFillSymbolLayerWidget::setContext
void setContext(const QgsSymbolWidgetContext &context) override
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Definition: qgssymbollayerwidget.cpp:2805
QgsMarkerSymbolLayer::sizeUnit
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
Definition: qgssymbollayer.h:678
QgsSimpleLineSymbolLayer::setCustomDashVector
void setCustomDashVector(const QVector< qreal > &vector)
Sets the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ren...
Definition: qgslinesymbollayer.h:195
QgsPointPatternFillSymbolLayer::offsetXUnit
QgsUnitTypes::RenderUnit offsetXUnit() const
Returns the units for the horizontal offset for rows in the pattern.
Definition: qgsfillsymbollayer.h:1704
QgsTemplatedLineSymbolLayerBase::setIntervalMapUnitScale
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the interval between symbols.
Definition: qgslinesymbollayer.h:456
QgsSimpleLineSymbolLayer::penStyle
Qt::PenStyle penStyle() const
Returns the pen style used to render the line (e.g.
Definition: qgslinesymbollayer.h:92
QgsTemplatedLineSymbolLayerBase::setInterval
void setInterval(double interval)
Sets the interval between individual symbols.
Definition: qgslinesymbollayer.h:433
QgsPointPatternFillSymbolLayer::setOffsetYUnit
void setOffsetYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical offset for rows in the pattern.
Definition: qgsfillsymbollayer.h:1730
qgsauxiliarystorage.h
qgsapplication.h
QgsSymbolLayer::PropertyGradientSpread
@ PropertyGradientSpread
Gradient spread mode.
Definition: qgssymbollayer.h:151
QgsRandomMarkerFillSymbolLayer::setSeed
void setSeed(unsigned long seed)
Sets the random number seed to use when generating points, or 0 if a truly random sequence will be us...
Definition: qgsfillsymbollayer.cpp:4559
QgsSymbolLayerWidget::symbolChanged
void symbolChanged()
Should be emitted whenever the sub symbol changed on this symbol layer configuration.
QgsRasterMarkerSymbolLayer::setFixedAspectRatio
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
Definition: qgsmarkersymbollayer.h:761
QgsMarkerSymbolLayer::HorizontalAnchorPoint
HorizontalAnchorPoint
Symbol horizontal anchor points.
Definition: qgssymbollayer.h:587
QgsCentroidFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:3637
QgsPointPatternFillSymbolLayer::setDisplacementX
void setDisplacementX(double d)
Definition: qgsfillsymbollayer.h:1575
QgsHashedLineSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:2178
QgsDashSpaceWidget
A widget to enter a custom dash space pattern for lines.
Definition: qgsdashspacedialog.h:34
QgsPointPatternFillSymbolLayer::displacementXUnit
QgsUnitTypes::RenderUnit displacementXUnit() const
Returns the units for the horizontal displacement between rows in the pattern.
Definition: qgsfillsymbollayer.h:1666
qgsnewauxiliarylayerdialog.h
QgsSvgMarkerSymbolLayer::strokeWidth
double strokeWidth() const
Definition: qgsmarkersymbollayer.h:580
QgsFontMarkerSymbolLayer::setStrokeWidthUnit
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the stroke width unit.
Definition: qgsmarkersymbollayer.h:931
QgsSimpleFillSymbolLayer::setStrokeWidth
void setStrokeWidth(double strokeWidth)
Definition: qgsfillsymbollayer.h:91
QgsSimpleLineSymbolLayer::customDashPatternMapUnitScale
const QgsMapUnitScale & customDashPatternMapUnitScale() const
Returns the map unit scale for lengths used in the custom dash pattern.
Definition: qgslinesymbollayer.h:161
QgsPointPatternFillSymbolLayer::setDistanceX
void setDistanceX(double d)
Definition: qgsfillsymbollayer.h:1569
QgsSVGFillSymbolLayer::svgStrokeWidthMapUnitScale
const QgsMapUnitScale & svgStrokeWidthMapUnitScale() const
Returns the map unit scale for the pattern's stroke.
Definition: qgsfillsymbollayer.h:1244
QgsSymbolLayer::propertyDefinitions
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
Definition: qgssymbollayer.cpp:221
QgsSimpleMarkerSymbolLayerBase::setShape
void setShape(QgsSimpleMarkerSymbolLayerBase::Shape shape)
Sets the rendered marker shape.
Definition: qgsmarkersymbollayer.h:108
QgsSvgMarkerSymbolLayer::setStrokeColor
void setStrokeColor(const QColor &c) override
Set stroke color.
Definition: qgsmarkersymbollayer.h:578
QgsCentroidFillSymbolLayer::setClipPoints
void setClipPoints(bool clipPoints)
Sets whether point markers should be clipped to the polygon boundary.
Definition: qgsfillsymbollayer.h:2076
QgsSimpleLineSymbolLayer::setPenStyle
void setPenStyle(Qt::PenStyle style)
Sets the pen style used to render the line (e.g.
Definition: qgslinesymbollayer.h:99
QgsRasterMarkerSymbolLayerWidget::mLayer
QgsRasterMarkerSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:686
QgsSymbolLayerUtils::symbolPreviewIcon
static QIcon symbolPreviewIcon(const QgsSymbol *symbol, QSize size, int padding=0, QgsLegendPatchShape *shape=nullptr)
Returns an icon preview for a color ramp.
Definition: qgssymbollayerutils.cpp:762
QgsCentroidFillSymbolLayer::pointOnSurface
bool pointOnSurface() const
Definition: qgsfillsymbollayer.h:2046
QgsFontMarkerSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:3389
QgsSvgMarkerSymbolLayer::strokeColor
QColor strokeColor() const override
Gets stroke color.
Definition: qgsmarkersymbollayer.h:577
QgsLinePatternFillSymbolLayer::setDistanceUnit
void setDistanceUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the distance between lines in the fill pattern.
Definition: qgsfillsymbollayer.h:1403
QgsSimpleLineSymbolLayer::clone
QgsSimpleLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Definition: qgslinesymbollayer.cpp:424
QgsFontMarkerSymbolLayerWidget::setColor
void setColor(const QColor &color)
Definition: qgssymbollayerwidget.cpp:3419
QgsSymbolLayer::PropertyOffset
@ PropertyOffset
Symbol offset.
Definition: qgssymbollayer.h:139
QgsSymbolLayer::PropertyCharacter
@ PropertyCharacter
Character, eg for font marker symbol layers.
Definition: qgssymbollayer.h:140
QgsSymbolLayer
Definition: qgssymbollayer.h:53
QgsRandomMarkerFillSymbolLayer::clipPoints
bool clipPoints() const
Returns true if point markers should be clipped to the polygon boundary.
Definition: qgsfillsymbollayer.cpp:4564
QgsSymbolLayer::PropertyGradientType
@ PropertyGradientType
Gradient fill type.
Definition: qgssymbollayer.h:149
QgsSimpleMarkerSymbolLayerBase::Shape
Shape
Marker symbol shapes.
Definition: qgsmarkersymbollayer.h:49
QgsGradientFillSymbolLayer::color2
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
Definition: qgsfillsymbollayer.h:295
QgsHashedLineSymbolLayer::hashLengthUnit
QgsUnitTypes::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
Definition: qgslinesymbollayer.h:861
QgsLinePatternFillSymbolLayerWidget::mLayer
QgsLinePatternFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:844
QgsSimpleMarkerSymbolLayer::fillColor
QColor fillColor() const override
Gets fill color.
Definition: qgsmarkersymbollayer.h:251
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsRatioLockButton
A cross platform button subclass used to represent a locked / unlocked ratio state.
Definition: qgsratiolockbutton.h:35
QgsTemplatedLineSymbolLayerBase::SegmentCenter
@ SegmentCenter
Place symbols at the center of every line segment.
Definition: qgslinesymbollayer.h:395
QgsSymbolLayerUtils::symbolPreviewPixmap
static QPixmap symbolPreviewPixmap(const QgsSymbol *symbol, QSize size, int padding=0, QgsRenderContext *customContext=nullptr, bool selected=false, const QgsExpressionContext *expressionContext=nullptr, const QgsLegendPatchShape *shape=nullptr)
Returns a pixmap preview for a color ramp.
Definition: qgssymbollayerutils.cpp:767
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
QgsRasterMarkerSymbolLayer::preservedAspectRatio
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
Definition: qgsmarkersymbollayer.h:738
QgsGradientFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:1401
QgsShapeburstFillSymbolLayer::setOffset
void setOffset(QPointF offset)
Sets the offset for the shapeburst fill.
Definition: qgsfillsymbollayer.h:630
QgsProperty::setField
void setField(const QString &field)
Sets the field name the property references.
Definition: qgsproperty.cpp:292
QgsSymbolLayer::PropertyRandomSeed
@ PropertyRandomSeed
Random number seed.
Definition: qgssymbollayer.h:186
QgsShapeburstFillSymbolLayer::maxDistance
double maxDistance() const
Returns the maximum distance from the shape's boundary which is shaded.
Definition: qgsfillsymbollayer.h:521
QgsSvgMarkerSymbolLayerWidget::mLayer
QgsSvgMarkerSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:623
QgsTemplatedLineSymbolLayerBase::setOffsetAlongLineUnit
void setOffsetAlongLineUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit used for calculating the offset along line for symbols.
Definition: qgslinesymbollayer.h:517
QgsHashedLineSymbolLayer::setHashLength
void setHashLength(double length)
Sets the length of hash symbols.
Definition: qgslinesymbollayer.h:847
QgsRandomMarkerFillSymbolLayer::countMethod
CountMethod countMethod() const
Returns the count method used to randomly fill the polygon.
Definition: qgsfillsymbollayer.cpp:4574
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:262
qgsdashspacedialog.h
QgsPointPatternFillSymbolLayer::setOffsetXMapUnitScale
void setOffsetXMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the horizontal offset for rows in the pattern.
Definition: qgsfillsymbollayer.h:1713
QgsSimpleFillSymbolLayer::setPenJoinStyle
void setPenJoinStyle(Qt::PenJoinStyle style)
Definition: qgsfillsymbollayer.h:94
QgsRandomMarkerFillSymbolLayer::pointCount
int pointCount() const
Returns the count of random points to render in the fill.
Definition: qgsfillsymbollayer.cpp:4544
QgsSymbolLayerWidget::createExpressionContext
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Definition: qgssymbollayerwidget.cpp:62
QgsSvgMarkerSymbolLayer::fillColor
QColor fillColor() const override
Gets fill color.
Definition: qgsmarkersymbollayer.h:574
QgsFontMarkerSymbolLayerWidget::setCharacterFromText
void setCharacterFromText(const QString &text)
Set the font marker character from a text string.
Definition: qgssymbollayerwidget.cpp:3444
QgsPropertyOverrideButton::updateFieldLists
void updateFieldLists()
Updates list of fields.
Definition: qgspropertyoverridebutton.cpp:152
QgsImageCache::pathAsImage
QImage pathAsImage(const QString &path, const QSize size, const bool keepAspectRatio, const double opacity, bool &fitsInCache, bool blocking=false, bool *isMissing=nullptr)
Returns the specified path rendered as an image.
Definition: qgsimagecache.cpp:104
QgsRandomMarkerFillSymbolLayer::densityArea
double densityArea() const
Returns the density area used to count the number of points to randomly fill the polygon.
Definition: qgsfillsymbollayer.cpp:4584
QgsSimpleFillSymbolLayerWidget::QgsSimpleFillSymbolLayerWidget
QgsSimpleFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsSimpleFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:870
QgsSimpleMarkerSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:739
QgsGradientFillSymbolLayer::Radial
@ Radial
Definition: qgsfillsymbollayer.h:217
qgscolorramp.h
QgsMarkerSymbol
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgssymbol.h:931
QgsSvgMarkerSymbolLayer::setStrokeWidth
void setStrokeWidth(double w)
Definition: qgsmarkersymbollayer.h:581
QgsPointPatternFillSymbolLayer::displacementX
double displacementX() const
Definition: qgsfillsymbollayer.h:1574
QgsHashedLineSymbolLayer::setHashAngle
void setHashAngle(double angle)
Sets the angle to use when drawing the hashed lines sections, in degrees clockwise.
Definition: qgslinesymbollayer.cpp:2624
QgsSymbolLayer::PropertyVerticalAnchor
@ PropertyVerticalAnchor
Vertical anchor point.
Definition: qgssymbollayer.h:175
QgsLineSymbolLayer::setOffsetUnit
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line's offset.
Definition: qgssymbollayer.h:1007
QgsSimpleFillSymbolLayer::penJoinStyle
Qt::PenJoinStyle penJoinStyle() const
Definition: qgsfillsymbollayer.h:93
QgsSymbolLayer::PropertyGradientReference1Y
@ PropertyGradientReference1Y
Gradient reference point 1 y.
Definition: qgssymbollayer.h:153
QgsTemplatedLineSymbolLayerBase::setAverageAngleMapUnitScale
void setAverageAngleMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the length over which the line's direction is averaged when calculating i...
Definition: qgslinesymbollayer.h:583
QgsPointPatternFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:3135
QgsGradientFillSymbolLayerWidget::QgsGradientFillSymbolLayerWidget
QgsGradientFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsGradientFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:1213
QgsSvgMarkerSymbolLayer::path
QString path() const
Returns the marker SVG path.
Definition: qgsmarkersymbollayer.h:523
QgsSimpleLineSymbolLayer
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
Definition: qgslinesymbollayer.h:40
QgsTemplatedLineSymbolLayerBase::intervalMapUnitScale
const QgsMapUnitScale & intervalMapUnitScale() const
Returns the map unit scale for the interval between symbols.
Definition: qgslinesymbollayer.h:464
QgsSimpleFillSymbolLayer::strokeWidth
double strokeWidth() const
Definition: qgsfillsymbollayer.h:90
QgsSimpleLineSymbolLayer::customDashPatternUnit
QgsUnitTypes::RenderUnit customDashPatternUnit() const
Returns the units for lengths used in the custom dash pattern.
Definition: qgslinesymbollayer.h:155
QgsLinePatternFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:3002
QgsLinePatternFillSymbolLayer
A symbol fill consisting of repeated parallel lines.
Definition: qgsfillsymbollayer.h:1292
QgsGradientFillSymbolLayer::coordinateMode
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient. Controls how the gradient stops are positioned.
Definition: qgsfillsymbollayer.h:299
QgsRasterFillSymbolLayer::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
Definition: qgsfillsymbollayer.h:938
QgsFontUtils::translateNamedStyle
static QString translateNamedStyle(const QString &namedStyle)
Returns the localized named style of a font, if such a translation is available.
Definition: qgsfontutils.cpp:432
QgsSimpleMarkerSymbolLayer
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.
Definition: qgsmarkersymbollayer.h:199
QgsGradientFillSymbolLayer::Reflect
@ Reflect
Definition: qgsfillsymbollayer.h:230
QgsSvgMarkerSymbolLayer
Definition: qgsmarkersymbollayer.h:483
QgsSymbolLayer::PropertySize
@ PropertySize
Symbol size.
Definition: qgssymbollayer.h:132
QgsCentroidFillSymbolLayer::clipPoints
bool clipPoints() const
Returns true if point markers should be clipped to the polygon boundary.
Definition: qgsfillsymbollayer.h:2068
QgsLinePatternFillSymbolLayer::distanceMapUnitScale
const QgsMapUnitScale & distanceMapUnitScale() const
Returns the map unit scale for the pattern's line distance.
Definition: qgsfillsymbollayer.h:1429
QgsRasterFillSymbolLayer::offset
QPointF offset() const
Returns the offset for the fill.
Definition: qgsfillsymbollayer.h:902
QgsRandomMarkerFillSymbolLayer::seed
unsigned long seed() const
Returns the random number seed to use when generating points, or 0 if a truly random sequence will be...
Definition: qgsfillsymbollayer.cpp:4554
QgsRasterFillSymbolLayer::Viewport
@ Viewport
Tiling is based on complete map viewport.
Definition: qgsfillsymbollayer.h:807
QgsSymbolLayer::PropertyStrokeStyle
@ PropertyStrokeStyle
Stroke style (eg solid, dashed)
Definition: qgssymbollayer.h:138
QgsShapeburstFillSymbolLayer::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Definition: qgsfillsymbollayer.h:660
QgsGeometryGeneratorSymbolLayer
Definition: qgsgeometrygeneratorsymbollayer.h:27
QgsNewAuxiliaryFieldDialog
A dialog to create a new auxiliary field.
Definition: qgsnewauxiliaryfielddialog.h:34
QgsApplication::imageCache
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
Definition: qgsapplication.cpp:2183
QgsShapeburstFillSymbolLayer::setDistanceMapUnitScale
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsfillsymbollayer.h:541
QgsTemplatedLineSymbolLayerBase::interval
double interval() const
Returns the interval between individual symbols.
Definition: qgslinesymbollayer.h:425
QgsRasterMarkerSymbolLayer::setPath
void setPath(const QString &path)
Set the marker raster image path.
Definition: qgsmarkersymbollayer.cpp:2627
QgsSimpleLineSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:294
QgsSimpleFillSymbolLayerWidget::setStrokeColor
void setStrokeColor(const QColor &color)
Definition: qgssymbollayerwidget.cpp:973
QgsCentroidFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:3622
QgsSimpleLineSymbolLayer::setPenCapStyle
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
Definition: qgslinesymbollayer.h:127
QgsShapeburstFillSymbolLayer::setOffsetUnit
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the offset for the shapeburst fill.
Definition: qgsfillsymbollayer.h:648
QgsTemplatedLineSymbolLayerBase::offsetAlongLine
double offsetAlongLine() const
Returns the offset along the line for the symbol placement.
Definition: qgslinesymbollayer.h:488
QgsPanelWidget::widgetChanged
void widgetChanged()
Emitted when the widget state changes.
QgsLineSymbol
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgssymbol.h:1131
QgsSimpleMarkerSymbolLayerBase::shapeIsFilled
static bool shapeIsFilled(QgsSimpleMarkerSymbolLayerBase::Shape shape)
Returns true if a symbol shape has a fill.
Definition: qgsmarkersymbollayer.cpp:100
QgsRasterFillSymbolLayer::coordinateMode
FillCoordinateMode coordinateMode() const
Coordinate mode for fill.
Definition: qgsfillsymbollayer.h:870
QgsMarkerSymbolLayer::verticalAnchorPoint
VerticalAnchorPoint verticalAnchorPoint() const
Returns the vertical anchor point for positioning the symbol.
Definition: qgssymbollayer.h:795
QgsSVGFillSymbolLayer
A class for filling symbols with a repeated SVG file.
Definition: qgsfillsymbollayer.h:1025
QgsSVGFillSymbolLayer::setSvgFilePath
void setSvgFilePath(const QString &svgPath)
Sets the path to the SVG file to render in the fill.
Definition: qgsfillsymbollayer.cpp:1872
QgsSimpleMarkerSymbolLayer::strokeWidth
double strokeWidth() const
Returns the width of the marker's stroke.
Definition: qgsmarkersymbollayer.h:319
QgsPointPatternFillSymbolLayerWidget::QgsPointPatternFillSymbolLayerWidget
QgsPointPatternFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsPointPatternFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:3056
QgsSimpleLineSymbolLayer::setDrawInsidePolygon
void setDrawInsidePolygon(bool drawInsidePolygon)
Sets whether the line should only be drawn inside polygons, and any portion of the line which falls o...
Definition: qgslinesymbollayer.h:289
QgsShapeburstFillSymbolLayer
Definition: qgsfillsymbollayer.h:416
QgsGradientFillSymbolLayer::setOffset
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
Definition: qgsfillsymbollayer.h:330
QgsPropertyOverrideButton::toProperty
QgsProperty toProperty() const
Returns a QgsProperty object encapsulating the current state of the widget.
Definition: qgspropertyoverridebutton.cpp:210
QgsTemplatedLineSymbolLayerBase::offsetAlongLineMapUnitScale
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for symbols.
Definition: qgslinesymbollayer.h:523
QgsSvgMarkerSymbolLayerWidget::setGuiForSvg
void setGuiForSvg(const QgsSvgMarkerSymbolLayer *layer, bool skipDefaultColors=false)
Updates the GUI to reflect the SVG marker symbol layer.
Definition: qgssymbollayerwidget.cpp:2379
QgsFontMarkerSymbolLayer::setPenJoinStyle
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the stroke join style.
Definition: qgsmarkersymbollayer.h:971
QgsPropertyDefinition
Definition for a property.
Definition: qgsproperty.h:48
QgsRasterMarkerSymbolLayer
Raster marker symbol layer class.
Definition: qgsmarkersymbollayer.h:653
QgsSimpleLineSymbolLayerWidget::updatePatternIcon
void updatePatternIcon()
Definition: qgssymbollayerwidget.cpp:508
qgssymbolslistwidget.h
QgsTemplatedLineSymbolLayerBase::Interval
@ Interval
Place symbols at regular intervals.
Definition: qgslinesymbollayer.h:389
QgsRasterFillSymbolLayer::imageFilePath
QString imageFilePath() const
The path to the raster image used for the fill.
Definition: qgsfillsymbollayer.h:854
QgsSvgMarkerSymbolLayerWidget::QgsSvgMarkerSymbolLayerWidget
QgsSvgMarkerSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsSvgMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:2311
QgsMarkerLineSymbolLayerWidget::QgsMarkerLineSymbolLayerWidget
QgsMarkerLineSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsMarkerLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:1814
QgsHashedLineSymbolLayerWidget::QgsHashedLineSymbolLayerWidget
QgsHashedLineSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsHashedLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:2046
QgsSymbolLayer::PropertyDensityArea
@ PropertyDensityArea
Density area.
Definition: qgssymbollayer.h:188
Qgis::UI_SCALE_FACTOR
static const double UI_SCALE_FACTOR
UI scaling factor.
Definition: qgis.h:182
QgsUnitSelectionWidget::changed
void changed()
QgsPointPatternFillSymbolLayer::setDisplacementXMapUnitScale
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsfillsymbollayer.h:1668
QgsShapeburstFillSymbolLayer::setDistanceUnit
void setDistanceUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary.
Definition: qgsfillsymbollayer.h:530
QgsMarkerLineSymbolLayerWidget::setOffsetAlongLine
void setOffsetAlongLine(double val)
Definition: qgssymbollayerwidget.cpp:1946
QgsPointPatternFillSymbolLayerWidget::mLayer
QgsPointPatternFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:887
QgsSimpleFillSymbolLayer::setOffsetUnit
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the fill's offset.
Definition: qgsfillsymbollayer.h:137
QgsPointPatternFillSymbolLayer::displacementYMapUnitScale
const QgsMapUnitScale & displacementYMapUnitScale() const
Definition: qgsfillsymbollayer.h:1687
QgsSymbolLayer::PropertyName
@ PropertyName
Name, eg shape name for simple markers.
Definition: qgssymbollayer.h:134
QgsMarkerSymbolLayer::setOffset
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
Definition: qgssymbollayer.h:718
QgsSymbol::Fill
@ Fill
Fill symbol.
Definition: qgssymbol.h:89
QgsSvgMarkerSymbolLayer::clone
QgsSvgMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Definition: qgsmarkersymbollayer.cpp:2221
QgsSimpleLineSymbolLayerWidget::mLayer
QgsSimpleLineSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:151
QgsSymbolWidgetContext::expressionContext
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
Definition: qgssymbolwidgetcontext.cpp:77
QgsSymbolLayer::PropertyPointCount
@ PropertyPointCount
Point count.
Definition: qgssymbollayer.h:185
QgsGradientFillSymbolLayer::setReferencePoint1IsCentroid
void setReferencePoint1IsCentroid(bool isCentroid)
Sets the starting point of the gradient to be the feature centroid.
Definition: qgsfillsymbollayer.h:311
QgsGradientFillSymbolLayer::gradientSpread
GradientSpread gradientSpread() const
Gradient spread mode. Controls how the gradient behaves outside of the predefined stops.
Definition: qgsfillsymbollayer.h:303
QgsSVGFillSymbolLayer::svgStrokeColor
QColor svgStrokeColor() const
Returns the stroke color used for rendering the SVG content.
Definition: qgsfillsymbollayer.h:1148
QgsCentroidFillSymbolLayer::setClipOnCurrentPartOnly
void setClipOnCurrentPartOnly(bool clipOnCurrentPartOnly)
Sets whether point markers should be clipped to the current part boundary only.
Definition: qgsfillsymbollayer.h:2092
QgsRasterFillSymbolLayer::widthMapUnitScale
const QgsMapUnitScale & widthMapUnitScale() const
Returns the map unit scale for the image's width.
Definition: qgsfillsymbollayer.h:994
QgsTemplatedLineSymbolLayerBase::averageAngleLength
double averageAngleLength() const
Returns the length of line over which the line's direction is averaged when calculating individual sy...
Definition: qgslinesymbollayer.h:541
QgsSimpleMarkerSymbolLayer::strokeWidthUnit
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the unit for the width of the marker's stroke.
Definition: qgsmarkersymbollayer.h:345
QgsCentroidFillSymbolLayer::clipOnCurrentPartOnly
bool clipOnCurrentPartOnly() const
Returns true if point markers should be clipped to the current part boundary only.
Definition: qgsfillsymbollayer.h:2084
QgsRandomMarkerFillSymbolLayer::densityAreaUnit
QgsUnitTypes::RenderUnit densityAreaUnit() const
Returns the units for the density area.
Definition: qgsfillsymbollayer.h:1945
QgsRandomMarkerFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:4233
QgsSimpleMarkerSymbolLayerWidget::QgsSimpleMarkerSymbolLayerWidget
QgsSimpleMarkerSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsSimpleMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:571
QgsPointPatternFillSymbolLayer::displacementYUnit
QgsUnitTypes::RenderUnit displacementYUnit() const
Returns the units for the vertical displacement between rows in the pattern.
Definition: qgsfillsymbollayer.h:1684
qgsfillsymbollayer.h
QgsSimpleMarkerSymbolLayer::setStrokeWidth
void setStrokeWidth(double w)
Sets the width of the marker's stroke.
Definition: qgsmarkersymbollayer.h:328
QgsMarkerLineSymbolLayerWidget::setInterval
void setInterval(double val)
Definition: qgssymbollayerwidget.cpp:1940
QgsFontMarkerSymbolLayer::setFontFamily
void setFontFamily(const QString &family)
Sets the font family for the font which will be used to render the point.
Definition: qgsmarkersymbollayer.h:855
QgsSymbolLayer::PropertyStrokeWidth
@ PropertyStrokeWidth
Stroke width.
Definition: qgssymbollayer.h:137
QgsGradientFillSymbolLayer::colorRamp
QgsColorRamp * colorRamp()
Returns the color ramp used for the gradient fill.
Definition: qgsfillsymbollayer.h:283
QgsGradientFillSymbolLayerWidget::setGradientType
void setGradientType(int index)
Definition: qgssymbollayerwidget.cpp:1440
QgsPanelWidget::setPanelTitle
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
Definition: qgspanelwidget.h: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
QgsRasterMarkerSymbolLayer::path
QString path() const
Returns the marker raster image path.
Definition: qgsmarkersymbollayer.h:698
QgsSVGFillSymbolLayer::setSvgStrokeWidth
void setSvgStrokeWidth(double w)
Sets the stroke width used for rendering the SVG content.
Definition: qgsfillsymbollayer.h:1160
QgsMarkerSymbolLayer::setOffsetUnit
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's offset.
Definition: qgssymbollayer.h:736
QgsSymbolLayer::PropertyShapeburstIgnoreRings
@ PropertyShapeburstIgnoreRings
Shapeburst ignore rings.
Definition: qgssymbollayer.h:161
QgsRasterFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:3972
QgsGradientFillSymbolLayer::referencePoint2
QPointF referencePoint2() const
Definition: qgsfillsymbollayer.h:316
QgsShapeburstFillSymbolLayer::setBlurRadius
void setBlurRadius(int blurRadius)
Sets the blur radius, which controls the amount of blurring applied to the fill.
Definition: qgsfillsymbollayer.h:474
QgsSimpleLineSymbolLayer::setDashPatternOffset
void setDashPatternOffset(double offset)
Sets the dash pattern offset, which dictates how far along the dash pattern the pattern should start ...
Definition: qgslinesymbollayer.h:223
QgsLinePatternFillSymbolLayer::setOffset
void setOffset(double offset)
Sets the offset distance for lines within the fill, which is the distance to offset the parallel line...
Definition: qgsfillsymbollayer.h:1382
CharacterWidget::setCharacter
void setCharacter(QChar character)
Sets the currently selected character in the widget.
Definition: characterwidget.cpp:112
QgsShapeburstFillSymbolLayer::blurRadius
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
Definition: qgsfillsymbollayer.h:482
QgsRasterFillSymbolLayerWidget::mLayer
QgsRasterFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:738
QgsSvgMarkerSymbolLayer::defaultAspectRatio
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
Definition: qgsmarkersymbollayer.h:536
QgsRandomMarkerFillSymbolLayer::setCountMethod
void setCountMethod(CountMethod method)
Sets the count method used to randomly fill the polygon.
Definition: qgsfillsymbollayer.cpp:4579
QgsTemplatedLineSymbolLayerBase::setOffsetAlongLineMapUnitScale
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for symbols.
Definition: qgslinesymbollayer.h:529
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition: qgsexpressioncontext.h:112
QgsApplication::svgCache
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
Definition: qgsapplication.cpp:2178
QgsLineSymbolLayer::InteriorRingsOnly
@ InteriorRingsOnly
Render the interior rings only.
Definition: qgssymbollayer.h:909
QgsTemplatedLineSymbolLayerBase::setMapUnitScale
void setMapUnitScale(const QgsMapUnitScale &scale) FINAL
Definition: qgslinesymbollayer.cpp:1276
qgssymbolselectordialog.h
QgsFontMarkerSymbolLayerWidget::QgsFontMarkerSymbolLayerWidget
QgsFontMarkerSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsFontMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:3256
qgsstyle.h
QgsFontMarkerSymbolLayerWidget::setColorStroke
void setColorStroke(const QColor &color)
Set stroke color.
Definition: qgssymbollayerwidget.cpp:3425
QgsUnitTypes::RenderPixels
@ RenderPixels
Pixels.
Definition: qgsunittypes.h:170
QgsSvgMarkerSymbolLayer::setStrokeWidthMapUnitScale
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsmarkersymbollayer.h:596
QgsSimpleMarkerSymbolLayer::strokeColor
QColor strokeColor() const override
Returns the marker's stroke color.
Definition: qgsmarkersymbollayer.h:264
QgsShapeburstFillSymbolLayer::setColorType
void setColorType(ShapeburstColorType colorType)
Sets the color mode to use for the shapeburst fill.
Definition: qgsfillsymbollayer.h:554
QgsPointPatternFillSymbolLayer::distanceX
double distanceX() const
Definition: qgsfillsymbollayer.h:1568
QgsGeometryGeneratorSymbolLayer::setGeometryExpression
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
Definition: qgsgeometrygeneratorsymbollayer.cpp:154
QgsShapeburstFillSymbolLayer::ColorRamp
@ ColorRamp
Definition: qgsfillsymbollayer.h:422
QgsRasterFillSymbolLayer::widthUnit
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the image's width.
Definition: qgsfillsymbollayer.h:976
QgsMarkerLineSymbolLayerWidget::mLayer
QgsMarkerLineSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:496
QgsSvgMarkerSymbolLayerWidget::setContext
void setContext(const QgsSymbolWidgetContext &context) override
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
Definition: qgssymbollayerwidget.cpp:2533
QgsTemplatedLineSymbolLayerBase::setAverageAngleLength
void setAverageAngleLength(double length)
Sets the length of line over which the line's direction is averaged when calculating individual symbo...
Definition: qgslinesymbollayer.h:553
QgsExpressionContext::appendScope
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
Definition: qgsexpressioncontext.cpp:490
QgsSymbolLayer::PropertyOffsetY
@ PropertyOffsetY
Vertical offset.
Definition: qgssymbollayer.h:184
QgsSymbolLayer::PropertyOffsetAlongLine
@ PropertyOffsetAlongLine
Offset along line.
Definition: qgssymbollayer.h:172
qgsvectorlayer.h
QgsExpressionContext::EXPR_CLUSTER_SIZE
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
Definition: qgsexpressioncontext.h:735
QgsPointPatternFillSymbolLayer::setOffsetY
void setOffsetY(double offset)
Sets the vertical offset values for points in the pattern.
Definition: qgsfillsymbollayer.h:1604
QgsRasterFillSymbolLayer::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
Definition: qgsfillsymbollayer.h:920
QgsPointPatternFillSymbolLayer::setDisplacementY
void setDisplacementY(double d)
Definition: qgsfillsymbollayer.h:1578
QgsExpressionContext::EXPR_GEOMETRY_PART_COUNT
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
Definition: qgsexpressioncontext.h:727
QgsSimpleFillSymbolLayer::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
Definition: qgsfillsymbollayer.h:144
QgsPointPatternFillSymbolLayer::distanceXUnit
QgsUnitTypes::RenderUnit distanceXUnit() const
Returns the units for the horizontal distance between points in the pattern.
Definition: qgsfillsymbollayer.h:1630
QgsFontMarkerSymbolLayerWidget::mLayer
QgsFontMarkerSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:1013
QgsPointPatternFillSymbolLayer::distanceYMapUnitScale
const QgsMapUnitScale & distanceYMapUnitScale() const
Definition: qgsfillsymbollayer.h:1651
QgsRandomMarkerFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:4272
QgsShapeburstFillSymbolLayer::colorRamp
QgsColorRamp * colorRamp()
Returns the color ramp used for the shapeburst fill.
Definition: qgsfillsymbollayer.h:586
QgsRasterFillSymbolLayer::setOffsetUnit
void setOffsetUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units for the fill's offset.
Definition: qgsfillsymbollayer.h:911
QgsRasterMarkerSymbolLayer::fixedAspectRatio
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
Definition: qgsmarkersymbollayer.h:753
QgsMarkerSymbolLayer::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's offset.
Definition: qgssymbollayer.h:753
QgsGradientFillSymbolLayer::setReferencePoint1
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
Definition: qgsfillsymbollayer.h:307
QgsGradientFillSymbolLayerWidget::setGradientSpread
void setGradientSpread(int index)
Definition: qgssymbollayerwidget.cpp:1497
QgsRasterMarkerSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:3702
QgsMarkerLineSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:1870
QgsPointPatternFillSymbolLayer::setDisplacementYUnit
void setDisplacementYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical displacement between rows in the pattern.
Definition: qgsfillsymbollayer.h:1677
QgsRandomMarkerFillSymbolLayer::setClipPoints
void setClipPoints(bool clipped)
Sets whether point markers should be clipped to the polygon boundary.
Definition: qgsfillsymbollayer.cpp:4569
QgsFontMarkerSymbolLayer::fontStyle
QString fontStyle() const
Returns the font style for the associated font which will be used to render the point.
Definition: qgsmarkersymbollayer.h:863
QgsSimpleLineSymbolLayer::setDashPatternOffsetMapUnitScale
void setDashPatternOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the dash pattern offset.
Definition: qgslinesymbollayer.h:267
QgsSymbolLayer::PropertyGradientReference2X
@ PropertyGradientReference2X
Gradient reference point 2 x.
Definition: qgssymbollayer.h:154
QgsLineSymbolLayer::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the line's offset.
Definition: qgssymbollayer.h:1031
QgsFontMarkerSymbolLayerWidget::setCharacter
void setCharacter(QChar chr)
Set the font marker character from char.
Definition: qgssymbollayerwidget.cpp:3479
QgsSymbolLayerWidget::context
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
Definition: qgssymbollayerwidget.cpp:128
qgslinesymbollayer.h
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
QgsLinePatternFillSymbolLayer::setDistanceMapUnitScale
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line distance.
Definition: qgsfillsymbollayer.h:1420
QgsSvgMarkerSymbolLayer::setFillColor
void setFillColor(const QColor &color) override
Set fill color.
Definition: qgsmarkersymbollayer.h:575
QgsSvgMarkerSymbolLayer::strokeWidthMapUnitScale
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Definition: qgsmarkersymbollayer.h:597
QgsSimpleFillSymbolLayer::brushStyle
Qt::BrushStyle brushStyle() const
Definition: qgsfillsymbollayer.h:78
QgsSvgMarkerSymbolLayer::setFixedAspectRatio
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
Definition: qgsmarkersymbollayer.h:572
QgsFilledMarkerSymbolLayer::clone
QgsFilledMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Definition: qgsmarkersymbollayer.cpp:1643
QgsSymbolLayer::PropertyCoordinateMode
@ PropertyCoordinateMode
Gradient coordinate mode.
Definition: qgssymbollayer.h:150
QgsSVGFillSymbolLayerWidget::mLayer
QgsSVGFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:789
QgsShapeburstFillSymbolLayer::distanceMapUnitScale
const QgsMapUnitScale & distanceMapUnitScale() const
Definition: qgsfillsymbollayer.h:542
QgsRandomMarkerFillSymbolLayer::setDensityAreaUnit
void setDensityAreaUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the density area.
Definition: qgsfillsymbollayer.h:1939
QgsPointPatternFillSymbolLayer::setDistanceXMapUnitScale
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsfillsymbollayer.h:1632
QgsFillSymbolLayer::angle
double angle() const
Definition: qgssymbollayer.h:1118
QgsHashedLineSymbolLayer::hashLengthMapUnitScale
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
Definition: qgslinesymbollayer.h:877
QgsShapeburstFillSymbolLayer::distanceUnit
QgsUnitTypes::RenderUnit distanceUnit() const
Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary.
Definition: qgsfillsymbollayer.h:539
QgsSimpleMarkerSymbolLayer::setStrokeColor
void setStrokeColor(const QColor &color) override
Sets the marker's stroke color.
Definition: qgsmarkersymbollayer.h:273
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
QgsPointPatternFillSymbolLayer::setDisplacementYMapUnitScale
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsfillsymbollayer.h:1686
QgsSymbolLayer::PropertyDistanceY
@ PropertyDistanceY
Vertical distance between points.
Definition: qgssymbollayer.h:164
qgsimagecache.h
QgsSvgSelectorWidget::svgSelected
void svgSelected(const QString &path)
QgsTemplatedLineSymbolLayerBase::setRotateSymbols
void setRotateSymbols(bool rotate)
Sets whether the repeating symbols should be rotated to match their line segment orientation.
Definition: qgslinesymbollayer.h:418
QgsPointPatternFillSymbolLayer::setDistanceXUnit
void setDistanceXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal distance between points in the pattern.
Definition: qgsfillsymbollayer.h:1623
QgsSimpleLineSymbolLayer::alignDashPattern
bool alignDashPattern() const
Returns true if dash patterns should be aligned to the start and end of lines, by applying subtle twe...
Definition: qgslinesymbollayer.cpp:989
QgsSimpleFillSymbolLayer::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
Definition: qgsfillsymbollayer.h:158
QgsSymbolLayerList
QList< QgsSymbolLayer * > QgsSymbolLayerList
Definition: qgssymbol.h:53
QgsSVGFillSymbolLayer::patternWidthMapUnitScale
const QgsMapUnitScale & patternWidthMapUnitScale() const
Returns the map unit scale for the pattern's width.
Definition: qgsfillsymbollayer.h:1208
QgsLinePatternFillSymbolLayer::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line offset.
Definition: qgsfillsymbollayer.h:1484
QgsRasterFillSymbolLayer::setWidth
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
Definition: qgsfillsymbollayer.h:948
QgsLineSymbolLayer::ringFilter
RenderRingFilter ringFilter() const
Returns the line symbol layer's ring filter, which controls which rings are rendered when the line sy...
Definition: qgssymbollayer.cpp:432
QgsShapeburstFillSymbolLayer::color2
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
Definition: qgsfillsymbollayer.h:604
QgsSymbolLayer::PropertyDistanceX
@ PropertyDistanceX
Horizontal distance between points.
Definition: qgssymbollayer.h:163
QgsFontMarkerSymbolLayer
Definition: qgsmarkersymbollayer.h:803
QgsRandomMarkerFillSymbolLayer::setDensityArea
void setDensityArea(double area)
Sets the density area used to count the number of points to randomly fill the polygon.
Definition: qgsfillsymbollayer.cpp:4589
QgsGradientFillSymbolLayer::Linear
@ Linear
Definition: qgsfillsymbollayer.h:216
QgsDashSpaceWidget::setUnit
void setUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit type used for the dash space pattern (used to update interface labels)
Definition: qgsdashspacedialog.cpp:85
QgsTemplatedLineSymbolLayerBase::LastVertex
@ LastVertex
Place symbols on the last vertex in the line.
Definition: qgslinesymbollayer.h:391
QgsGradientFillSymbolLayer::referencePoint1IsCentroid
bool referencePoint1IsCentroid() const
Definition: qgsfillsymbollayer.h:312
QgsSymbolLayer::PropertyFile
@ PropertyFile
Filename, eg for svg files.
Definition: qgssymbollayer.h:162
QgsSymbolLayer::PropertyCustomDash
@ PropertyCustomDash
Custom dash pattern.
Definition: qgssymbollayer.h:168
QgsRandomMarkerFillSymbolLayer
A fill symbol layer which places markers at random locations within polygons.
Definition: qgsfillsymbollayer.h:1811
QgsSvgSourceLineEdit::sourceChanged
void sourceChanged(const QString &source)
Emitted whenever the SVG source is changed in the widget.
qgssettings.h
QgsSimpleLineSymbolLayerWidget::resizeEvent
void resizeEvent(QResizeEvent *event) override
Definition: qgssymbollayerwidget.cpp:560
QgsSimpleFillSymbolLayer
Definition: qgsfillsymbollayer.h:40
QgsSimpleFillSymbolLayer::setOffset
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
Definition: qgsfillsymbollayer.h:104
QgsSymbolLayer::PropertyAngle
@ PropertyAngle
Symbol angle.
Definition: qgssymbollayer.h:133
QgsTemplatedLineSymbolLayerBase::rotateSymbols
bool rotateSymbols() const
Returns true if the repeating symbols be rotated to match their line segment orientation.
Definition: qgslinesymbollayer.h:412
QgsRatioLockButton::lockChanged
void lockChanged(bool locked)
Emitted whenever the lock state changes.
QgsSimpleLineSymbolLayer::setTweakDashPatternOnCorners
void setTweakDashPatternOnCorners(bool enabled)
Sets whether dash patterns tweaks should be applied on sharp corners, to ensure that a double-length ...
Definition: qgslinesymbollayer.cpp:1004
QgsUnitTypes::RenderMetersInMapUnits
@ RenderMetersInMapUnits
Meters value as Map units.
Definition: qgsunittypes.h:175
QgsSvgMarkerSymbolLayer::preservedAspectRatio
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
Definition: qgsmarkersymbollayer.h:549
qgsproperty.h
QgsPointPatternFillSymbolLayer::setDisplacementXUnit
void setDisplacementXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal displacement between rows in the pattern.
Definition: qgsfillsymbollayer.h:1659
QgsSymbol::Line
@ Line
Line symbol.
Definition: qgssymbol.h:88
QgsGradientFillSymbolLayer::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
Definition: qgsfillsymbollayer.h:361
QgsLineSymbolLayer::AllRings
@ AllRings
Render both exterior and interior rings.
Definition: qgssymbollayer.h:907
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
QgsSymbolLayerWidget::updateDataDefinedProperty
void updateDataDefinedProperty()
Definition: qgssymbollayerwidget.cpp:182
QgsSymbolLayer::PropertyShapeburstMaxDistance
@ PropertyShapeburstMaxDistance
Shapeburst fill from edge distance.
Definition: qgssymbollayer.h:160
QgsRandomMarkerFillSymbolLayer::setPointCount
void setPointCount(int count)
Sets the count of random points to render in the fill.
Definition: qgsfillsymbollayer.cpp:4549
QgsMarkerSymbolLayer::horizontalAnchorPoint
HorizontalAnchorPoint horizontalAnchorPoint() const
Returns the horizontal anchor point for positioning the symbol.
Definition: qgssymbollayer.h:778
QgsSymbol::Marker
@ Marker
Marker symbol.
Definition: qgssymbol.h:87
QgsGradientFillSymbolLayer::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
Definition: qgsfillsymbollayer.h:368
QgsSVGFillSymbolLayer::patternWidthUnit
QgsUnitTypes::RenderUnit patternWidthUnit() const
Returns the units for the width of the SVG images in the pattern.
Definition: qgsfillsymbollayer.h:1190
QgsGradientFillSymbolLayer::setColorRamp
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp used for the gradient fill.
Definition: qgsfillsymbollayer.cpp:599
qgsgradientcolorrampdialog.h
QgsSVGFillSymbolLayer::setSvgStrokeWidthMapUnitScale
void setSvgStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's stroke.
Definition: qgsfillsymbollayer.h:1235
QgsSymbolLayer::Property
Property
Data definable properties.
Definition: qgssymbollayer.h:131
QgsSimpleMarkerSymbolLayerBase::availableShapes
static QList< QgsSimpleMarkerSymbolLayerBase::Shape > availableShapes()
Returns a list of all available shape types.
Definition: qgsmarkersymbollayer.cpp:60
QgsGradientFillSymbolLayer::setReferencePoint2IsCentroid
void setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
Definition: qgsfillsymbollayer.h:319
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
QgsGradientFillSymbolLayerWidget::setColor
void setColor(const QColor &color)
Definition: qgssymbollayerwidget.cpp:1406
QgsFontMarkerSymbolLayer::penJoinStyle
Qt::PenJoinStyle penJoinStyle() const
Returns the stroke join style.
Definition: qgsmarkersymbollayer.h:962
QgsSVGFillSymbolLayerWidget::QgsSVGFillSymbolLayerWidget
QgsSVGFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsSVGFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:2714
QgsPointPatternFillSymbolLayer::offsetYMapUnitScale
const QgsMapUnitScale & offsetYMapUnitScale() const
Returns the unit scale for the vertical offset between rows in the pattern.
Definition: qgsfillsymbollayer.h:1755
QgsSVGFillSymbolLayer::svgFilePath
QString svgFilePath() const
Returns the path to the SVG file used to render the fill.
Definition: qgsfillsymbollayer.h:1084
QgsSvgMarkerSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:2459
QgsGradientFillSymbolLayerWidget::setCoordinateMode
void setCoordinateMode(int index)
Definition: qgssymbollayerwidget.cpp:1471
QgsMarkerSymbolLayer::setSize
virtual void setSize(double size)
Sets the symbol size.
Definition: qgssymbollayer.h:653
QgsSymbolWidgetContext::messageBar
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:64
QgsMarkerSymbolLayer::offset
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
Definition: qgssymbollayer.h:727
QgsMarkerSymbolLayer::setSizeMapUnitScale
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's size.
Definition: qgssymbollayer.h:687
QgsMarkerSymbolLayer::setVerticalAnchorPoint
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
Definition: qgssymbollayer.h:787
QgsLinePatternFillSymbolLayer::distanceUnit
QgsUnitTypes::RenderUnit distanceUnit() const
Returns the units for the distance between lines in the fill pattern.
Definition: qgsfillsymbollayer.h:1411
QgsSymbolLayer::layerType
virtual QString layerType() const =0
Returns a string that represents this layer type.
QgsSVGFillSymbolLayer::setPatternWidthMapUnitScale
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's width.
Definition: qgsfillsymbollayer.h:1199
QgsSimpleLineSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:378
QgsSymbolLayer::PropertyGradientReference1X
@ PropertyGradientReference1X
Gradient reference point 1 x.
Definition: qgssymbollayer.h:152
QgsSymbolLayer::PropertyOpacity
@ PropertyOpacity
Opacity.
Definition: qgssymbollayer.h:167
QgsGradientFillSymbolLayerWidget::mLayer
QgsGradientFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:393
QgsCentroidFillSymbolLayer::setPointOnAllParts
void setPointOnAllParts(bool pointOnAllParts)
Sets whether a point is drawn for all parts or only on the biggest part of multi-part features.
Definition: qgsfillsymbollayer.h:2053
QgsPointPatternFillSymbolLayer::distanceYUnit
QgsUnitTypes::RenderUnit distanceYUnit() const
Returns the units for the vertical distance between points in the pattern.
Definition: qgsfillsymbollayer.h:1648
QgsLineSymbolLayer::setWidthMapUnitScale
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgssymbollayer.h:1049
QgsLineSymbolLayer::offset
double offset() const
Returns the line's offset.
Definition: qgssymbollayer.h:988
QgsRasterFillSymbolLayer::setImageFilePath
void setImageFilePath(const QString &imagePath)
Sets the path to the raster image used for the fill.
Definition: qgsfillsymbollayer.cpp:4172
QgsGradientFillSymbolLayer::setGradientColorType
void setGradientColorType(GradientColorType gradientColorType)
Definition: qgsfillsymbollayer.h:275
QgsFontMarkerSymbolLayer::setStrokeWidthMapUnitScale
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
Definition: qgsmarkersymbollayer.h:953
QgsRasterFillSymbolLayer::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
Definition: qgsfillsymbollayer.h:929
QgsGradientFillSymbolLayer::setOffsetUnit
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the fill's offset.
Definition: qgsfillsymbollayer.h:347
QgsMarkerSymbolLayer::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the symbol's offset.
Definition: qgssymbollayer.h:761
QgsSimpleMarkerSymbolLayer::setPenJoinStyle
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the marker's stroke join style (e.g., miter, bevel, etc).
Definition: qgsmarkersymbollayer.h:311
QgsShapeburstFillSymbolLayer::offset
QPointF offset() const
Returns the offset for the shapeburst fill.
Definition: qgsfillsymbollayer.h:639
QgsSimpleMarkerSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:654
QgsSymbol::SymbolType
SymbolType
Type of the symbol.
Definition: qgssymbol.h:86
QgsSvgMarkerSymbolLayer::strokeWidthUnit
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the stroke width.
Definition: qgsmarkersymbollayer.h:594
QgsSymbolLayer::PropertyHeight
@ PropertyHeight
Symbol height.
Definition: qgssymbollayer.h:142
QgsGradientFillSymbolLayerWidget::setColor2
void setColor2(const QColor &color)
Definition: qgssymbollayerwidget.cpp:1412
QgsSimpleFillSymbolLayer::strokeStyle
Qt::PenStyle strokeStyle() const
Definition: qgsfillsymbollayer.h:87
QgsTemplatedLineSymbolLayerBase::FirstVertex
@ FirstVertex
Place symbols on the first vertex in the line.
Definition: qgslinesymbollayer.h:392
qgsgeometrygeneratorsymbollayer.h
QgsShapeburstFillSymbolLayer::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
Definition: qgsfillsymbollayer.h:657
QgsShapeburstFillSymbolLayer::colorType
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
Definition: qgsfillsymbollayer.h:566
QgsRandomMarkerFillSymbolLayer::DensityBasedCount
@ DensityBasedCount
The point count is part of a marker density count.
Definition: qgsfillsymbollayer.h:1818
QgsRasterFillSymbolLayer::setCoordinateMode
void setCoordinateMode(FillCoordinateMode mode)
Set the coordinate mode for fill.
Definition: qgsfillsymbollayer.cpp:4177
qgscolorrampbutton.h
QgsTemplatedLineSymbolLayerBase::intervalUnit
QgsUnitTypes::RenderUnit intervalUnit() const
Returns the units for the interval between symbols.
Definition: qgslinesymbollayer.h:448
QgsShapeburstFillSymbolLayerWidget::QgsShapeburstFillSymbolLayerWidget
QgsShapeburstFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsShapeburstFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:1548
qgslogger.h
QgsLineSymbolLayer::widthUnit
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the line's width.
Definition: qgssymbollayer.h:1047
QgsUnitTypes::RenderUnitList
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
Definition: qgsunittypes.h:239
QgsLineSymbolLayer::ExteriorRingOnly
@ ExteriorRingOnly
Render the exterior ring only.
Definition: qgssymbollayer.h:908
QgsSimpleLineSymbolLayer::setCustomDashPatternUnit
void setCustomDashPatternUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for lengths used in the custom dash pattern.
Definition: qgslinesymbollayer.h:149
QgsSymbolLayer::PropertyOffsetX
@ PropertyOffsetX
Horizontal offset.
Definition: qgssymbollayer.h:183
QgsFilledMarkerSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:1131
QgsShapeburstFillSymbolLayer::useWholeShape
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
Definition: qgsfillsymbollayer.h:501
QgsFontUtils::untranslateNamedStyle
static QString untranslateNamedStyle(const QString &namedStyle)
Returns the english named style of a font, if possible.
Definition: qgsfontutils.cpp:446
QgsCentroidFillSymbolLayer
Definition: qgsfillsymbollayer.h:2000
QgsLinePatternFillSymbolLayer::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line pattern's offset.
Definition: qgsfillsymbollayer.h:1475
QgsExpressionContextScope::StaticVariable
Single variable definition for use within a QgsExpressionContextScope.
Definition: qgsexpressioncontext.h:119
qgssvgselectorwidget.h
QgsGradientFillSymbolLayer::ColorRamp
@ ColorRamp
Definition: qgsfillsymbollayer.h:211
QgsFilledMarkerSymbolLayerWidget::QgsFilledMarkerSymbolLayerWidget
QgsFilledMarkerSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsFilledMarkerSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:1026
QgsSymbolLayerWidget::registerDataDefinedButton
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsSymbolLayer::Property key)
Registers a data defined override button.
Definition: qgssymbollayerwidget.cpp:133
QgsPointPatternFillSymbolLayer::setDistanceYUnit
void setDistanceYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical distance between points in the pattern.
Definition: qgsfillsymbollayer.h:1641
QgsGeometryGeneratorSymbolLayerWidget::QgsGeometryGeneratorSymbolLayerWidget
QgsGeometryGeneratorSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsGeometryGeneratorSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:4155
QgsSVGFillSymbolLayer::setSvgStrokeWidthUnit
void setSvgStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the stroke width.
Definition: qgsfillsymbollayer.h:1217
QgsShapeburstFillSymbolLayer::setColorRamp
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp used to draw the shapeburst fill.
Definition: qgsfillsymbollayer.cpp:1107
QgsShapeburstFillSymbolLayer::ignoreRings
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
Definition: qgsfillsymbollayer.h:621
QgsVectorLayer::geometryType
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
Definition: qgsvectorlayer.cpp:659
QgsSimpleMarkerSymbolLayerBase::encodeShape
static QString encodeShape(QgsSimpleMarkerSymbolLayerBase::Shape shape)
Encodes a shape to its string representation.
Definition: qgsmarkersymbollayer.cpp:352
QgsSimpleMarkerSymbolLayerWidget::mLayer
QgsSimpleMarkerSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:219
QgsFontMarkerSymbolLayerWidget::setFontFamily
void setFontFamily(const QFont &font)
Definition: qgssymbollayerwidget.cpp:3394
QgsSymbolLayer::PropertyDisplacementY
@ PropertyDisplacementY
Vertical displacement.
Definition: qgssymbollayer.h:166
QgsFontMarkerSymbolLayerWidget::setSize
void setSize(double size)
Definition: qgssymbollayerwidget.cpp:3431
QgsGeometryGeneratorSymbolLayer::symbolType
QgsSymbol::SymbolType symbolType() const
Access the symbol type.
Definition: qgsgeometrygeneratorsymbollayer.h:49
QgsShapeburstFillSymbolLayerWidget::setColor2
void setColor2(const QColor &color)
Definition: qgssymbollayerwidget.cpp:1710
QgsRasterFillSymbolLayerWidget::QgsRasterFillSymbolLayerWidget
QgsRasterFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsRasterFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:3942
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
QgsGradientFillSymbolLayerWidget::applyColorRamp
void applyColorRamp()
Applies the color ramp passed on by the color ramp button.
Definition: qgssymbollayerwidget.cpp:1431
QgsFillSymbolLayer::setAngle
void setAngle(double angle)
Definition: qgssymbollayer.h:1117
QgsSimpleFillSymbolLayer::setStrokeColor
void setStrokeColor(const QColor &strokeColor) override
Set stroke color.
Definition: qgsfillsymbollayer.h:82
QgsSymbolLayer::PropertyPlacement
@ PropertyPlacement
Line marker placement.
Definition: qgssymbollayer.h:170
QgsAbstractFileContentSourceLineEdit::sourceChanged
void sourceChanged(const QString &source)
Emitted whenever the file source is changed in the widget.
QgsSymbolLayerUtils::symbolLayerPreviewIcon
static QIcon symbolLayerPreviewIcon(const QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
Draws a symbol layer preview to an icon.
Definition: qgssymbollayerutils.cpp:851
QgsGradientFillSymbolLayer::Repeat
@ Repeat
Definition: qgsfillsymbollayer.h:231
QgsGradientFillSymbolLayer::Viewport
@ Viewport
Definition: qgsfillsymbollayer.h:224
QgsFontMarkerSymbolLayer::strokeWidthMapUnitScale
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
Definition: qgsmarkersymbollayer.h:942
QgsSVGFillSymbolLayer::setPatternWidth
void setPatternWidth(double width)
Sets the width to render the SVG content as within the fill (i.e.
Definition: qgsfillsymbollayer.h:1095
QgsExpressionLineEdit::expressionChanged
void expressionChanged(const QString &expression)
Emitted when the expression is changed.
QgsFontMarkerSymbolLayer::strokeWidthUnit
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the stroke width unit.
Definition: qgsmarkersymbollayer.h:921
QgsSymbolLayer::PropertyLineAngle
@ PropertyLineAngle
Line angle, or angle of hash lines for hash line symbols.
Definition: qgssymbollayer.h:147
QgsRasterFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:4029
QgsUnitTypes::RenderMapUnits
@ RenderMapUnits
Map units.
Definition: qgsunittypes.h:169
QgsNewAuxiliaryLayerDialog
A dialog to create a new auxiliary layer.
Definition: qgsnewauxiliarylayerdialog.h:35
QgsTemplatedLineSymbolLayerBase::CentralPoint
@ CentralPoint
Place symbols at the mid point of the line.
Definition: qgslinesymbollayer.h:393
QgsGradientFillSymbolLayer::referencePoint2IsCentroid
bool referencePoint2IsCentroid() const
Definition: qgsfillsymbollayer.h:320
QgsPointPatternFillSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:3087
QgsSimpleMarkerSymbolLayerBase::shape
QgsSimpleMarkerSymbolLayerBase::Shape shape() const
Returns the shape for the rendered marker symbol.
Definition: qgsmarkersymbollayer.h:101
QgsTemplatedLineSymbolLayerBase::setAverageAngleUnit
void setAverageAngleUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the length over which the line's direction is averaged when calculating individual ...
Definition: qgslinesymbollayer.h:563
QgsPointPatternFillSymbolLayer::displacementXMapUnitScale
const QgsMapUnitScale & displacementXMapUnitScale() const
Definition: qgsfillsymbollayer.h:1669
QgsMarkerSymbolLayer::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the symbol's offset.
Definition: qgssymbollayer.h:744
QgsMarkerSymbolLayer::angle
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
Definition: qgssymbollayer.h:633
QgsSymbolLayer::PropertySecondaryColor
@ PropertySecondaryColor
Secondary color (eg for gradient fills)
Definition: qgssymbollayer.h:146
QgsGeometryGeneratorSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:4177
QgsFontMarkerSymbolLayer::fontFamily
QString fontFamily() const
Returns the font family name for the associated font which will be used to render the point.
Definition: qgsmarkersymbollayer.h:848
QgsShapeburstFillSymbolLayerWidget::symbolLayer
QgsSymbolLayer * symbolLayer() override
Definition: qgssymbollayerwidget.cpp:1696
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
QgsShapeburstFillSymbolLayer::setUseWholeShape
void setUseWholeShape(bool useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
Definition: qgsfillsymbollayer.h:492
QgsSimpleLineSymbolLayerWidget::QgsSimpleLineSymbolLayerWidget
QgsSimpleLineSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsSimpleLineSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:190
QgsPointPatternFillSymbolLayer::offsetX
double offsetX() const
Returns the horizontal offset values for points in the pattern.
Definition: qgsfillsymbollayer.h:1595
QgsSimpleFillSymbolLayerWidget::mLayer
QgsSimpleFillSymbolLayer * mLayer
Definition: qgssymbollayerwidget.h:279
QgsCentroidFillSymbolLayerWidget::QgsCentroidFillSymbolLayerWidget
QgsCentroidFillSymbolLayerWidget(QgsVectorLayer *vl, QWidget *parent=nullptr)
Constructor for QgsCentroidFillSymbolLayerWidget.
Definition: qgssymbollayerwidget.cpp:3610
QgsShapeburstFillSymbolLayer::SimpleTwoColor
@ SimpleTwoColor
Definition: qgsfillsymbollayer.h:421
QgsSimpleLineSymbolLayer::dashPatternOffsetUnit
QgsUnitTypes::RenderUnit dashPatternOffsetUnit() const
Returns the units for the dash pattern offset.
Definition: qgslinesymbollayer.h:245
QgsHashedLineSymbolLayerWidget::setSymbolLayer
void setSymbolLayer(QgsSymbolLayer *layer) override
Definition: qgssymbollayerwidget.cpp:2108
QgsFontUtils::updateFontViaStyle
static bool updateFontViaStyle(QFont &f, const QString &fontstyle, bool fallback=false)
Updates font with named style and retain all font properties.
Definition: qgsfontutils.cpp:122
QgsPointPatternFillSymbolLayer::offsetXMapUnitScale
const QgsMapUnitScale & offsetXMapUnitScale() const
Returns the unit scale for the horizontal offset for rows in the pattern.
Definition: qgsfillsymbollayer.h:1721
QgsGradientFillSymbolLayer::SimpleTwoColor
@ SimpleTwoColor
Definition: qgsfillsymbollayer.h:210
QgsFontMarkerSymbolLayerWidget::widgetChar
CharacterWidget * widgetChar
Definition: qgssymbollayerwidget.h:1014
QgsExpressionContext::hasVariable
bool hasVariable(const QString &name) const
Check whether a variable is specified by any scope within the context.
Definition: qgsexpressioncontext.cpp:285
QgsFontMarkerSymbolLayer::strokeWidth
double strokeWidth() const
Returns the marker's stroke width.
Definition: qgsmarkersymbollayer.h:899
QgsSymbolLayer::PropertyJoinStyle
@ PropertyJoinStyle
Line join style.
Definition: qgssymbollayer.h:145
QgsPointPatternFillSymbolLayer::setOffsetXUnit
void setOffsetXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal offset between rows in the pattern.
Definition: qgsfillsymbollayer.h:1696
QgsSimpleFillSymbolLayer::setStrokeStyle
void setStrokeStyle(Qt::PenStyle strokeStyle)
Definition: qgsfillsymbollayer.h:88
QgsGradientFillSymbolLayer::setGradientType
void setGradientType(GradientType gradientType)
Definition: qgsfillsymbollayer.h:271
QgsSimpleMarkerSymbolLayerWidget::setColorStroke
void setColorStroke(const QColor &color)
Definition: qgssymbollayerwidget.cpp:751
QgsColorRampButton::colorRampChanged
void colorRampChanged()
Emitted whenever a new color ramp is set for the button.
QgsTemplatedLineSymbolLayerBase::averageAngleUnit
QgsUnitTypes::RenderUnit averageAngleUnit() const
Returns the unit for the length over which the line's direction is averaged when calculating individu...
Definition: qgslinesymbollayer.h:573
QgsTemplatedLineSymbolLayerBase::setIntervalUnit
void setIntervalUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the interval between symbols.
Definition: qgslinesymbollayer.h:441
QgsSymbolLayer::PropertyWidth
@ PropertyWidth
Symbol width.
Definition: qgssymbollayer.h:141
QgsSimpleMarkerSymbolLayerWidget::setColorFill
void setColorFill(const QColor &color)
Definition: qgssymbollayerwidget.cpp:757
QgsMarkerSymbolLayer::sizeMapUnitScale
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.
Definition: qgssymbollayer.h:695
QgsGradientFillSymbolLayer::setColor2
void setColor2(const QColor &color2)
Definition: qgsfillsymbollayer.h:296
QgsGradientFillSymbolLayer::Pad
@ Pad
Definition: qgsfillsymbollayer.h:229