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