49#include <QAbstractButton>
52#include <QButtonGroup>
53#include <QColorDialog>
57#include <QInputDialog>
62#include <QRegularExpression>
63#include <QStandardItemModel>
65#include <QSvgRenderer>
67#include "moc_qgssymbollayerwidget.cpp"
69using namespace Qt::StringLiterals;
73 if (
auto *lExpressionContext = mContext.expressionContext() )
74 return *lExpressionContext;
85 expContext << symbolScope;
98 const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
107 QStringList highlights;
113 << u
"symbol_layer_count"_s << u
"symbol_layer_index"_s << u
"symbol_frame"_s;
118 highlights << u
"zoom_level"_s;
120 if ( expContext.
hasVariable( u
"vector_tile_zoom"_s ) )
122 highlights << u
"vector_tile_zoom"_s;
133 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
136 unitWidget->setMapCanvas( mContext.mapCanvas() );
154void QgsSymbolLayerWidget::createAuxiliaryField()
164 if ( !mVectorLayer->auxiliaryLayer() )
167 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
172 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
174 QgsNewAuxiliaryFieldDialog dlg( def, mVectorLayer,
true,
this );
175 if ( dlg.exec() == QDialog::Accepted )
176 def = dlg.propertyDefinition();
180 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
186 property.setActive(
true );
208 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
209 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
213 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
215 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [
this] {
216 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
217 if ( !mCheckAlignDash->isChecked() )
218 mCheckDashCorners->setChecked(
false );
222 mLayer->setAlignDashPattern( mCheckAlignDash->isChecked() );
226 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [
this] {
229 mLayer->setTweakDashPatternOnCorners( mCheckDashCorners->isChecked() );
241 btnChangeColor->setAllowOpacity(
true );
242 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
243 btnChangeColor->setContext( u
"symbology"_s );
245 mColorDDBtn->registerLinkedWidget( btnChangeColor );
250 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
258 spinOffset->setClearValue( 0.0 );
259 spinPatternOffset->setClearValue( 0.0 );
261 mTrimStartDistanceSpin->setClearValue( 0.0 );
262 mTrimDistanceEndSpin->setClearValue( 0.0 );
265 mAssistantPreviewSymbol = std::make_shared<QgsLineSymbol>();
268 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
270 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
272 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
273 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
274 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
275 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
276 connect( spinPatternOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
278 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
282 mLayer->setTrimDistanceStart( value );
289 mLayer->setTrimDistanceStartUnit( mTrimDistanceStartUnitWidget->unit() );
290 mLayer->setTrimDistanceStartMapUnitScale( mTrimDistanceStartUnitWidget->getMapUnitScale() );
293 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
297 mLayer->setTrimDistanceEnd( value );
304 mLayer->setTrimDistanceEndUnit( mTrimDistanceEndUnitWidget->unit() );
305 mLayer->setTrimDistanceEndMapUnitScale( mTrimDistanceEndUnitWidget->getMapUnitScale() );
317void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
319 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
321 mAssistantPreviewSymbol->deleteSymbolLayer( i );
323 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
326 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
332 if ( !layer || layer->
layerType() !=
"SimpleLine"_L1 )
339 mPenWidthUnitWidget->blockSignals(
true );
340 mPenWidthUnitWidget->setUnit(
mLayer->widthUnit() );
342 mPenWidthUnitWidget->blockSignals(
false );
343 mOffsetUnitWidget->blockSignals(
true );
344 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
345 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
346 mOffsetUnitWidget->blockSignals(
false );
347 mDashPatternUnitWidget->blockSignals(
true );
348 mDashPatternUnitWidget->setUnit(
mLayer->customDashPatternUnit() );
349 mDashPatternUnitWidget->setMapUnitScale(
mLayer->customDashPatternMapUnitScale() );
350 mDashPatternUnitWidget->blockSignals(
false );
353 whileBlocking( mPatternOffsetUnitWidget )->setMapUnitScale(
mLayer->dashPatternOffsetMapUnitScale() );
355 whileBlocking( mTrimDistanceStartUnitWidget )->setMapUnitScale(
mLayer->trimDistanceStartMapUnitScale() );
357 whileBlocking( mTrimDistanceEndUnitWidget )->setMapUnitScale(
mLayer->trimDistanceEndMapUnitScale() );
360 spinWidth->blockSignals(
true );
361 spinWidth->setValue(
mLayer->width() );
362 spinWidth->blockSignals(
false );
363 btnChangeColor->blockSignals(
true );
364 btnChangeColor->setColor(
mLayer->color() );
365 btnChangeColor->blockSignals(
false );
366 spinOffset->blockSignals(
true );
367 spinOffset->setValue(
mLayer->offset() );
368 spinOffset->blockSignals(
false );
369 cboPenStyle->blockSignals(
true );
370 cboJoinStyle->blockSignals(
true );
371 cboCapStyle->blockSignals(
true );
372 cboPenStyle->setPenStyle(
mLayer->penStyle() );
373 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
374 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
375 cboPenStyle->blockSignals(
false );
376 cboJoinStyle->blockSignals(
false );
377 cboCapStyle->blockSignals(
false );
383 const bool useCustomDashPattern =
mLayer->useCustomDashPattern();
384 mChangePatternButton->setEnabled( useCustomDashPattern );
385 label_3->setEnabled( !useCustomDashPattern );
386 cboPenStyle->setEnabled( !useCustomDashPattern );
387 mCustomCheckBox->blockSignals(
true );
388 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
389 mCustomCheckBox->blockSignals(
false );
392 const QSize size = mChangePatternButton->minimumSizeHint();
394 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
397 const bool drawInsidePolygon =
mLayer->drawInsidePolygon();
398 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
400 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData(
mLayer->ringFilter() ) );
403 mCheckDashCorners->setEnabled(
mLayer->alignDashPattern() );
419 updateAssistantSymbol();
431 switch (
context.symbolType() )
436 mDrawInsideCheckBox->hide();
437 mRingFilterComboBox->hide();
447void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
454void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
456 mLayer->setColor( color );
460void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
462 mLayer->setPenStyle( cboPenStyle->penStyle() );
463 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
464 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
469void QgsSimpleLineSymbolLayerWidget::offsetChanged()
471 mLayer->setOffset( spinOffset->value() );
476void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
478 mLayer->setDashPatternOffset( spinPatternOffset->value() );
483void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
485 const bool checked = ( state == Qt::Checked );
486 mChangePatternButton->setEnabled( checked );
487 label_3->setEnabled( !checked );
488 cboPenStyle->setEnabled( !checked );
490 mLayer->setUseCustomDashPattern( checked );
494void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
499 QgsDashSpaceWidget *widget =
new QgsDashSpaceWidget(
mLayer->customDashVector(), panel );
501 widget->
setUnit( mDashPatternUnitWidget->unit() );
511 QgsDashSpaceDialog d(
mLayer->customDashVector() );
512 d.setUnit( mDashPatternUnitWidget->unit() );
513 if ( d.exec() == QDialog::Accepted )
515 mLayer->setCustomDashVector( d.dashDotVector() );
521void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
525 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
526 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
532void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
536 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
537 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
542void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
546 mLayer->setCustomDashPatternUnit( mDashPatternUnitWidget->unit() );
547 mLayer->setCustomDashPatternMapUnitScale( mDashPatternUnitWidget->getMapUnitScale() );
553void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
555 const bool checked = ( state == Qt::Checked );
556 mLayer->setDrawInsidePolygon( checked );
560void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
564 mLayer->setDashPatternOffsetUnit( mPatternOffsetUnitWidget->unit() );
565 mLayer->setDashPatternOffsetMapUnitScale( mPatternOffsetUnitWidget->getMapUnitScale() );
577 std::unique_ptr<QgsSimpleLineSymbolLayer> layerCopy(
mLayer->clone() );
582 const QColor color = qApp->palette().color( QPalette::WindowText );
583 layerCopy->setColor( color );
585 layerCopy->setOffset( 0 );
586 layerCopy->setUseCustomDashPattern(
true );
588 QSize currentIconSize;
591 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
593 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
596 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
602 const std::unique_ptr<QgsLineSymbol> previewSymbol = std::make_unique<QgsLineSymbol>(
QgsSymbolLayerList() << layerCopy.release() );
604 mChangePatternButton->setIconSize( currentIconSize );
605 mChangePatternButton->setIcon( icon );
609 const int width =
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
610 const int height =
static_cast<int>( width / 1.61803398875 );
614 QBuffer buffer( &data );
615 pm.save( &buffer,
"PNG", 100 );
616 mChangePatternButton->setToolTip( u
"<img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString( data.toBase64() ) ).arg( width ) );
621 QgsSymbolLayerWidget::resizeEvent( event );
648 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
649 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
650 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
651 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
656 btnChangeColorFill->setAllowOpacity(
true );
657 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
658 btnChangeColorFill->setContext( u
"symbology"_s );
659 btnChangeColorFill->setShowNoColor(
true );
660 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
661 btnChangeColorStroke->setAllowOpacity(
true );
662 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
663 btnChangeColorStroke->setContext( u
"symbology"_s );
664 btnChangeColorStroke->setShowNoColor(
true );
665 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
667 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
668 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
670 spinOffsetX->setClearValue( 0.0 );
671 spinOffsetY->setClearValue( 0.0 );
672 spinAngle->setClearValue( 0.0 );
675 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
678 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
680 int size = lstNames->iconSize().width();
682 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
684 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
685 lstNames->setIconSize( QSize( size, size ) );
687 const double markerSize = size * 0.8;
693 lyr->
setColor( QColor( 200, 200, 200 ) );
696 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
697 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
702 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
704 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
707 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
708 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
709 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
710 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
711 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
712 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
720 if ( layer->
layerType() !=
"SimpleMarker"_L1 )
728 for (
int i = 0; i < lstNames->count(); ++i )
730 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
732 lstNames->setCurrentRow( i );
736 btnChangeColorStroke->blockSignals(
true );
737 btnChangeColorStroke->setColor(
mLayer->strokeColor() );
738 btnChangeColorStroke->blockSignals(
false );
739 btnChangeColorFill->blockSignals(
true );
740 btnChangeColorFill->setColor(
mLayer->fillColor() );
742 btnChangeColorFill->blockSignals(
false );
743 spinSize->blockSignals(
true );
744 spinSize->setValue(
mLayer->size() );
745 spinSize->blockSignals(
false );
746 spinAngle->blockSignals(
true );
747 spinAngle->setValue(
mLayer->angle() );
748 spinAngle->blockSignals(
false );
749 mStrokeStyleComboBox->blockSignals(
true );
750 mStrokeStyleComboBox->setPenStyle(
mLayer->strokeStyle() );
751 mStrokeStyleComboBox->blockSignals(
false );
752 mStrokeWidthSpinBox->blockSignals(
true );
753 mStrokeWidthSpinBox->setValue(
mLayer->strokeWidth() );
754 mStrokeWidthSpinBox->blockSignals(
false );
755 cboJoinStyle->blockSignals(
true );
756 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
757 cboJoinStyle->blockSignals(
false );
758 cboCapStyle->blockSignals(
true );
759 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
760 cboCapStyle->blockSignals(
false );
763 spinOffsetX->blockSignals(
true );
764 spinOffsetX->setValue(
mLayer->offset().x() );
765 spinOffsetX->blockSignals(
false );
766 spinOffsetY->blockSignals(
true );
767 spinOffsetY->setValue(
mLayer->offset().y() );
768 spinOffsetY->blockSignals(
false );
770 mSizeUnitWidget->blockSignals(
true );
771 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
772 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
773 mSizeUnitWidget->blockSignals(
false );
774 mOffsetUnitWidget->blockSignals(
true );
775 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
776 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
777 mOffsetUnitWidget->blockSignals(
false );
778 mStrokeWidthUnitWidget->blockSignals(
true );
779 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
780 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
781 mStrokeWidthUnitWidget->blockSignals(
false );
784 mHorizontalAnchorComboBox->blockSignals(
true );
785 mVerticalAnchorComboBox->blockSignals(
true );
786 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
787 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
788 mHorizontalAnchorComboBox->blockSignals(
false );
789 mVerticalAnchorComboBox->blockSignals(
false );
804 updateAssistantSymbol();
812void QgsSimpleMarkerSymbolLayerWidget::setShape()
821 mLayer->setStrokeColor( color );
827 mLayer->setColor( color );
831void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
837void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
839 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
843void QgsSimpleMarkerSymbolLayerWidget::setSize()
845 mLayer->setSize( spinSize->value() );
849void QgsSimpleMarkerSymbolLayerWidget::setAngle()
851 mLayer->setAngle( spinAngle->value() );
855void QgsSimpleMarkerSymbolLayerWidget::setOffset()
857 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
861void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
867 mLayer->setStrokeStyle( mStrokeStyleComboBox->penStyle() );
872void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
876 mLayer->setStrokeWidth( d );
881void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
885 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
886 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
891void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
895 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
896 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
901void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
905 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
906 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
911void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
920void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
929void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
931 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
933 mAssistantPreviewSymbol->deleteSymbolLayer( i );
935 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
938 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
955 btnChangeColor->setAllowOpacity(
true );
956 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
957 btnChangeColor->setContext( u
"symbology"_s );
958 btnChangeColor->setShowNoColor(
true );
959 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
960 btnChangeStrokeColor->setAllowOpacity(
true );
961 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
962 btnChangeStrokeColor->setContext( u
"symbology"_s );
963 btnChangeStrokeColor->setShowNoColor(
true );
964 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
966 spinOffsetX->setClearValue( 0.0 );
967 spinOffsetY->setClearValue( 0.0 );
970 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
972 connect( spinStrokeWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
973 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
974 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
975 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
976 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
978 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
979 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
984 if ( layer->
layerType() !=
"SimpleFill"_L1 )
991 btnChangeColor->blockSignals(
true );
993 btnChangeColor->blockSignals(
false );
994 cboFillStyle->blockSignals(
true );
995 cboFillStyle->setBrushStyle(
mLayer->brushStyle() );
996 cboFillStyle->blockSignals(
false );
997 btnChangeStrokeColor->blockSignals(
true );
998 btnChangeStrokeColor->setColor(
mLayer->strokeColor() );
999 btnChangeStrokeColor->blockSignals(
false );
1000 cboStrokeStyle->blockSignals(
true );
1001 cboStrokeStyle->setPenStyle(
mLayer->strokeStyle() );
1002 cboStrokeStyle->blockSignals(
false );
1003 spinStrokeWidth->blockSignals(
true );
1004 spinStrokeWidth->setValue(
mLayer->strokeWidth() );
1005 spinStrokeWidth->blockSignals(
false );
1006 cboJoinStyle->blockSignals(
true );
1007 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
1008 cboJoinStyle->blockSignals(
false );
1009 spinOffsetX->blockSignals(
true );
1010 spinOffsetX->setValue(
mLayer->offset().x() );
1011 spinOffsetX->blockSignals(
false );
1012 spinOffsetY->blockSignals(
true );
1013 spinOffsetY->setValue(
mLayer->offset().y() );
1014 spinOffsetY->blockSignals(
false );
1016 mStrokeWidthUnitWidget->blockSignals(
true );
1017 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
1018 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
1019 mStrokeWidthUnitWidget->blockSignals(
false );
1020 mOffsetUnitWidget->blockSignals(
true );
1021 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1022 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1023 mOffsetUnitWidget->blockSignals(
false );
1041 mLayer->setColor( color );
1047 mLayer->setStrokeColor( color );
1051void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1057void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1059 mLayer->setStrokeWidth( spinStrokeWidth->value() );
1063void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1065 mLayer->setStrokeStyle( cboStrokeStyle->penStyle() );
1066 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
1070void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1072 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1076void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1080 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
1081 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
1086void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1090 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1091 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1115 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1116 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1120 spinOffsetX->setClearValue( 0.0 );
1121 spinOffsetY->setClearValue( 0.0 );
1122 spinAngle->setClearValue( 0.0 );
1125 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
1128 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1130 int size = lstNames->iconSize().width();
1131 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1132 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1133 lstNames->setIconSize( QSize( size, size ) );
1135 const double markerSize = size * 0.8;
1141 lyr->
setColor( QColor( 200, 200, 200 ) );
1144 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1145 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
1150 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1152 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1153 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1154 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1155 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1156 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1164 if ( layer->
layerType() !=
"FilledMarker"_L1 )
1172 for (
int i = 0; i < lstNames->count(); ++i )
1174 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1176 lstNames->setCurrentRow( i );
1185 mSizeUnitWidget->blockSignals(
true );
1186 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
1187 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
1188 mSizeUnitWidget->blockSignals(
false );
1189 mOffsetUnitWidget->blockSignals(
true );
1190 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1191 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1192 mOffsetUnitWidget->blockSignals(
false );
1195 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
1196 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
1205 updateAssistantSymbol();
1213void QgsFilledMarkerSymbolLayerWidget::setShape()
1219void QgsFilledMarkerSymbolLayerWidget::setSize()
1221 mLayer->setSize( spinSize->value() );
1225void QgsFilledMarkerSymbolLayerWidget::setAngle()
1227 mLayer->setAngle( spinAngle->value() );
1231void QgsFilledMarkerSymbolLayerWidget::setOffset()
1233 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1237void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1241 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
1242 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
1247void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1251 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1252 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1257void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
1266void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
1275void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1277 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
1279 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1281 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
1284 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1297 connect( mSpinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1300 btnColorRamp->setShowGradientOnly(
true );
1302 btnChangeColor->setAllowOpacity(
true );
1303 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1304 btnChangeColor->setContext( u
"symbology"_s );
1305 btnChangeColor->setShowNoColor(
true );
1306 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1307 btnChangeColor2->setAllowOpacity(
true );
1308 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1309 btnChangeColor2->setContext( u
"symbology"_s );
1310 btnChangeColor2->setShowNoColor(
true );
1311 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1313 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1314 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1316 spinOffsetX->setClearValue( 0.0 );
1317 spinOffsetY->setClearValue( 0.0 );
1318 mSpinAngle->setClearValue( 0.0 );
1326 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1327 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1328 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1329 connect( spinRefPoint1X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1330 connect( spinRefPoint1Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1331 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1332 connect( spinRefPoint2X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1333 connect( spinRefPoint2Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1334 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1339 if ( layer->
layerType() !=
"GradientFill"_L1 )
1346 btnChangeColor->blockSignals(
true );
1348 btnChangeColor->blockSignals(
false );
1349 btnChangeColor2->blockSignals(
true );
1350 btnChangeColor2->setColor(
mLayer->color2() );
1351 btnChangeColor2->blockSignals(
false );
1355 radioTwoColor->setChecked(
true );
1356 btnColorRamp->setEnabled(
false );
1360 radioColorRamp->setChecked(
true );
1361 btnChangeColor->setEnabled(
false );
1362 btnChangeColor2->setEnabled(
false );
1366 if (
mLayer->colorRamp() )
1368 btnColorRamp->blockSignals(
true );
1369 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1370 btnColorRamp->blockSignals(
false );
1373 cboGradientType->blockSignals(
true );
1374 switch (
mLayer->gradientType() )
1377 cboGradientType->setCurrentIndex( 0 );
1380 cboGradientType->setCurrentIndex( 1 );
1383 cboGradientType->setCurrentIndex( 2 );
1386 cboGradientType->blockSignals(
false );
1388 cboCoordinateMode->blockSignals(
true );
1389 switch (
mLayer->coordinateMode() )
1392 cboCoordinateMode->setCurrentIndex( 1 );
1393 checkRefPoint1Centroid->setEnabled(
false );
1394 checkRefPoint2Centroid->setEnabled(
false );
1398 cboCoordinateMode->setCurrentIndex( 0 );
1401 cboCoordinateMode->blockSignals(
false );
1403 cboGradientSpread->blockSignals(
true );
1404 switch (
mLayer->gradientSpread() )
1407 cboGradientSpread->setCurrentIndex( 0 );
1410 cboGradientSpread->setCurrentIndex( 1 );
1413 cboGradientSpread->setCurrentIndex( 2 );
1416 cboGradientSpread->blockSignals(
false );
1418 spinRefPoint1X->blockSignals(
true );
1419 spinRefPoint1X->setValue(
mLayer->referencePoint1().x() );
1420 spinRefPoint1X->blockSignals(
false );
1421 spinRefPoint1Y->blockSignals(
true );
1422 spinRefPoint1Y->setValue(
mLayer->referencePoint1().y() );
1423 spinRefPoint1Y->blockSignals(
false );
1424 checkRefPoint1Centroid->blockSignals(
true );
1425 checkRefPoint1Centroid->setChecked(
mLayer->referencePoint1IsCentroid() );
1426 if (
mLayer->referencePoint1IsCentroid() )
1428 spinRefPoint1X->setEnabled(
false );
1429 spinRefPoint1Y->setEnabled(
false );
1431 checkRefPoint1Centroid->blockSignals(
false );
1432 spinRefPoint2X->blockSignals(
true );
1433 spinRefPoint2X->setValue(
mLayer->referencePoint2().x() );
1434 spinRefPoint2X->blockSignals(
false );
1435 spinRefPoint2Y->blockSignals(
true );
1436 spinRefPoint2Y->setValue(
mLayer->referencePoint2().y() );
1437 spinRefPoint2Y->blockSignals(
false );
1438 checkRefPoint2Centroid->blockSignals(
true );
1439 checkRefPoint2Centroid->setChecked(
mLayer->referencePoint2IsCentroid() );
1440 if (
mLayer->referencePoint2IsCentroid() )
1442 spinRefPoint2X->setEnabled(
false );
1443 spinRefPoint2Y->setEnabled(
false );
1445 checkRefPoint2Centroid->blockSignals(
false );
1447 spinOffsetX->blockSignals(
true );
1448 spinOffsetX->setValue(
mLayer->offset().x() );
1449 spinOffsetX->blockSignals(
false );
1450 spinOffsetY->blockSignals(
true );
1451 spinOffsetY->setValue(
mLayer->offset().y() );
1452 spinOffsetY->blockSignals(
false );
1453 mSpinAngle->blockSignals(
true );
1454 mSpinAngle->setValue(
mLayer->angle() );
1455 mSpinAngle->blockSignals(
false );
1457 mOffsetUnitWidget->blockSignals(
true );
1458 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1459 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1460 mOffsetUnitWidget->blockSignals(
false );
1484 mLayer->setColor( color );
1490 mLayer->setColor2( color );
1494void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1496 if ( radioTwoColor->isChecked() )
1509 if ( btnColorRamp->isNull() )
1512 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
1523 spinRefPoint1X->setValue( 0.5 );
1524 spinRefPoint1Y->setValue( 0 );
1525 spinRefPoint2X->setValue( 0.5 );
1526 spinRefPoint2Y->setValue( 1 );
1531 spinRefPoint1X->setValue( 0 );
1532 spinRefPoint1Y->setValue( 0 );
1533 spinRefPoint2X->setValue( 1 );
1534 spinRefPoint2Y->setValue( 1 );
1538 spinRefPoint1X->setValue( 0.5 );
1539 spinRefPoint1Y->setValue( 0.5 );
1540 spinRefPoint2X->setValue( 1 );
1541 spinRefPoint2Y->setValue( 1 );
1555 checkRefPoint1Centroid->setEnabled(
true );
1556 checkRefPoint2Centroid->setEnabled(
true );
1562 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1563 checkRefPoint1Centroid->setEnabled(
false );
1564 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1565 checkRefPoint2Centroid->setEnabled(
false );
1590void QgsGradientFillSymbolLayerWidget::offsetChanged()
1592 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1596void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1598 mLayer->setReferencePoint1( QPointF( spinRefPoint1X->value(), spinRefPoint1Y->value() ) );
1599 mLayer->setReferencePoint1IsCentroid( checkRefPoint1Centroid->isChecked() );
1600 mLayer->setReferencePoint2( QPointF( spinRefPoint2X->value(), spinRefPoint2Y->value() ) );
1601 mLayer->setReferencePoint2IsCentroid( checkRefPoint2Centroid->isChecked() );
1605void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1607 mLayer->setAngle( value );
1611void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1615 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1616 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1629 connect( mSpinBlurRadius, qOverload<int>( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1630 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1632 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1634 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1638 QButtonGroup *group1 =
new QButtonGroup(
this );
1639 group1->addButton( radioColorRamp );
1640 group1->addButton( radioTwoColor );
1641 QButtonGroup *group2 =
new QButtonGroup(
this );
1642 group2->addButton( mRadioUseMaxDistance );
1643 group2->addButton( mRadioUseWholeShape );
1644 btnChangeColor->setAllowOpacity(
true );
1645 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1646 btnChangeColor->setContext( u
"symbology"_s );
1647 btnChangeColor->setShowNoColor(
true );
1648 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1649 btnChangeColor2->setAllowOpacity(
true );
1650 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1651 btnChangeColor2->setContext( u
"symbology"_s );
1652 btnChangeColor2->setShowNoColor(
true );
1653 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1655 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1656 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1658 spinOffsetX->setClearValue( 0.0 );
1659 spinOffsetY->setClearValue( 0.0 );
1660 mSpinMaxDistance->setClearValue( 5.0 );
1662 btnColorRamp->setShowGradientOnly(
true );
1668 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1669 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1670 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1672 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1673 connect( mSpinBlurRadius,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1678 if ( layer->
layerType() !=
"ShapeburstFill"_L1 )
1685 btnChangeColor->blockSignals(
true );
1687 btnChangeColor->blockSignals(
false );
1688 btnChangeColor2->blockSignals(
true );
1689 btnChangeColor2->setColor(
mLayer->color2() );
1690 btnChangeColor2->blockSignals(
false );
1694 radioTwoColor->setChecked(
true );
1695 btnColorRamp->setEnabled(
false );
1699 radioColorRamp->setChecked(
true );
1700 btnChangeColor->setEnabled(
false );
1701 btnChangeColor2->setEnabled(
false );
1704 mSpinBlurRadius->blockSignals(
true );
1705 mBlurSlider->blockSignals(
true );
1706 mSpinBlurRadius->setValue(
mLayer->blurRadius() );
1707 mBlurSlider->setValue(
mLayer->blurRadius() );
1708 mSpinBlurRadius->blockSignals(
false );
1709 mBlurSlider->blockSignals(
false );
1711 mSpinMaxDistance->blockSignals(
true );
1712 mSpinMaxDistance->setValue(
mLayer->maxDistance() );
1713 mSpinMaxDistance->blockSignals(
false );
1715 mRadioUseWholeShape->blockSignals(
true );
1716 mRadioUseMaxDistance->blockSignals(
true );
1717 if (
mLayer->useWholeShape() )
1719 mRadioUseWholeShape->setChecked(
true );
1720 mSpinMaxDistance->setEnabled(
false );
1721 mDistanceUnitWidget->setEnabled(
false );
1725 mRadioUseMaxDistance->setChecked(
true );
1726 mSpinMaxDistance->setEnabled(
true );
1727 mDistanceUnitWidget->setEnabled(
true );
1729 mRadioUseWholeShape->blockSignals(
false );
1730 mRadioUseMaxDistance->blockSignals(
false );
1732 mDistanceUnitWidget->blockSignals(
true );
1733 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
1734 mDistanceUnitWidget->setMapUnitScale(
mLayer->distanceMapUnitScale() );
1735 mDistanceUnitWidget->blockSignals(
false );
1737 mIgnoreRingsCheckBox->blockSignals(
true );
1738 mIgnoreRingsCheckBox->setCheckState(
mLayer->ignoreRings() ? Qt::Checked : Qt::Unchecked );
1739 mIgnoreRingsCheckBox->blockSignals(
false );
1742 if (
mLayer->colorRamp() )
1744 btnColorRamp->blockSignals(
true );
1745 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1746 btnColorRamp->blockSignals(
false );
1749 spinOffsetX->blockSignals(
true );
1750 spinOffsetX->setValue(
mLayer->offset().x() );
1751 spinOffsetX->blockSignals(
false );
1752 spinOffsetY->blockSignals(
true );
1753 spinOffsetY->setValue(
mLayer->offset().y() );
1754 spinOffsetY->blockSignals(
false );
1755 mOffsetUnitWidget->blockSignals(
true );
1756 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1757 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1758 mOffsetUnitWidget->blockSignals(
false );
1778 mLayer->setColor( color );
1787 mLayer->setColor2( color );
1792void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1799 if ( radioTwoColor->isChecked() )
1810void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1814 mLayer->setBlurRadius( value );
1819void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1823 mLayer->setMaxDistance( value );
1828void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1832 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
1833 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
1838void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1842 mLayer->setUseWholeShape( value );
1843 mDistanceUnitWidget->setEnabled( !value );
1848void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1850 QgsColorRamp *ramp = btnColorRamp->colorRamp();
1854 mLayer->setColorRamp( ramp );
1858void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1862 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1867void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1871 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1872 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1878void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1880 const bool checked = ( state == Qt::Checked );
1881 mLayer->setIgnoreRings( checked );
1889 , mSymbolType( symbolType )
1896 connect( mOffsetAlongLineUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed );
1901 mIntervalUnitWidget->setUnits( units );
1902 mOffsetUnitWidget->setUnits( units );
1904 mAverageAngleUnit->setUnits( units );
1905 mIntervalUnitWidget->setUnits( units );
1906 mBlankSegmentsUnitWidget->setUnits( units );
1911 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1919 spinOffset->setClearValue( 0.0 );
1920 mSpinOffsetAlongLine->setClearValue( 0.0 );
1921 mHashRotationSpinBox->setClearValue( 0 );
1922 mSpinAverageAngleLength->setClearValue( 4.0 );
1926 connect( mSpinHashLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashLength );
1927 connect( mHashRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashAngle );
1928 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsTemplatedLineSymbolLayerWidget::setRotate );
1929 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setOffset );
1930 connect( mSpinAverageAngleLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setAverageAngle );
1931 connect( mEditBlankSegmentsBtn, &QToolButton::toggled,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolEditBlankSegments );
1933 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1934 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1935 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1936 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1937 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1938 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1939 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1941 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [
this] {
1944 mLayer->setPlaceOnEveryPart( mCheckPlaceOnEveryPart->isChecked() );
1950 switch ( mSymbolType )
1956 mPlacementLabel->setText( tr(
"Hash placement" ) );
1957 chkRotateMarker->setText( tr(
"Rotate hash to follow line direction" ) );
1958 mHashLengthLabel->setVisible(
true );
1959 mSpinHashLength->setVisible(
true );
1960 mHashLengthUnitWidget->setVisible(
true );
1961 mHashLengthDDBtn->setVisible(
true );
1962 mHashRotationLabel->setVisible(
true );
1963 mHashRotationSpinBox->setVisible(
true );
1964 mHashRotationDDBtn->setVisible(
true );
1969 mPlacementLabel->setText( tr(
"Marker placement" ) );
1970 chkRotateMarker->setText( tr(
"Rotate marker to follow line direction" ) );
1971 mHashLengthLabel->setVisible(
false );
1972 mSpinHashLength->setVisible(
false );
1973 mHashLengthUnitWidget->setVisible(
false );
1974 mHashLengthDDBtn->setVisible(
false );
1975 mHashRotationLabel->setVisible(
false );
1976 mHashRotationSpinBox->setVisible(
false );
1977 mHashRotationDDBtn->setVisible(
false );
1983 switch ( mSymbolType )
1986 if ( layer->
layerType() !=
"HashLine"_L1 )
1991 if ( layer->
layerType() !=
"MarkerLine"_L1 )
1999 spinInterval->blockSignals(
true );
2000 spinInterval->setValue( mLayer->interval() );
2001 spinInterval->blockSignals(
false );
2002 mSpinOffsetAlongLine->blockSignals(
true );
2003 mSpinOffsetAlongLine->setValue( mLayer->offsetAlongLine() );
2004 mSpinOffsetAlongLine->blockSignals(
false );
2006 chkRotateMarker->blockSignals(
true );
2007 chkRotateMarker->setChecked( mLayer->rotateSymbols() );
2008 chkRotateMarker->blockSignals(
false );
2009 spinOffset->blockSignals(
true );
2010 spinOffset->setValue( mLayer->offset() );
2011 spinOffset->blockSignals(
false );
2020 whileBlocking( mCheckPlaceOnEveryPart )->setChecked( mLayer->placeOnEveryPart() );
2023 mIntervalUnitWidget->blockSignals(
true );
2024 mIntervalUnitWidget->setUnit( mLayer->intervalUnit() );
2025 mIntervalUnitWidget->
setMapUnitScale( mLayer->intervalMapUnitScale() );
2026 mIntervalUnitWidget->blockSignals(
false );
2027 mOffsetUnitWidget->blockSignals(
true );
2028 mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2029 mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2030 mOffsetUnitWidget->blockSignals(
false );
2031 mOffsetAlongLineUnitWidget->blockSignals(
true );
2032 mOffsetAlongLineUnitWidget->setUnit( mLayer->offsetAlongLineUnit() );
2033 mOffsetAlongLineUnitWidget->setMapUnitScale( mLayer->offsetAlongLineMapUnitScale() );
2034 mOffsetAlongLineUnitWidget->blockSignals(
false );
2035 whileBlocking( mAverageAngleUnit )->setUnit( mLayer->averageAngleUnit() );
2036 whileBlocking( mAverageAngleUnit )->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
2037 whileBlocking( mSpinAverageAngleLength )->setValue( mLayer->averageAngleLength() );
2038 whileBlocking( mBlankSegmentsUnitWidget )->setUnit( mLayer->blankSegmentsUnit() );
2040 switch ( mSymbolType )
2058 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
2072 updateBlankSegmentsWidget();
2084 switch (
context.symbolType() )
2089 mRingFilterComboBox->hide();
2090 mRingsLabel->hide();
2101 mLayer->setInterval( val );
2107 mLayer->setOffsetAlongLine( val );
2111void QgsTemplatedLineSymbolLayerWidget::setHashLength(
double val )
2113 switch ( mSymbolType )
2128void QgsTemplatedLineSymbolLayerWidget::setHashAngle(
double val )
2133 switch ( mSymbolType )
2137 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2148void QgsTemplatedLineSymbolLayerWidget::setRotate()
2150 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2151 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2153 mLayer->setRotateSymbols( chkRotateMarker->isChecked() );
2157void QgsTemplatedLineSymbolLayerWidget::setOffset()
2159 mLayer->setOffset( spinOffset->value() );
2163void QgsTemplatedLineSymbolLayerWidget::setPlacement()
2165 const bool interval = mCheckInterval->isChecked();
2166 spinInterval->setEnabled( interval );
2167 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2168 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2169 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2170 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2171 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2174 if ( mCheckInterval->isChecked() )
2176 if ( mCheckVertex->isChecked() )
2178 if ( mCheckVertexLast->isChecked() )
2180 if ( mCheckVertexFirst->isChecked() )
2182 if ( mCheckCurvePoint->isChecked() )
2184 if ( mCheckSegmentCentralPoint->isChecked() )
2186 if ( mCheckCentralPoint->isChecked() )
2188 mLayer->setPlacements( placements );
2193void QgsTemplatedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2197 mLayer->setIntervalUnit( mIntervalUnitWidget->unit() );
2198 mLayer->setIntervalMapUnitScale( mIntervalUnitWidget->getMapUnitScale() );
2203void QgsTemplatedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2207 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2208 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2213void QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2217 mLayer->setOffsetAlongLineUnit( mOffsetAlongLineUnitWidget->unit() );
2218 mLayer->setOffsetAlongLineMapUnitScale( mOffsetAlongLineUnitWidget->getMapUnitScale() );
2223void QgsTemplatedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2228 switch ( mSymbolType )
2232 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2244void QgsTemplatedLineSymbolLayerWidget::averageAngleUnitChanged()
2248 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
2249 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
2254void QgsTemplatedLineSymbolLayerWidget::blankSegmentsUnitChanged()
2258 mLayer->setBlankSegmentsUnit( mBlankSegmentsUnitWidget->unit() );
2263void QgsTemplatedLineSymbolLayerWidget::setAverageAngle(
double val )
2267 mLayer->setAverageAngleLength( val );
2272void QgsTemplatedLineSymbolLayerWidget::toggleMapToolEditBlankSegments(
bool toggled )
2274 if ( mMapToolEditBlankSegments )
2277 mMapToolEditBlankSegments.reset();
2282 switch ( mSymbolType )
2299void QgsTemplatedLineSymbolLayerWidget::updateBlankSegmentsWidget()
2301 mEditBlankSegmentsBtn->setEnabled( blankSegmentsFieldIndex() > -1 );
2303 switch ( mSymbolType )
2306 tooltip = tr(
"Tool to create blank segments where hashed lines won't be displayed" );
2310 tooltip = tr(
"Tool to create blank segments where marker lines won't be displayed" );
2314 if ( !mEditBlankSegmentsBtn->isEnabled() )
2316 tooltip += u
"<br/><br/>"_s + tr(
"This tool is disabled because no valid field property has been set" );
2319 mEditBlankSegmentsBtn->setToolTip( tooltip );
2322int QgsTemplatedLineSymbolLayerWidget::blankSegmentsFieldIndex()
const
2325 return blankSegmentsProperty && blankSegmentsProperty.
isActive()
2363 mSvgSelectorWidget->setAllowParameters(
true );
2364 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2365 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( u
"/UI/lastSVGMarkerDir"_s );
2366 mSvgSelectorWidget->initParametersModel(
this, vl );
2370 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2371 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2375 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2376 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2380 mChangeColorButton->setAllowOpacity(
true );
2381 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2382 mChangeColorButton->setContext( u
"symbology"_s );
2383 mChangeStrokeColorButton->setAllowOpacity(
true );
2384 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2385 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2387 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2388 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2390 spinOffsetX->setClearValue( 0.0 );
2391 spinOffsetY->setClearValue( 0.0 );
2392 spinAngle->setClearValue( 0.0 );
2394 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2395 connect( spinHeight,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2397 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2398 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2399 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2406 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
2410 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2411 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2418#include <QAbstractListModel>
2419#include <QPixmapCache>
2432 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2433 QColor defaultFill, defaultStroke;
2434 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2435 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2436 QgsApplication::svgCache()->
containsParams( layer->
path(), hasFillParam, hasDefaultFillColor, defaultFill, hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity, hasStrokeParam, hasDefaultStrokeColor, defaultStroke, hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth, hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2437 mChangeColorButton->setEnabled( hasFillParam );
2438 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2439 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2440 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2441 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2446 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2447 if ( hasDefaultFillColor && !skipDefaultColors )
2451 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2452 mChangeColorButton->setColor( fill );
2454 if ( hasStrokeParam )
2457 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2458 if ( hasDefaultStrokeColor && !skipDefaultColors )
2460 stroke = defaultStroke;
2462 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2463 mChangeStrokeColorButton->setColor( stroke );
2466 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2468 mStrokeWidthSpinBox->blockSignals(
true );
2469 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2470 mStrokeWidthSpinBox->blockSignals(
false );
2473 spinHeight->blockSignals(
true );
2474 if ( preservedAspectRatio )
2483 spinHeight->blockSignals(
false );
2484 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2487void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2489 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
2491 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2493 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
2496 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2507 if ( layer->
layerType() !=
"SvgMarker"_L1 )
2514 mSvgSelectorWidget->setSvgPath(
mLayer->path() );
2515 mSvgSelectorWidget->setSvgParameters(
mLayer->parameters() );
2517 spinWidth->blockSignals(
true );
2518 spinWidth->setValue(
mLayer->size() );
2519 spinWidth->blockSignals(
false );
2520 spinAngle->blockSignals(
true );
2521 spinAngle->setValue(
mLayer->angle() );
2522 spinAngle->blockSignals(
false );
2525 spinOffsetX->blockSignals(
true );
2526 spinOffsetX->setValue(
mLayer->offset().x() );
2527 spinOffsetX->blockSignals(
false );
2528 spinOffsetY->blockSignals(
true );
2529 spinOffsetY->setValue(
mLayer->offset().y() );
2530 spinOffsetY->blockSignals(
false );
2532 mSizeUnitWidget->blockSignals(
true );
2533 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
2535 mSizeUnitWidget->blockSignals(
false );
2536 mStrokeWidthUnitWidget->blockSignals(
true );
2537 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
2538 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
2539 mStrokeWidthUnitWidget->blockSignals(
false );
2540 mOffsetUnitWidget->blockSignals(
true );
2541 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
2542 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
2543 mOffsetUnitWidget->blockSignals(
false );
2546 mHorizontalAnchorComboBox->blockSignals(
true );
2547 mVerticalAnchorComboBox->blockSignals(
true );
2548 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
2549 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
2550 mHorizontalAnchorComboBox->blockSignals(
false );
2551 mVerticalAnchorComboBox->blockSignals(
false );
2567 updateAssistantSymbol();
2578 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2584 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2592 mLayer->setParameters( parameters );
2593 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2599void QgsSvgMarkerSymbolLayerWidget::setWidth()
2602 double fixedAspectRatio = 0.0;
2603 spinHeight->blockSignals(
true );
2604 if ( defaultAspectRatio <= 0.0 )
2606 spinHeight->setValue( spinWidth->value() );
2608 else if ( mLockAspectRatio->locked() )
2610 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2614 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2616 spinHeight->blockSignals(
false );
2617 mLayer->setSize( spinWidth->value() );
2618 mLayer->setFixedAspectRatio( fixedAspectRatio );
2622void QgsSvgMarkerSymbolLayerWidget::setHeight()
2624 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2625 double fixedAspectRatio = 0.0;
2626 spinWidth->blockSignals(
true );
2627 if ( defaultAspectRatio <= 0.0 )
2629 spinWidth->setValue( spinHeight->value() );
2631 else if ( mLockAspectRatio->locked() )
2633 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2637 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2639 spinWidth->blockSignals(
false );
2640 mLayer->setSize( spinWidth->value() );
2641 mLayer->setFixedAspectRatio( fixedAspectRatio );
2645void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2648 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2649 if ( defaultAspectRatio <= 0.0 )
2655 mLayer->setFixedAspectRatio( 0.0 );
2660 mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
2665void QgsSvgMarkerSymbolLayerWidget::setAngle()
2667 mLayer->setAngle( spinAngle->value() );
2671void QgsSvgMarkerSymbolLayerWidget::setOffset()
2673 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2677void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2684void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2691 mLayer->setFillColor( color );
2695void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2702 mLayer->setStrokeColor( color );
2706void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2710 mLayer->setStrokeWidth( d );
2715void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2719 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
2720 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
2725void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2729 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
2730 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
2735void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2739 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2740 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2745void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
2754void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
2771 mSvgSelectorWidget->setAllowParameters(
true );
2772 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2774 connect( mTextureWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2776 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2778 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2779 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2785 mRotationSpinBox->setClearValue( 0.0 );
2787 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2788 mChangeColorButton->setContext( u
"symbology"_s );
2789 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2790 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2792 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2793 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2806 if ( layer->
layerType() !=
"SVGFill"_L1 )
2814 const double width =
mLayer->patternWidth();
2815 mTextureWidthSpinBox->blockSignals(
true );
2816 mTextureWidthSpinBox->setValue( width );
2817 mTextureWidthSpinBox->blockSignals(
false );
2818 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource(
mLayer->svgFilePath() );
2819 mRotationSpinBox->blockSignals(
true );
2820 mRotationSpinBox->setValue(
mLayer->angle() );
2821 mRotationSpinBox->blockSignals(
false );
2822 mTextureWidthUnitWidget->blockSignals(
true );
2823 mTextureWidthUnitWidget->setUnit(
mLayer->patternWidthUnit() );
2824 mTextureWidthUnitWidget->setMapUnitScale(
mLayer->patternWidthMapUnitScale() );
2825 mTextureWidthUnitWidget->blockSignals(
false );
2826 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2827 mSvgStrokeWidthUnitWidget->setUnit(
mLayer->svgStrokeWidthUnit() );
2828 mSvgStrokeWidthUnitWidget->setMapUnitScale(
mLayer->svgStrokeWidthMapUnitScale() );
2829 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2830 mChangeColorButton->blockSignals(
true );
2831 mChangeColorButton->setColor(
mLayer->svgFillColor() );
2832 mChangeColorButton->blockSignals(
false );
2833 mChangeStrokeColorButton->blockSignals(
true );
2834 mChangeStrokeColorButton->setColor(
mLayer->svgStrokeColor() );
2835 mChangeStrokeColorButton->blockSignals(
false );
2836 mStrokeWidthSpinBox->blockSignals(
true );
2837 mStrokeWidthSpinBox->setValue(
mLayer->svgStrokeWidth() );
2838 mStrokeWidthSpinBox->blockSignals(
false );
2859 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2862void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2871void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2878 mLayer->setSvgFilePath( text );
2883void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2885 mLayer->setSvgFilePath( name );
2886 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2892void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
2894 mLayer->setParameters( parameters );
2895 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2902void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2914 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2915 QColor defaultFill, defaultStroke;
2916 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2917 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2918 QgsApplication::svgCache()->
containsParams( mSvgSelectorWidget->sourceLineEdit()->source(), hasFillParam, hasDefaultFillColor, defaultFill, hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity, hasStrokeParam, hasDefaultStrokeColor, defaultStroke, hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth, hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2921 QColor fill = mChangeColorButton->color();
2922 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2923 if ( hasDefaultFillColor )
2927 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2928 mChangeColorButton->setColor( fill );
2930 mChangeColorButton->setEnabled( hasFillParam );
2931 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2934 QColor stroke = mChangeStrokeColorButton->color();
2935 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2936 if ( hasDefaultStrokeColor )
2938 stroke = defaultStroke;
2940 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2941 mChangeStrokeColorButton->setColor( stroke );
2943 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2944 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2945 if ( hasDefaultStrokeWidth && resetValues )
2947 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2949 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2952void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2959 mLayer->setSvgFillColor( color );
2963void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2970 mLayer->setSvgStrokeColor( color );
2974void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2978 mLayer->setSvgStrokeWidth( d );
2983void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
2987 mLayer->setPatternWidthUnit( mTextureWidthUnitWidget->unit() );
2988 mLayer->setPatternWidthMapUnitScale( mTextureWidthUnitWidget->getMapUnitScale() );
2993void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
2997 mLayer->setSvgStrokeWidthUnit( mSvgStrokeWidthUnitWidget->unit() );
2998 mLayer->setSvgStrokeWidthMapUnitScale( mSvgStrokeWidthUnitWidget->getMapUnitScale() );
3009 connect( mAngleSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3010 connect( mDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3011 connect( mOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3016 mOffsetSpinBox->setClearValue( 0 );
3017 mAngleSpinBox->setClearValue( 0 );
3021 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3032 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3043 if ( layer->
layerType() !=
"LinePatternFill"_L1 )
3057 mDistanceUnitWidget->blockSignals(
true );
3058 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
3060 mDistanceUnitWidget->blockSignals(
false );
3061 mOffsetUnitWidget->blockSignals(
true );
3062 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3063 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3064 mOffsetUnitWidget->blockSignals(
false );
3066 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3068 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3082void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3091void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3095 mLayer->setDistance( d );
3100void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3109void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3113 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
3114 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
3119void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3123 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3124 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3135 connect( mHorizontalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3136 connect( mVerticalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3137 connect( mHorizontalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3138 connect( mVerticalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3139 connect( mHorizontalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3140 connect( mVerticalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3141 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3142 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3143 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3144 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3145 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3146 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3158 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3168 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3176 mSeedSpinBox->setShowClearButton(
true );
3177 mSeedSpinBox->setClearValue( 0 );
3178 mRandomXSpinBox->setClearValue( 0 );
3179 mRandomYSpinBox->setClearValue( 0 );
3183 connect( mRandomXSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3186 mLayer->setMaximumRandomDeviationX( d );
3190 connect( mRandomYSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3193 mLayer->setMaximumRandomDeviationY( d );
3200 mLayer->setRandomDeviationXUnit( mRandomXOffsetUnitWidget->unit() );
3201 mLayer->setRandomDeviationXMapUnitScale( mRandomXOffsetUnitWidget->getMapUnitScale() );
3208 mLayer->setRandomDeviationYUnit( mRandomYOffsetUnitWidget->unit() );
3209 mLayer->setRandomDeviationYMapUnitScale( mRandomYOffsetUnitWidget->getMapUnitScale() );
3213 connect( mSeedSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [
this](
int v ) {
3221 mAngleSpinBox->setShowClearButton(
true );
3222 mAngleSpinBox->setClearValue( 0 );
3223 connect( mAngleSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3234 if ( !layer || layer->
layerType() !=
"PointPatternFill"_L1 )
3248 mHorizontalDistanceUnitWidget->blockSignals(
true );
3249 mHorizontalDistanceUnitWidget->setUnit(
mLayer->distanceXUnit() );
3251 mHorizontalDistanceUnitWidget->blockSignals(
false );
3252 mVerticalDistanceUnitWidget->blockSignals(
true );
3253 mVerticalDistanceUnitWidget->setUnit(
mLayer->distanceYUnit() );
3254 mVerticalDistanceUnitWidget->setMapUnitScale(
mLayer->distanceYMapUnitScale() );
3255 mVerticalDistanceUnitWidget->blockSignals(
false );
3256 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3257 mHorizontalDisplacementUnitWidget->setUnit(
mLayer->displacementXUnit() );
3258 mHorizontalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementXMapUnitScale() );
3259 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3260 mVerticalDisplacementUnitWidget->blockSignals(
true );
3261 mVerticalDisplacementUnitWidget->setUnit(
mLayer->displacementYUnit() );
3262 mVerticalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementYMapUnitScale() );
3263 mVerticalDisplacementUnitWidget->blockSignals(
false );
3264 mHorizontalOffsetUnitWidget->blockSignals(
true );
3265 mHorizontalOffsetUnitWidget->setUnit(
mLayer->offsetXUnit() );
3266 mHorizontalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetXMapUnitScale() );
3267 mHorizontalOffsetUnitWidget->blockSignals(
false );
3268 mVerticalOffsetUnitWidget->blockSignals(
true );
3269 mVerticalOffsetUnitWidget->setUnit(
mLayer->offsetYUnit() );
3270 mVerticalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetYMapUnitScale() );
3271 mVerticalOffsetUnitWidget->blockSignals(
false );
3273 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3274 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3279 whileBlocking( mRandomXOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationXMapUnitScale() );
3281 whileBlocking( mRandomYOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationYMapUnitScale() );
3303void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3312void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3316 mLayer->setDistanceY( d );
3321void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3325 mLayer->setDisplacementX( d );
3330void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3334 mLayer->setDisplacementY( d );
3339void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3348void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3357void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3361 mLayer->setDistanceXUnit( mHorizontalDistanceUnitWidget->unit() );
3362 mLayer->setDistanceXMapUnitScale( mHorizontalDistanceUnitWidget->getMapUnitScale() );
3367void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3371 mLayer->setDistanceYUnit( mVerticalDistanceUnitWidget->unit() );
3372 mLayer->setDistanceYMapUnitScale( mVerticalDistanceUnitWidget->getMapUnitScale() );
3377void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3381 mLayer->setDisplacementXUnit( mHorizontalDisplacementUnitWidget->unit() );
3382 mLayer->setDisplacementXMapUnitScale( mHorizontalDisplacementUnitWidget->getMapUnitScale() );
3387void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3391 mLayer->setDisplacementYUnit( mVerticalDisplacementUnitWidget->unit() );
3392 mLayer->setDisplacementYMapUnitScale( mVerticalDisplacementUnitWidget->getMapUnitScale() );
3397void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3401 mLayer->setOffsetXUnit( mHorizontalOffsetUnitWidget->unit() );
3402 mLayer->setOffsetXMapUnitScale( mHorizontalOffsetUnitWidget->getMapUnitScale() );
3407void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3411 mLayer->setOffsetYUnit( mVerticalOffsetUnitWidget->unit() );
3412 mLayer->setOffsetYMapUnitScale( mVerticalOffsetUnitWidget->getMapUnitScale() );
3438 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3439 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3440 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3447 scrollArea->setVerticalOnly(
true );
3449 btnColor->setAllowOpacity(
true );
3450 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3451 btnColor->setContext( u
"symbology"_s );
3452 btnStrokeColor->setAllowOpacity(
true );
3453 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3454 btnStrokeColor->setContext( u
"symbology"_s );
3456 mColorDDBtn->registerLinkedWidget( btnColor );
3457 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3459 spinOffsetX->setClearValue( 0.0 );
3460 spinOffsetY->setClearValue( 0.0 );
3461 spinAngle->setClearValue( 0.0 );
3464 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
3467 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3470 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3472 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3475 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3477 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3478 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3489 if ( layer->
layerType() !=
"FontMarker"_L1 )
3498 mFontStyleComboBox->blockSignals(
true );
3499 populateFontStyleComboBox();
3500 mFontStyleComboBox->blockSignals(
false );
3512 if (
mLayer->character().length() == 1 )
3518 mCharPreview->setFont( mRefFont );
3524 mSizeUnitWidget->blockSignals(
true );
3525 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3526 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3527 mSizeUnitWidget->blockSignals(
false );
3529 mStrokeWidthUnitWidget->blockSignals(
true );
3530 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
3531 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
3532 mStrokeWidthUnitWidget->blockSignals(
false );
3534 mOffsetUnitWidget->blockSignals(
true );
3535 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3536 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3537 mOffsetUnitWidget->blockSignals(
false );
3542 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3543 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3558 updateAssistantSymbol();
3570 mLayer->setFontFamily( font.family() );
3573 mCharPreview->setFont( mRefFont );
3574 populateFontStyleComboBox();
3579void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3586 mCharPreview->setFont( mRefFont );
3593 mLayer->setColor( color );
3599 mLayer->setStrokeColor( color );
3612 mLayer->setAngle( angle );
3618 mCharPreview->setText( text );
3620 if ( text.isEmpty() )
3624 QString character = text;
3625 if ( text.contains( QRegularExpression( u
"^0x[0-9a-fA-F]{1,4}$"_s ) ) )
3628 const unsigned int value = text.toUInt( &ok, 0 );
3631 character = QChar( value );
3632 mCharPreview->setText( character );
3636 if ( character !=
mLayer->character() )
3638 mLayer->setCharacter( character );
3639 if (
mLayer->character().length() == 1 )
3653 if (
mLayer->character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3655 mCharLineEdit->insert( chr );
3659 mLayer->setCharacter( chr );
3661 mCharPreview->setText( chr );
3665void QgsFontMarkerSymbolLayerWidget::setOffset()
3667 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3671void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3673 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
3677void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3681 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
3682 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3687void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3691 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3692 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3697void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3701 mLayer->setStrokeWidthUnit( mSizeUnitWidget->unit() );
3702 mLayer->setStrokeWidthMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3707void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3709 mFontStyleComboBox->clear();
3710 const QStringList styles = mFontDB.styles( mRefFont.family() );
3711 const auto constStyles = styles;
3712 for (
const QString &style : constStyles )
3714 mFontStyleComboBox->addItem( style );
3717 QString targetStyle = mFontDB.styleString( mRefFont );
3718 if ( !styles.contains( targetStyle ) )
3721 targetStyle = QFontInfo( f ).styleName();
3722 mRefFont.setStyleName( targetStyle );
3725 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
3726 if ( stylIndx > -1 )
3731 mFontStyleComboBox->setCurrentIndex( curIndx );
3734void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3737 setFontStyle( mFontStyleComboBox->currentText() );
3740void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
3749void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
3758void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3762 mLayer->setStrokeWidth( d );
3767void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3769 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
3771 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3773 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
3776 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3788 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3789 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3790 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3791 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3796 if ( layer->
layerType() !=
"CentroidFill"_L1 )
3806 whileBlocking( mClipOnCurrentPartOnlyCheckBox )->setChecked(
mLayer->clipOnCurrentPartOnly() );
3814void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3820void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3822 mLayer->setPointOnAllParts( state == Qt::Checked );
3826void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
3828 mLayer->setClipPoints( state == Qt::Checked );
3832void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
3834 mLayer->setClipOnCurrentPartOnly( state == Qt::Checked );
3855 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
3859 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3861 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3862 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3868 mSpinOffsetX->setClearValue( 0.0 );
3869 mSpinOffsetY->setClearValue( 0.0 );
3870 mRotationSpinBox->setClearValue( 0.0 );
3872 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3873 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3876 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3877 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3887 if ( layer->
layerType() !=
"RasterMarker"_L1 )
3897 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
3898 mHeightSpinBox->blockSignals(
true );
3899 if ( preservedAspectRatio )
3901 mHeightSpinBox->setValue(
mLayer->size() );
3905 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
3907 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
3908 mHeightSpinBox->blockSignals(
false );
3909 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
3917 mSizeUnitWidget->blockSignals(
true );
3918 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3919 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3920 mSizeUnitWidget->blockSignals(
false );
3921 mOffsetUnitWidget->blockSignals(
true );
3922 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3923 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3924 mOffsetUnitWidget->blockSignals(
false );
3927 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3928 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3939 updatePreviewImage();
3950 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
3953void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
3956 updatePreviewImage();
3960void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
3962 bool fitsInCache =
false;
3964 if ( image.isNull() )
3966 mLabelImagePreview->setPixmap( QPixmap() );
3970 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3971 previewImage.fill( Qt::transparent );
3972 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3974 p.begin( &previewImage );
3976 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
3977 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3978 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3979 QBrush checkerBrush;
3980 checkerBrush.setTexture( pix );
3981 p.fillRect( imageRect, checkerBrush );
3983 if (
mLayer->opacity() < 1.0 )
3985 p.setOpacity(
mLayer->opacity() );
3988 p.drawImage( imageRect.left(), imageRect.top(), image );
3990 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3993void QgsRasterMarkerSymbolLayerWidget::setWidth()
3995 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
3996 double fixedAspectRatio = 0.0;
3997 mHeightSpinBox->blockSignals(
true );
3998 if ( defaultAspectRatio <= 0.0 )
4000 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4002 else if ( mLockAspectRatio->locked() )
4004 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4008 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4010 mHeightSpinBox->blockSignals(
false );
4011 mLayer->setSize( mWidthSpinBox->value() );
4012 mLayer->setFixedAspectRatio( fixedAspectRatio );
4016void QgsRasterMarkerSymbolLayerWidget::setHeight()
4018 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4019 double fixedAspectRatio = 0.0;
4020 mWidthSpinBox->blockSignals(
true );
4021 if ( defaultAspectRatio <= 0.0 )
4023 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4025 else if ( mLockAspectRatio->locked() )
4027 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4031 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4033 mWidthSpinBox->blockSignals(
false );
4034 mLayer->setSize( mWidthSpinBox->value() );
4035 mLayer->setFixedAspectRatio( fixedAspectRatio );
4039void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4041 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4042 if ( defaultAspectRatio <= 0.0 )
4048 mLayer->setFixedAspectRatio( 0.0 );
4053 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4057void QgsRasterMarkerSymbolLayerWidget::setAngle()
4059 mLayer->setAngle( mRotationSpinBox->value() );
4063void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4065 mLayer->setOpacity( value );
4067 updatePreviewImage();
4070void QgsRasterMarkerSymbolLayerWidget::setOffset()
4072 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4076void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4080 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4081 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4086void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4090 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4091 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4096void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4105void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4132 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastAnimatedMarkerImageDir"_s );
4136 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4138 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4139 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4142 mFrameRateSpin->setClearValue( 10 );
4143 mFrameRateSpin->setShowClearButton(
true );
4144 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
4145 mLayer->setFrameRate( value );
4152 mSpinOffsetX->setClearValue( 0.0 );
4153 mSpinOffsetY->setClearValue( 0.0 );
4154 mRotationSpinBox->setClearValue( 0.0 );
4156 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4157 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4160 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4161 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4171 if ( layer->
layerType() !=
"AnimatedMarker"_L1 )
4181 if ( firstFrameTime > 0 )
4183 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4187 mFrameRateSpin->setClearValue( 10 );
4191 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4192 mHeightSpinBox->blockSignals(
true );
4193 if ( preservedAspectRatio )
4195 mHeightSpinBox->setValue(
mLayer->size() );
4199 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4201 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4202 mHeightSpinBox->blockSignals(
false );
4203 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4213 mSizeUnitWidget->blockSignals(
true );
4214 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4215 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4216 mSizeUnitWidget->blockSignals(
false );
4217 mOffsetUnitWidget->blockSignals(
true );
4218 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4219 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4220 mOffsetUnitWidget->blockSignals(
false );
4223 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4224 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4235 updatePreviewImage();
4246 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4249void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4254 if ( firstFrameTime > 0 )
4256 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4260 mFrameRateSpin->setClearValue( 10 );
4262 updatePreviewImage();
4266void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4268 if ( mPreviewMovie )
4270 mLabelImagePreview->setMovie(
nullptr );
4271 mPreviewMovie->deleteLater();
4272 mPreviewMovie =
nullptr;
4275 mPreviewMovie =
new QMovie(
mLayer->path(), QByteArray(),
this );
4276 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4277 mLabelImagePreview->setMovie( mPreviewMovie );
4278 mPreviewMovie->start();
4281void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4283 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4284 double fixedAspectRatio = 0.0;
4285 mHeightSpinBox->blockSignals(
true );
4286 if ( defaultAspectRatio <= 0.0 )
4288 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4290 else if ( mLockAspectRatio->locked() )
4292 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4296 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4298 mHeightSpinBox->blockSignals(
false );
4299 mLayer->setSize( mWidthSpinBox->value() );
4300 mLayer->setFixedAspectRatio( fixedAspectRatio );
4304void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4306 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4307 double fixedAspectRatio = 0.0;
4308 mWidthSpinBox->blockSignals(
true );
4309 if ( defaultAspectRatio <= 0.0 )
4311 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4313 else if ( mLockAspectRatio->locked() )
4315 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4319 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4321 mWidthSpinBox->blockSignals(
false );
4322 mLayer->setSize( mWidthSpinBox->value() );
4323 mLayer->setFixedAspectRatio( fixedAspectRatio );
4327void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4329 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4330 if ( defaultAspectRatio <= 0.0 )
4336 mLayer->setFixedAspectRatio( 0.0 );
4341 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4345void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4347 mLayer->setAngle( mRotationSpinBox->value() );
4351void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4353 mLayer->setOpacity( value );
4355 updatePreviewImage();
4358void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4360 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4364void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4368 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4369 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4374void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4378 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4379 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4384void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4393void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4410 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4414 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4421 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4422 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4425 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4434 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4446 mSpinOffsetX->setClearValue( 0.0 );
4447 mSpinOffsetY->setClearValue( 0.0 );
4448 mRotationSpinBox->setClearValue( 0.0 );
4450 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4451 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4452 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4464 if ( layer->
layerType() !=
"RasterFill"_L1 )
4477 cboCoordinateMode->blockSignals(
true );
4478 switch (
mLayer->coordinateMode() )
4481 cboCoordinateMode->setCurrentIndex( 1 );
4485 cboCoordinateMode->setCurrentIndex( 0 );
4488 cboCoordinateMode->blockSignals(
false );
4494 mOffsetUnitWidget->blockSignals(
true );
4495 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4496 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4497 mOffsetUnitWidget->blockSignals(
false );
4500 mSizeUnitWidget->blockSignals(
true );
4501 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4502 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4503 mSizeUnitWidget->blockSignals(
false );
4507 updatePreviewImage();
4522void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4525 updatePreviewImage();
4529void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4546void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4553 mLayer->setOpacity( value );
4555 updatePreviewImage();
4558void QgsRasterFillSymbolLayerWidget::offsetChanged()
4560 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4564void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4570 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4571 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4575void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4584void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4586 bool fitsInCache =
false;
4588 if ( image.isNull() )
4590 mLabelImagePreview->setPixmap( QPixmap() );
4594 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4595 previewImage.fill( Qt::transparent );
4596 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4598 p.begin( &previewImage );
4600 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4601 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4602 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4603 QBrush checkerBrush;
4604 checkerBrush.setTexture( pix );
4605 p.fillRect( imageRect, checkerBrush );
4607 if (
mLayer->opacity() < 1.0 )
4609 p.setOpacity(
mLayer->opacity() );
4612 p.drawImage( imageRect.left(), imageRect.top(), image );
4614 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4628 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4636 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
4637 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
4642 connect( spinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
4645 mLayer->setWidth( spinWidth->value() );
4653 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4654 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4660 spinOffset->setClearValue( 0.0 );
4661 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
4664 mLayer->setOffset( val );
4669 connect( cboCapStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4672 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
4676 connect( cboJoinStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4679 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
4688 mLayer->setOpacity( opacity );
4689 updatePreviewImage();
4702 if ( layer->
layerType() !=
"RasterLine"_L1 )
4726 updatePreviewImage();
4741void QgsRasterLineSymbolLayerWidget::imageSourceChanged(
const QString &text )
4744 updatePreviewImage();
4748void QgsRasterLineSymbolLayerWidget::updatePreviewImage()
4750 bool fitsInCache =
false;
4752 if ( image.isNull() )
4754 mLabelImagePreview->setPixmap( QPixmap() );
4758 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4759 previewImage.fill( Qt::transparent );
4760 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4762 p.begin( &previewImage );
4764 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4765 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4766 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4767 QBrush checkerBrush;
4768 checkerBrush.setTexture( pix );
4769 p.fillRect( imageRect, checkerBrush );
4771 if (
mLayer->opacity() < 1.0 )
4773 p.setOpacity(
mLayer->opacity() );
4776 p.drawImage( imageRect.left(), imageRect.top(), image );
4778 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4791 modificationExpressionSelector->setMultiLine(
true );
4792 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
4793 modificationExpressionSelector->registerExpressionContextGenerator(
this );
4799 mUnitWidget->setShowMapScaleButton(
false );
4802 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
4804 if ( !mBlockSignals )
4806 mLayer->setUnits( mUnitWidget->unit() );
4816 modificationExpressionSelector->setExpression( mLayer->geometryExpression() );
4817 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData(
static_cast<int>( mLayer->symbolType() ) ) );
4818 mUnitWidget->setUnit( mLayer->units() );
4827void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
4834void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
4837 std::unique_ptr<QgsSymbol> subSymbol( mLayer->subSymbol()->clone() );
4839 mLayer->setSymbolType(
static_cast<Qgis::SymbolType>( cbxGeometryType->currentData().toInt() ) );
4841 switch ( mLayer->symbolType() )
4852 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
4854 if (
dynamic_cast<const QgsLineSymbolLayer *
>( subSymbol->symbolLayer( i ) ) )
4855 layers << subSymbol->symbolLayer( i )->clone();
4858 if ( !layers.empty() )
4859 mLayer->setSubSymbol(
new QgsLineSymbol( layers ) );
4868 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
4869 layers << subSymbol->symbolLayer( i )->clone();
4870 mLayer->setSubSymbol(
new QgsFillSymbol( layers ) );
4891 mPointCountSpinBox->setShowClearButton(
true );
4892 mPointCountSpinBox->setClearValue( 100 );
4893 mSeedSpinBox->setShowClearButton(
true );
4894 mSeedSpinBox->setClearValue( 0 );
4896 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
4897 connect( mPointCountSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
4898 connect( mDensityAreaSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
4899 connect( mSeedSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
4900 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [
this](
bool checked ) {
4903 mLayer->setClipPoints( checked );
4915 if ( !layer || layer->
layerType() !=
"RandomMarkerFill"_L1 )
4921 whileBlocking( mPointCountSpinBox )->setValue( mLayer->pointCount() );
4923 whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
4925 bool showDensityBasedCountWidgets =
false;
4926 switch ( mLayer->countMethod() )
4929 showDensityBasedCountWidgets =
true;
4934 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4935 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4936 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4937 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4939 whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData(
static_cast<int>( mLayer->countMethod() ) ) );
4940 whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
4941 mDensityAreaUnitWidget->blockSignals(
true );
4942 mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
4943 mDensityAreaUnitWidget->
setMapUnitScale( mLayer->densityAreaUnitScale() );
4944 mDensityAreaUnitWidget->blockSignals(
false );
4957void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
4959 bool showDensityBasedCountWidgets =
false;
4963 showDensityBasedCountWidgets =
true;
4968 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4969 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4970 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4971 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4975 mLayer->setCountMethod(
static_cast<Qgis::PointCountMethod>( mCountMethodComboBox->currentData().toInt() ) );
4980void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
4984 mLayer->setPointCount( d );
4989void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
4993 mLayer->setDensityArea( d );
4998void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
5002 mLayer->setDensityAreaUnit( mDensityAreaUnitWidget->unit() );
5003 mLayer->setDensityAreaUnitScale( mDensityAreaUnitWidget->getMapUnitScale() );
5008void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
5012 mLayer->setSeed( d );
5027 btnColorRamp->setShowGradientOnly(
true );
5029 btnChangeColor->setAllowOpacity(
true );
5030 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5031 btnChangeColor->setContext( u
"symbology"_s );
5032 btnChangeColor->setShowNoColor(
true );
5033 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
5034 btnChangeColor2->setAllowOpacity(
true );
5035 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5036 btnChangeColor2->setContext( u
"symbology"_s );
5037 btnChangeColor2->setShowNoColor(
true );
5038 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
5040 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
5041 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
5046 mLayer->setColor( color );
5053 mLayer->setColor2( color );
5058 if ( btnColorRamp->isNull() )
5063 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
5068 connect( radioTwoColor, &QAbstractButton::toggled,
this, [
this] {
5071 if ( radioTwoColor->isChecked() )
5074 btnChangeColor->setEnabled(
true );
5075 btnChangeColor2->setEnabled(
true );
5076 btnColorRamp->setEnabled(
false );
5081 btnColorRamp->setEnabled(
true );
5082 btnChangeColor->setEnabled(
false );
5083 btnChangeColor2->setEnabled(
false );
5095 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5096 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5101 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5104 mLayer->setWidth( spinWidth->value() );
5112 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5113 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5118 spinOffset->setClearValue( 0.0 );
5119 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5122 mLayer->setOffset( val );
5127 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5130 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5134 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5137 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5150 if ( layer->
layerType() !=
"Lineburst"_L1 )
5161 btnChangeColor->blockSignals(
true );
5163 btnChangeColor->blockSignals(
false );
5164 btnChangeColor2->blockSignals(
true );
5165 btnChangeColor2->setColor(
mLayer->color2() );
5166 btnChangeColor2->blockSignals(
false );
5170 radioTwoColor->setChecked(
true );
5171 btnColorRamp->setEnabled(
false );
5175 radioColorRamp->setChecked(
true );
5176 btnChangeColor->setEnabled(
false );
5177 btnChangeColor2->setEnabled(
false );
5181 if (
mLayer->colorRamp() )
5183 btnColorRamp->blockSignals(
true );
5184 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
5185 btnColorRamp->blockSignals(
false );
5228 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5229 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5234 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5237 mLayer->setWidth( spinWidth->value() );
5245 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5246 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5251 spinOffset->setClearValue( 0.0 );
5252 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5255 mLayer->setOffset( val );
5260 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5263 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5267 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5270 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5285 if ( layer->
layerType() !=
"FilledLine"_L1 )
5297 whileBlocking( mPenWidthUnitWidget )->setUnit( mLayer->widthUnit() );
5300 whileBlocking( mOffsetUnitWidget )->setUnit( mLayer->offsetUnit() );
5301 whileBlocking( mOffsetUnitWidget )->setMapUnitScale( mLayer->offsetMapUnitScale() );
5304 whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
5305 whileBlocking( cboCapStyle )->setPenCapStyle( mLayer->penCapStyle() );
5338 mSpinSkipMultiples->setClearValue( 0, tr(
"Not set" ) );
5339 mSpinLabelOffsetX->setClearValue( 0 );
5340 mSpinLabelOffsetY->setClearValue( 0 );
5341 mSpinAverageAngleLength->setClearValue( 4.0 );
5345 connect( mComboQuantity, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5346 if ( mLayer && !mBlockChangesSignal )
5353 if ( mLayer && !mBlockChangesSignal )
5355 mLayer->setTextFormat( mTextFormatButton->textFormat() );
5359 connect( spinInterval, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5360 if ( mLayer && !mBlockChangesSignal )
5362 mLayer->setInterval( spinInterval->value() );
5366 connect( mSpinSkipMultiples, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5367 if ( mLayer && !mBlockChangesSignal )
5369 mLayer->setSkipMultiplesOf( mSpinSkipMultiples->value() );
5373 connect( mCheckRotate, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5374 if ( mLayer && !mBlockChangesSignal )
5376 mLayer->setRotateLabels( checked );
5379 mSpinAverageAngleLength->setEnabled( checked );
5380 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5382 connect( mCheckShowMarker, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5383 if ( mLayer && !mBlockChangesSignal )
5385 mLayer->setShowMarker( checked );
5390 connect( mSpinLabelOffsetX, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5391 if ( mLayer && !mBlockChangesSignal )
5393 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5397 connect( mSpinLabelOffsetY, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5398 if ( mLayer && !mBlockChangesSignal )
5400 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5405 if ( mLayer && !mBlockChangesSignal )
5407 mLayer->setLabelOffsetUnit( mLabelOffsetUnitWidget->unit() );
5408 mLayer->setLabelOffsetMapUnitScale( mLabelOffsetUnitWidget->getMapUnitScale() );
5413 connect( mComboPlacement, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5414 if ( mLayer && !mBlockChangesSignal )
5417 mLayer->setPlacement( placement );
5418 switch ( placement )
5423 mIntervalWidget->show();
5426 mIntervalWidget->hide();
5433 connect( mSpinAverageAngleLength, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5434 if ( mLayer && !mBlockChangesSignal )
5436 mLayer->setAverageAngleLength( mSpinAverageAngleLength->value() );
5441 if ( mLayer && !mBlockChangesSignal )
5443 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
5444 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
5449 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsLinearReferencingSymbolLayerWidget::changeNumberFormat );
5451 mTextFormatButton->registerExpressionContextGenerator(
this );
5459 if ( !layer || layer->
layerType() !=
"LinearReferencing"_L1 )
5463 mLayer = qgis::down_cast<QgsLinearReferencingSymbolLayer *>( layer );
5465 mBlockChangesSignal =
true;
5467 mComboPlacement->setCurrentIndex( mComboPlacement->findData( QVariant::fromValue( mLayer->placement() ) ) );
5468 switch ( mLayer->placement() )
5473 mIntervalWidget->show();
5476 mIntervalWidget->hide();
5480 mComboQuantity->setCurrentIndex( mComboQuantity->findData( QVariant::fromValue( mLayer->labelSource() ) ) );
5482 mTextFormatButton->setTextFormat( mLayer->textFormat() );
5483 spinInterval->setValue( mLayer->interval() );
5484 mSpinSkipMultiples->setValue( mLayer->skipMultiplesOf() );
5485 mCheckRotate->setChecked( mLayer->rotateLabels() );
5486 mCheckShowMarker->setChecked( mLayer->showMarker() );
5487 mSpinLabelOffsetX->setValue( mLayer->labelOffset().x() );
5488 mSpinLabelOffsetY->setValue( mLayer->labelOffset().y() );
5489 mLabelOffsetUnitWidget->setUnit( mLayer->labelOffsetUnit() );
5490 mLabelOffsetUnitWidget->setMapUnitScale( mLayer->labelOffsetMapUnitScale() );
5492 mAverageAngleUnit->setUnit( mLayer->averageAngleUnit() );
5493 mAverageAngleUnit->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
5494 mSpinAverageAngleLength->setValue( mLayer->averageAngleLength() );
5496 mSpinAverageAngleLength->setEnabled( mCheckRotate->isChecked() );
5497 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5504 mBlockChangesSignal =
false;
5515 mTextFormatButton->setMapCanvas(
context.mapCanvas() );
5516 mTextFormatButton->setMessageBar(
context.messageBar() );
5519void QgsLinearReferencingSymbolLayerWidget::changeNumberFormat()
5529 if ( !mBlockChangesSignal )
5539 QgsNumericFormatSelectorDialog dialog(
this );
5540 dialog.setFormat( mLayer->numericFormat() );
5541 dialog.registerExpressionContextGenerator(
this );
5542 if ( dialog.exec() )
5544 mLayer->setNumericFormat( dialog.format() );
@ CurvePoint
Place symbols at every virtual curve point in the line (used when rendering curved geometry types onl...
@ InnerVertices
Inner vertices (i.e. all vertices except the first and last vertex).
@ LastVertex
Place symbols on the last vertex in the line.
@ CentralPoint
Place symbols at the mid point of the line.
@ SegmentCenter
Place symbols at the center of every line segment.
@ Vertex
Place symbols on every vertex in the line.
@ Interval
Place symbols at regular intervals.
@ FirstVertex
Place symbols on the first vertex in the line.
MarkerClipMode
Marker clipping modes.
@ CompletelyWithin
Render complete markers wherever the completely fall within the polygon shape.
@ NoClipping
No clipping, render complete markers.
@ Shape
Clip to polygon shape.
@ CentroidWithin
Render complete markers wherever their centroid falls within the polygon shape.
LineClipMode
Line clipping modes.
@ NoClipping
Lines are not clipped, will extend to shape's bounding box.
@ ClipPainterOnly
Applying clipping on the painter only (i.e. line endpoints will coincide with polygon bounding box,...
@ ClipToIntersection
Clip lines to intersection with polygon shape (slower) (i.e. line endpoints will coincide with polygo...
@ ColorRamp
Gradient color ramp.
@ SimpleTwoColor
Simple two color gradient.
@ Reflect
Reflect gradient.
@ Pad
Pad out gradient using colors at endpoint of gradient.
PointCountMethod
Methods which define the number of points randomly filling a polygon.
@ Absolute
The point count is used as an absolute count of markers.
@ DensityBased
The point count is part of a marker density count.
@ Field
Field based property.
MarkerShape
Marker shapes.
VerticalAnchorPoint
Marker symbol vertical anchor points.
@ Bottom
Align to bottom of symbol.
@ Center
Align to vertical center of symbol.
@ Baseline
Align to baseline of symbol, e.g. font baseline for font marker symbol layers. Treated as Bottom if n...
@ Top
Align to top of symbol.
LinearReferencingPlacement
Defines how/where the labels should be placed in a linear referencing symbol layer.
@ IntervalZ
Place labels at regular intervals, linearly interpolated using Z values.
@ Vertex
Place labels on every vertex in the line.
@ IntervalM
Place labels at regular intervals, linearly interpolated using M values.
@ IntervalCartesian2D
Place labels at regular intervals, using Cartesian distance calculations on a 2D plane.
LinearReferencingLabelSource
Defines what quantity to use for the labels shown in a linear referencing symbol layer.
@ CartesianDistance2D
Distance along line, calculated using Cartesian calculations on a 2D plane.
@ Percentage
Percentage of another measurement (e.g., canvas size, feature size).
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes).
@ MetersInMapUnits
Meters value as Map units.
@ Conical
Conical (polar) gradient.
@ Radial
Radial (circular) gradient.
SymbolCoordinateReference
Symbol coordinate reference modes.
@ Feature
Relative to feature/shape being rendered.
@ Viewport
Relative to the whole viewport/output device.
QFlags< MarkerLinePlacement > MarkerLinePlacements
HorizontalAnchorPoint
Marker symbol horizontal anchor points.
@ Center
Align to horizontal center of symbol.
@ Right
Align to right side of symbol.
@ Left
Align to left side of symbol.
static const double UI_SCALE_FACTOR
UI scaling factor.
void sourceChanged(const QString &source)
Emitted whenever the file source is changed in the widget.
Animated marker symbol layer class.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
A fill symbol layer which renders a marker symbol at the centroid of a polygon geometry.
void setPointOnSurface(bool pointOnSurface)
Single scope for storing variables and functions for use within a QgsExpressionContext.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
static const QString EXPR_GEOMETRY_RING_NUM
Inbuilt variable name for geometry ring number variable.
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
bool hasVariable(const QString &name) const
Check whether a variable is specified by any scope within the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
void expressionChanged(const QString &expression)
Emitted when the expression is changed.
Q_INVOKABLE int indexFromName(const QString &fieldName) const
Gets the field index from the field name.
A line symbol layer type which fills a stroked line with a QgsFillSymbol.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
A marker symbol layer which displays characters rendered using a font.
void setFontStyle(const QString &style)
Sets the font style for the font which will be used to render the point.
static QString translateNamedStyle(const QString &namedStyle)
Returns the localized named style of a font, if such a translation is available.
static QString untranslateNamedStyle(const QString &namedStyle)
Returns the english named style of a font, if possible.
static QFont createFont(const QString &family, int pointSize=-1, int weight=-1, bool italic=false)
Creates a font with the specified family.
static bool updateFontViaStyle(QFont &f, const QString &fontstyle, bool fallback=false)
Updates font with named style and retain all font properties.
static void setFontFamily(QFont &font, const QString &family)
Sets the family for a font object.
A symbol layer subclass which alters rendered feature shapes through the use of QGIS expressions.
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
A fill symbol layer which draws a smooth color gradient over a polygon.
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
void setGradientColorType(Qgis::GradientColorSource gradientColorType)
Sets the gradient color mode, which controls how gradient color stops are created.
Line symbol layer type which draws repeating line sections along a line feature.
void setHashLength(double length)
Sets the length of hash symbols.
double hashAngle() const
Returns the angle to use when drawing the hashed lines sections, in degrees clockwise.
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
Qgis::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
double hashLength() const
Returns the length of hash symbols.
void setHashLengthUnit(Qgis::RenderUnit unit)
Sets the unit for the length of hash symbols.
void setHashAngle(double angle)
Sets the angle to use when drawing the hashed lines sections, in degrees clockwise.
static QIcon iconLine()
Returns an icon representing line geometries.
static QIcon iconPolygon()
Returns an icon representing polygon geometries.
static QIcon iconPoint()
Returns an icon representing point geometries.
int nextFrameDelay(const QString &path, int currentFrame=0, bool blocking=false)
For image formats that support animation, this function returns the number of milliseconds to wait un...
QImage pathAsImage(const QString &path, const QSize size, const bool keepAspectRatio, const double opacity, bool &fitsInCache, bool blocking=false, double targetDpi=96, int frameNumber=-1, bool *isMissing=nullptr)
Returns the specified path rendered as an image.
A symbol fill consisting of repeated parallel lines.
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setLineAngle(double a)
Sets the angle for the parallel lines used to fill the symbol.
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon's rings.
@ ExteriorRingOnly
Render the exterior ring only.
@ InteriorRingsOnly
Render the interior rings only.
@ AllRings
Render both exterior and interior rings.
virtual void setWidth(double width)
Sets the width of the line symbol layer.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used to format the labels for the layer.
QgsNumericFormat * numericFormat() const
Returns the numeric format used to format the labels for the layer.
Line symbol layer type which draws a gradient pattern perpendicularly along a line.
void unsetMapTool(QgsMapTool *mapTool)
Unset the current map tool or last non zoom tool.
void setMapTool(QgsMapTool *mapTool, bool clean=false)
Sets the map tool currently being used on the canvas.
Struct for storing maximum and minimum scales for measurements in map units.
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
double size() const
Returns the symbol size.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's size.
A dialog to create a new auxiliary layer.
A fill symbol layer which fills polygon shapes with repeating marker symbols.
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setDistanceX(double d)
Sets the horizontal distance between rendered markers in the fill.
Qgis::PropertyType propertyType() const
Returns the property type.
QString field() const
Returns the current field name the property references.
bool isActive() const
Returns whether the property is currently active.
void setField(const QString &field)
Sets the field name the property references.
A fill symbol layer which places markers at random locations within polygons.
void setMapUnitScale(const QgsMapUnitScale &scale) override
A fill symbol layer which fills polygons with a repeated raster image.
void setOpacity(double opacity)
Sets the opacity for the raster image used in the fill.
void setImageFilePath(const QString &imagePath)
Sets the path to the raster image used for the fill.
Line symbol layer type which draws line sections using a raster image file.
void setPath(const QString &path)
Set the raster image path.
void setOpacity(double opacity)
Set the line opacity.
Raster marker symbol layer class.
void setPath(const QString &path)
Set the marker raster image path.
A fill symbol layer which fills polygons with a repeated SVG file.
void setPatternWidth(double width)
Sets the width to render the SVG content as within the fill (i.e.
Stores properties relating to a screen.
A fill symbol layer which applies a gradient from the outer edges of a symbol to the inside.
Renders polygons using a single fill and stroke color.
void setBrushStyle(Qt::BrushStyle style)
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
void setMapUnitScale(const QgsMapUnitScale &scale) override
static QList< Qgis::MarkerShape > availableShapes()
Returns a list of all available shape types.
static bool shapeIsFilled(Qgis::MarkerShape shape)
Returns true if a symbol shape has a fill.
Qgis::MarkerShape shape() const
Returns the shape for the rendered marker symbol.
static QString encodeShape(Qgis::MarkerShape shape)
Encodes a shape to its string representation.
void setShape(Qgis::MarkerShape shape)
Sets the rendered marker shape.
Simple marker symbol layer, consisting of a rendered shape with solid fill color and a stroke.
void setColor(const QColor &color) override
Sets the "representative" color for the symbol layer.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the marker's stroke join style (e.g., miter, bevel, etc).
void setStrokeColor(const QColor &color) override
Sets the marker's stroke color.
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.
A marker symbol layer which renders an SVG graphic.
QColor fillColor() const override
Returns the fill color for the symbol layer.
QString path() const
Returns the marker SVG path.
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
void setMapUnitScale(const QgsMapUnitScale &scale) override
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
double strokeWidth() const
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
static QIcon symbolLayerPreviewIcon(const QgsSymbolLayer *layer, Qgis::RenderUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::SymbolType parentSymbolType=Qgis::SymbolType::Hybrid, QgsMapLayer *mapLayer=nullptr, const QgsScreenProperties &screen=QgsScreenProperties())
Draws a symbol layer preview to an icon.
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, const QgsScreenProperties &screen=QgsScreenProperties())
Returns a pixmap preview for a color ramp.
static QIcon symbolPreviewIcon(const QgsSymbol *symbol, QSize size, int padding=0, QgsLegendPatchShape *shape=nullptr, const QgsScreenProperties &screen=QgsScreenProperties())
Returns an icon preview for a color ramp.
Abstract base class for symbol layers.
Property
Data definable properties.
@ SkipMultiples
Skip multiples of.
@ GradientType
Gradient fill type.
@ SecondaryColor
Secondary color (eg for gradient fills).
@ File
Filename, eg for svg files.
@ VerticalAnchor
Vertical anchor point.
@ GradientReference2Y
Gradient reference point 2 y.
@ GradientReference1X
Gradient reference point 1 x.
@ OffsetY
Vertical offset.
@ OffsetX
Horizontal offset.
@ GradientReference1Y
Gradient reference point 1 y.
@ BlankSegments
String list of distance to define blank segments along line for templated line symbol layers.
@ DashPatternOffset
Dash pattern offset,.
@ GradientSpread
Gradient spread mode.
@ OffsetAlongLine
Offset along line.
@ CustomDash
Custom dash pattern.
@ ShapeburstMaxDistance
Shapeburst fill from edge distance.
@ HorizontalAnchor
Horizontal anchor point.
@ StrokeStyle
Stroke style (eg solid, dashed).
@ Name
Name, eg shape name for simple markers.
@ DistanceY
Vertical distance between points.
@ DensityArea
Density area.
@ ClipPoints
Whether markers should be clipped to polygon boundaries.
@ LineClipping
Line clipping mode.
@ ShapeburstIgnoreRings
Shapeburst ignore rings.
@ Character
Character, eg for font marker symbol layers.
@ ShapeburstUseWholeShape
Shapeburst use whole shape.
@ DisplacementX
Horizontal displacement.
@ ShowMarker
Show markers.
@ CoordinateMode
Gradient coordinate mode.
@ FillStyle
Fill style (eg solid, dots).
@ GradientReference2X
Gradient reference point 2 x.
@ StrokeColor
Stroke color.
@ TrimStart
Trim distance from start of line.
@ CapStyle
Line cap style.
@ BlurRadius
Shapeburst blur radius.
@ Placement
Line marker placement.
@ MarkerClipping
Marker clipping mode.
@ RandomSeed
Random number seed.
@ LineAngle
Line angle, or angle of hash lines for hash line symbols.
@ JoinStyle
Line join style.
@ RandomOffsetY
Random offset Y.
@ DisplacementY
Vertical displacement.
@ DistanceX
Horizontal distance between points.
@ AverageAngleLength
Length to average symbol angles over.
@ GradientReference1IsCentroid
Gradient reference point 1 is centroid.
@ Interval
Line marker interval.
@ StrokeWidth
Stroke width.
@ GradientReference2IsCentroid
Gradient reference point 2 is centroid.
@ LineDistance
Distance between lines, or length of lines for hash line symbols.
@ RandomOffsetX
Random offset X.
@ TrimEnd
Trim distance from end of line.
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Base class for templated line symbols, e.g.
void setMapUnitScale(const QgsMapUnitScale &scale) final
QList< Qgis::RenderUnit > RenderUnitList
List of render units.
Represents a vector layer which manages a vector based dataset.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
QList< QgsSymbolLayer * > QgsSymbolLayerList
Single variable definition for use within a QgsExpressionContextScope.