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 )
2297void QgsTemplatedLineSymbolLayerWidget::updateBlankSegmentsWidget()
2299 mEditBlankSegmentsBtn->setEnabled( blankSegmentsFieldIndex() > -1 );
2301 switch ( mSymbolType )
2304 tooltip = tr(
"Tool to create blank segments where hashed lines won't be displayed" );
2308 tooltip = tr(
"Tool to create blank segments where marker lines won't be displayed" );
2312 if ( !mEditBlankSegmentsBtn->isEnabled() )
2314 tooltip += u
"<br/><br/>"_s + tr(
"This tool is disabled because no valid field property has been set" );
2317 mEditBlankSegmentsBtn->setToolTip( tooltip );
2320int QgsTemplatedLineSymbolLayerWidget::blankSegmentsFieldIndex()
const
2323 return blankSegmentsProperty && blankSegmentsProperty.
isActive()
2361 mSvgSelectorWidget->setAllowParameters(
true );
2362 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2363 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( u
"/UI/lastSVGMarkerDir"_s );
2364 mSvgSelectorWidget->initParametersModel(
this, vl );
2368 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2369 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2373 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2374 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2378 mChangeColorButton->setAllowOpacity(
true );
2379 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2380 mChangeColorButton->setContext( u
"symbology"_s );
2381 mChangeStrokeColorButton->setAllowOpacity(
true );
2382 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2383 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2385 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2386 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2388 spinOffsetX->setClearValue( 0.0 );
2389 spinOffsetY->setClearValue( 0.0 );
2390 spinAngle->setClearValue( 0.0 );
2392 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2393 connect( spinHeight,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2395 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2396 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2397 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2404 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
2408 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2409 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2416#include <QAbstractListModel>
2417#include <QPixmapCache>
2430 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2431 QColor defaultFill, defaultStroke;
2432 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2433 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2434 QgsApplication::svgCache()->
containsParams( layer->
path(), hasFillParam, hasDefaultFillColor, defaultFill, hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity, hasStrokeParam, hasDefaultStrokeColor, defaultStroke, hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth, hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2435 mChangeColorButton->setEnabled( hasFillParam );
2436 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2437 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2438 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2439 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2444 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2445 if ( hasDefaultFillColor && !skipDefaultColors )
2449 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2450 mChangeColorButton->setColor( fill );
2452 if ( hasStrokeParam )
2455 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2456 if ( hasDefaultStrokeColor && !skipDefaultColors )
2458 stroke = defaultStroke;
2460 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2461 mChangeStrokeColorButton->setColor( stroke );
2464 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2466 mStrokeWidthSpinBox->blockSignals(
true );
2467 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2468 mStrokeWidthSpinBox->blockSignals(
false );
2471 spinHeight->blockSignals(
true );
2472 if ( preservedAspectRatio )
2481 spinHeight->blockSignals(
false );
2482 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2485void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2487 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
2489 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2491 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
2494 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2505 if ( layer->
layerType() !=
"SvgMarker"_L1 )
2512 mSvgSelectorWidget->setSvgPath(
mLayer->path() );
2513 mSvgSelectorWidget->setSvgParameters(
mLayer->parameters() );
2515 spinWidth->blockSignals(
true );
2516 spinWidth->setValue(
mLayer->size() );
2517 spinWidth->blockSignals(
false );
2518 spinAngle->blockSignals(
true );
2519 spinAngle->setValue(
mLayer->angle() );
2520 spinAngle->blockSignals(
false );
2523 spinOffsetX->blockSignals(
true );
2524 spinOffsetX->setValue(
mLayer->offset().x() );
2525 spinOffsetX->blockSignals(
false );
2526 spinOffsetY->blockSignals(
true );
2527 spinOffsetY->setValue(
mLayer->offset().y() );
2528 spinOffsetY->blockSignals(
false );
2530 mSizeUnitWidget->blockSignals(
true );
2531 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
2533 mSizeUnitWidget->blockSignals(
false );
2534 mStrokeWidthUnitWidget->blockSignals(
true );
2535 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
2536 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
2537 mStrokeWidthUnitWidget->blockSignals(
false );
2538 mOffsetUnitWidget->blockSignals(
true );
2539 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
2540 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
2541 mOffsetUnitWidget->blockSignals(
false );
2544 mHorizontalAnchorComboBox->blockSignals(
true );
2545 mVerticalAnchorComboBox->blockSignals(
true );
2546 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
2547 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
2548 mHorizontalAnchorComboBox->blockSignals(
false );
2549 mVerticalAnchorComboBox->blockSignals(
false );
2565 updateAssistantSymbol();
2576 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2582 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2590 mLayer->setParameters( parameters );
2591 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2597void QgsSvgMarkerSymbolLayerWidget::setWidth()
2600 double fixedAspectRatio = 0.0;
2601 spinHeight->blockSignals(
true );
2602 if ( defaultAspectRatio <= 0.0 )
2604 spinHeight->setValue( spinWidth->value() );
2606 else if ( mLockAspectRatio->locked() )
2608 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2612 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2614 spinHeight->blockSignals(
false );
2615 mLayer->setSize( spinWidth->value() );
2616 mLayer->setFixedAspectRatio( fixedAspectRatio );
2620void QgsSvgMarkerSymbolLayerWidget::setHeight()
2622 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2623 double fixedAspectRatio = 0.0;
2624 spinWidth->blockSignals(
true );
2625 if ( defaultAspectRatio <= 0.0 )
2627 spinWidth->setValue( spinHeight->value() );
2629 else if ( mLockAspectRatio->locked() )
2631 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2635 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2637 spinWidth->blockSignals(
false );
2638 mLayer->setSize( spinWidth->value() );
2639 mLayer->setFixedAspectRatio( fixedAspectRatio );
2643void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2646 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2647 if ( defaultAspectRatio <= 0.0 )
2653 mLayer->setFixedAspectRatio( 0.0 );
2658 mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
2663void QgsSvgMarkerSymbolLayerWidget::setAngle()
2665 mLayer->setAngle( spinAngle->value() );
2669void QgsSvgMarkerSymbolLayerWidget::setOffset()
2671 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2675void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2682void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2689 mLayer->setFillColor( color );
2693void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2700 mLayer->setStrokeColor( color );
2704void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2708 mLayer->setStrokeWidth( d );
2713void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2717 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
2718 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
2723void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2727 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
2728 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
2733void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2737 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2738 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2743void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
2752void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
2769 mSvgSelectorWidget->setAllowParameters(
true );
2770 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2772 connect( mTextureWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2774 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2776 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2777 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2783 mRotationSpinBox->setClearValue( 0.0 );
2785 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2786 mChangeColorButton->setContext( u
"symbology"_s );
2787 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2788 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2790 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2791 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2804 if ( layer->
layerType() !=
"SVGFill"_L1 )
2812 const double width =
mLayer->patternWidth();
2813 mTextureWidthSpinBox->blockSignals(
true );
2814 mTextureWidthSpinBox->setValue( width );
2815 mTextureWidthSpinBox->blockSignals(
false );
2816 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource(
mLayer->svgFilePath() );
2817 mRotationSpinBox->blockSignals(
true );
2818 mRotationSpinBox->setValue(
mLayer->angle() );
2819 mRotationSpinBox->blockSignals(
false );
2820 mTextureWidthUnitWidget->blockSignals(
true );
2821 mTextureWidthUnitWidget->setUnit(
mLayer->patternWidthUnit() );
2822 mTextureWidthUnitWidget->setMapUnitScale(
mLayer->patternWidthMapUnitScale() );
2823 mTextureWidthUnitWidget->blockSignals(
false );
2824 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2825 mSvgStrokeWidthUnitWidget->setUnit(
mLayer->svgStrokeWidthUnit() );
2826 mSvgStrokeWidthUnitWidget->setMapUnitScale(
mLayer->svgStrokeWidthMapUnitScale() );
2827 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2828 mChangeColorButton->blockSignals(
true );
2829 mChangeColorButton->setColor(
mLayer->svgFillColor() );
2830 mChangeColorButton->blockSignals(
false );
2831 mChangeStrokeColorButton->blockSignals(
true );
2832 mChangeStrokeColorButton->setColor(
mLayer->svgStrokeColor() );
2833 mChangeStrokeColorButton->blockSignals(
false );
2834 mStrokeWidthSpinBox->blockSignals(
true );
2835 mStrokeWidthSpinBox->setValue(
mLayer->svgStrokeWidth() );
2836 mStrokeWidthSpinBox->blockSignals(
false );
2857 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2860void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2869void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2876 mLayer->setSvgFilePath( text );
2881void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2883 mLayer->setSvgFilePath( name );
2884 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2890void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
2892 mLayer->setParameters( parameters );
2893 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2900void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2912 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2913 QColor defaultFill, defaultStroke;
2914 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2915 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2916 QgsApplication::svgCache()->
containsParams( mSvgSelectorWidget->sourceLineEdit()->source(), hasFillParam, hasDefaultFillColor, defaultFill, hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity, hasStrokeParam, hasDefaultStrokeColor, defaultStroke, hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth, hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2919 QColor fill = mChangeColorButton->color();
2920 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2921 if ( hasDefaultFillColor )
2925 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2926 mChangeColorButton->setColor( fill );
2928 mChangeColorButton->setEnabled( hasFillParam );
2929 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2932 QColor stroke = mChangeStrokeColorButton->color();
2933 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2934 if ( hasDefaultStrokeColor )
2936 stroke = defaultStroke;
2938 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2939 mChangeStrokeColorButton->setColor( stroke );
2941 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2942 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2943 if ( hasDefaultStrokeWidth && resetValues )
2945 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2947 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2950void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2957 mLayer->setSvgFillColor( color );
2961void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2968 mLayer->setSvgStrokeColor( color );
2972void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2976 mLayer->setSvgStrokeWidth( d );
2981void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
2985 mLayer->setPatternWidthUnit( mTextureWidthUnitWidget->unit() );
2986 mLayer->setPatternWidthMapUnitScale( mTextureWidthUnitWidget->getMapUnitScale() );
2991void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
2995 mLayer->setSvgStrokeWidthUnit( mSvgStrokeWidthUnitWidget->unit() );
2996 mLayer->setSvgStrokeWidthMapUnitScale( mSvgStrokeWidthUnitWidget->getMapUnitScale() );
3007 connect( mAngleSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3008 connect( mDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3009 connect( mOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3014 mOffsetSpinBox->setClearValue( 0 );
3015 mAngleSpinBox->setClearValue( 0 );
3019 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3030 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3041 if ( layer->
layerType() !=
"LinePatternFill"_L1 )
3055 mDistanceUnitWidget->blockSignals(
true );
3056 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
3058 mDistanceUnitWidget->blockSignals(
false );
3059 mOffsetUnitWidget->blockSignals(
true );
3060 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3061 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3062 mOffsetUnitWidget->blockSignals(
false );
3064 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3066 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3080void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3089void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3093 mLayer->setDistance( d );
3098void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3107void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3111 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
3112 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
3117void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3121 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3122 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3133 connect( mHorizontalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3134 connect( mVerticalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3135 connect( mHorizontalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3136 connect( mVerticalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3137 connect( mHorizontalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3138 connect( mVerticalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3139 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3140 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3141 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3142 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3143 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3144 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3156 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3166 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3174 mSeedSpinBox->setShowClearButton(
true );
3175 mSeedSpinBox->setClearValue( 0 );
3176 mRandomXSpinBox->setClearValue( 0 );
3177 mRandomYSpinBox->setClearValue( 0 );
3181 connect( mRandomXSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3184 mLayer->setMaximumRandomDeviationX( d );
3188 connect( mRandomYSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3191 mLayer->setMaximumRandomDeviationY( d );
3198 mLayer->setRandomDeviationXUnit( mRandomXOffsetUnitWidget->unit() );
3199 mLayer->setRandomDeviationXMapUnitScale( mRandomXOffsetUnitWidget->getMapUnitScale() );
3206 mLayer->setRandomDeviationYUnit( mRandomYOffsetUnitWidget->unit() );
3207 mLayer->setRandomDeviationYMapUnitScale( mRandomYOffsetUnitWidget->getMapUnitScale() );
3211 connect( mSeedSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [
this](
int v ) {
3219 mAngleSpinBox->setShowClearButton(
true );
3220 mAngleSpinBox->setClearValue( 0 );
3221 connect( mAngleSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3232 if ( !layer || layer->
layerType() !=
"PointPatternFill"_L1 )
3246 mHorizontalDistanceUnitWidget->blockSignals(
true );
3247 mHorizontalDistanceUnitWidget->setUnit(
mLayer->distanceXUnit() );
3249 mHorizontalDistanceUnitWidget->blockSignals(
false );
3250 mVerticalDistanceUnitWidget->blockSignals(
true );
3251 mVerticalDistanceUnitWidget->setUnit(
mLayer->distanceYUnit() );
3252 mVerticalDistanceUnitWidget->setMapUnitScale(
mLayer->distanceYMapUnitScale() );
3253 mVerticalDistanceUnitWidget->blockSignals(
false );
3254 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3255 mHorizontalDisplacementUnitWidget->setUnit(
mLayer->displacementXUnit() );
3256 mHorizontalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementXMapUnitScale() );
3257 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3258 mVerticalDisplacementUnitWidget->blockSignals(
true );
3259 mVerticalDisplacementUnitWidget->setUnit(
mLayer->displacementYUnit() );
3260 mVerticalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementYMapUnitScale() );
3261 mVerticalDisplacementUnitWidget->blockSignals(
false );
3262 mHorizontalOffsetUnitWidget->blockSignals(
true );
3263 mHorizontalOffsetUnitWidget->setUnit(
mLayer->offsetXUnit() );
3264 mHorizontalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetXMapUnitScale() );
3265 mHorizontalOffsetUnitWidget->blockSignals(
false );
3266 mVerticalOffsetUnitWidget->blockSignals(
true );
3267 mVerticalOffsetUnitWidget->setUnit(
mLayer->offsetYUnit() );
3268 mVerticalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetYMapUnitScale() );
3269 mVerticalOffsetUnitWidget->blockSignals(
false );
3271 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3272 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3277 whileBlocking( mRandomXOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationXMapUnitScale() );
3279 whileBlocking( mRandomYOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationYMapUnitScale() );
3301void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3310void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3314 mLayer->setDistanceY( d );
3319void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3323 mLayer->setDisplacementX( d );
3328void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3332 mLayer->setDisplacementY( d );
3337void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3346void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3355void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3359 mLayer->setDistanceXUnit( mHorizontalDistanceUnitWidget->unit() );
3360 mLayer->setDistanceXMapUnitScale( mHorizontalDistanceUnitWidget->getMapUnitScale() );
3365void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3369 mLayer->setDistanceYUnit( mVerticalDistanceUnitWidget->unit() );
3370 mLayer->setDistanceYMapUnitScale( mVerticalDistanceUnitWidget->getMapUnitScale() );
3375void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3379 mLayer->setDisplacementXUnit( mHorizontalDisplacementUnitWidget->unit() );
3380 mLayer->setDisplacementXMapUnitScale( mHorizontalDisplacementUnitWidget->getMapUnitScale() );
3385void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3389 mLayer->setDisplacementYUnit( mVerticalDisplacementUnitWidget->unit() );
3390 mLayer->setDisplacementYMapUnitScale( mVerticalDisplacementUnitWidget->getMapUnitScale() );
3395void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3399 mLayer->setOffsetXUnit( mHorizontalOffsetUnitWidget->unit() );
3400 mLayer->setOffsetXMapUnitScale( mHorizontalOffsetUnitWidget->getMapUnitScale() );
3405void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3409 mLayer->setOffsetYUnit( mVerticalOffsetUnitWidget->unit() );
3410 mLayer->setOffsetYMapUnitScale( mVerticalOffsetUnitWidget->getMapUnitScale() );
3436 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3437 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3438 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3445 scrollArea->setVerticalOnly(
true );
3447 btnColor->setAllowOpacity(
true );
3448 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3449 btnColor->setContext( u
"symbology"_s );
3450 btnStrokeColor->setAllowOpacity(
true );
3451 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3452 btnStrokeColor->setContext( u
"symbology"_s );
3454 mColorDDBtn->registerLinkedWidget( btnColor );
3455 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3457 spinOffsetX->setClearValue( 0.0 );
3458 spinOffsetY->setClearValue( 0.0 );
3459 spinAngle->setClearValue( 0.0 );
3462 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
3465 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3468 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3470 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3473 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3475 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3476 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3487 if ( layer->
layerType() !=
"FontMarker"_L1 )
3496 mFontStyleComboBox->blockSignals(
true );
3497 populateFontStyleComboBox();
3498 mFontStyleComboBox->blockSignals(
false );
3510 if (
mLayer->character().length() == 1 )
3516 mCharPreview->setFont( mRefFont );
3522 mSizeUnitWidget->blockSignals(
true );
3523 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3524 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3525 mSizeUnitWidget->blockSignals(
false );
3527 mStrokeWidthUnitWidget->blockSignals(
true );
3528 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
3529 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
3530 mStrokeWidthUnitWidget->blockSignals(
false );
3532 mOffsetUnitWidget->blockSignals(
true );
3533 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3534 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3535 mOffsetUnitWidget->blockSignals(
false );
3540 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3541 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3556 updateAssistantSymbol();
3568 mLayer->setFontFamily( font.family() );
3571 mCharPreview->setFont( mRefFont );
3572 populateFontStyleComboBox();
3577void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3584 mCharPreview->setFont( mRefFont );
3591 mLayer->setColor( color );
3597 mLayer->setStrokeColor( color );
3610 mLayer->setAngle( angle );
3616 mCharPreview->setText( text );
3618 if ( text.isEmpty() )
3622 QString character = text;
3623 if ( text.contains( QRegularExpression( u
"^0x[0-9a-fA-F]{1,4}$"_s ) ) )
3626 const unsigned int value = text.toUInt( &ok, 0 );
3629 character = QChar( value );
3630 mCharPreview->setText( character );
3634 if ( character !=
mLayer->character() )
3636 mLayer->setCharacter( character );
3637 if (
mLayer->character().length() == 1 )
3651 if (
mLayer->character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3653 mCharLineEdit->insert( chr );
3657 mLayer->setCharacter( chr );
3659 mCharPreview->setText( chr );
3663void QgsFontMarkerSymbolLayerWidget::setOffset()
3665 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3669void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3671 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
3675void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3679 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
3680 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3685void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3689 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3690 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3695void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3699 mLayer->setStrokeWidthUnit( mSizeUnitWidget->unit() );
3700 mLayer->setStrokeWidthMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3705void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3707 mFontStyleComboBox->clear();
3708 const QStringList styles = mFontDB.styles( mRefFont.family() );
3709 const auto constStyles = styles;
3710 for (
const QString &style : constStyles )
3712 mFontStyleComboBox->addItem( style );
3715 QString targetStyle = mFontDB.styleString( mRefFont );
3716 if ( !styles.contains( targetStyle ) )
3719 targetStyle = QFontInfo( f ).styleName();
3720 mRefFont.setStyleName( targetStyle );
3723 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
3724 if ( stylIndx > -1 )
3729 mFontStyleComboBox->setCurrentIndex( curIndx );
3732void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3735 setFontStyle( mFontStyleComboBox->currentText() );
3738void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
3747void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
3756void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3760 mLayer->setStrokeWidth( d );
3765void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3767 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
3769 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3771 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
3774 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3786 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3787 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3788 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3789 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3794 if ( layer->
layerType() !=
"CentroidFill"_L1 )
3804 whileBlocking( mClipOnCurrentPartOnlyCheckBox )->setChecked(
mLayer->clipOnCurrentPartOnly() );
3812void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3818void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3820 mLayer->setPointOnAllParts( state == Qt::Checked );
3824void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
3826 mLayer->setClipPoints( state == Qt::Checked );
3830void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
3832 mLayer->setClipOnCurrentPartOnly( state == Qt::Checked );
3853 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
3857 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3859 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3860 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3866 mSpinOffsetX->setClearValue( 0.0 );
3867 mSpinOffsetY->setClearValue( 0.0 );
3868 mRotationSpinBox->setClearValue( 0.0 );
3870 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3871 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3874 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3875 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3885 if ( layer->
layerType() !=
"RasterMarker"_L1 )
3895 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
3896 mHeightSpinBox->blockSignals(
true );
3897 if ( preservedAspectRatio )
3899 mHeightSpinBox->setValue(
mLayer->size() );
3903 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
3905 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
3906 mHeightSpinBox->blockSignals(
false );
3907 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
3915 mSizeUnitWidget->blockSignals(
true );
3916 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3917 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3918 mSizeUnitWidget->blockSignals(
false );
3919 mOffsetUnitWidget->blockSignals(
true );
3920 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3921 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3922 mOffsetUnitWidget->blockSignals(
false );
3925 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3926 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3937 updatePreviewImage();
3948 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
3951void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
3954 updatePreviewImage();
3958void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
3960 bool fitsInCache =
false;
3962 if ( image.isNull() )
3964 mLabelImagePreview->setPixmap( QPixmap() );
3968 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3969 previewImage.fill( Qt::transparent );
3970 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3972 p.begin( &previewImage );
3974 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
3975 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3976 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3977 QBrush checkerBrush;
3978 checkerBrush.setTexture( pix );
3979 p.fillRect( imageRect, checkerBrush );
3981 if (
mLayer->opacity() < 1.0 )
3983 p.setOpacity(
mLayer->opacity() );
3986 p.drawImage( imageRect.left(), imageRect.top(), image );
3988 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3991void QgsRasterMarkerSymbolLayerWidget::setWidth()
3993 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
3994 double fixedAspectRatio = 0.0;
3995 mHeightSpinBox->blockSignals(
true );
3996 if ( defaultAspectRatio <= 0.0 )
3998 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4000 else if ( mLockAspectRatio->locked() )
4002 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4006 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4008 mHeightSpinBox->blockSignals(
false );
4009 mLayer->setSize( mWidthSpinBox->value() );
4010 mLayer->setFixedAspectRatio( fixedAspectRatio );
4014void QgsRasterMarkerSymbolLayerWidget::setHeight()
4016 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4017 double fixedAspectRatio = 0.0;
4018 mWidthSpinBox->blockSignals(
true );
4019 if ( defaultAspectRatio <= 0.0 )
4021 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4023 else if ( mLockAspectRatio->locked() )
4025 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4029 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4031 mWidthSpinBox->blockSignals(
false );
4032 mLayer->setSize( mWidthSpinBox->value() );
4033 mLayer->setFixedAspectRatio( fixedAspectRatio );
4037void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4039 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4040 if ( defaultAspectRatio <= 0.0 )
4046 mLayer->setFixedAspectRatio( 0.0 );
4051 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4055void QgsRasterMarkerSymbolLayerWidget::setAngle()
4057 mLayer->setAngle( mRotationSpinBox->value() );
4061void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4063 mLayer->setOpacity( value );
4065 updatePreviewImage();
4068void QgsRasterMarkerSymbolLayerWidget::setOffset()
4070 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4074void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4078 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4079 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4084void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4088 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4089 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4094void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4103void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4130 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastAnimatedMarkerImageDir"_s );
4134 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4136 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4137 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4140 mFrameRateSpin->setClearValue( 10 );
4141 mFrameRateSpin->setShowClearButton(
true );
4142 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
4143 mLayer->setFrameRate( value );
4150 mSpinOffsetX->setClearValue( 0.0 );
4151 mSpinOffsetY->setClearValue( 0.0 );
4152 mRotationSpinBox->setClearValue( 0.0 );
4154 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4155 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4158 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4159 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4169 if ( layer->
layerType() !=
"AnimatedMarker"_L1 )
4179 if ( firstFrameTime > 0 )
4181 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4185 mFrameRateSpin->setClearValue( 10 );
4189 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4190 mHeightSpinBox->blockSignals(
true );
4191 if ( preservedAspectRatio )
4193 mHeightSpinBox->setValue(
mLayer->size() );
4197 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4199 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4200 mHeightSpinBox->blockSignals(
false );
4201 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4211 mSizeUnitWidget->blockSignals(
true );
4212 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4213 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4214 mSizeUnitWidget->blockSignals(
false );
4215 mOffsetUnitWidget->blockSignals(
true );
4216 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4217 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4218 mOffsetUnitWidget->blockSignals(
false );
4221 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4222 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4233 updatePreviewImage();
4244 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4247void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4252 if ( firstFrameTime > 0 )
4254 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4258 mFrameRateSpin->setClearValue( 10 );
4260 updatePreviewImage();
4264void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4266 if ( mPreviewMovie )
4268 mLabelImagePreview->setMovie(
nullptr );
4269 mPreviewMovie->deleteLater();
4270 mPreviewMovie =
nullptr;
4273 mPreviewMovie =
new QMovie(
mLayer->path(), QByteArray(),
this );
4274 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4275 mLabelImagePreview->setMovie( mPreviewMovie );
4276 mPreviewMovie->start();
4279void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4281 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4282 double fixedAspectRatio = 0.0;
4283 mHeightSpinBox->blockSignals(
true );
4284 if ( defaultAspectRatio <= 0.0 )
4286 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4288 else if ( mLockAspectRatio->locked() )
4290 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4294 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4296 mHeightSpinBox->blockSignals(
false );
4297 mLayer->setSize( mWidthSpinBox->value() );
4298 mLayer->setFixedAspectRatio( fixedAspectRatio );
4302void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4304 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4305 double fixedAspectRatio = 0.0;
4306 mWidthSpinBox->blockSignals(
true );
4307 if ( defaultAspectRatio <= 0.0 )
4309 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4311 else if ( mLockAspectRatio->locked() )
4313 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4317 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4319 mWidthSpinBox->blockSignals(
false );
4320 mLayer->setSize( mWidthSpinBox->value() );
4321 mLayer->setFixedAspectRatio( fixedAspectRatio );
4325void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4327 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4328 if ( defaultAspectRatio <= 0.0 )
4334 mLayer->setFixedAspectRatio( 0.0 );
4339 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4343void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4345 mLayer->setAngle( mRotationSpinBox->value() );
4349void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4351 mLayer->setOpacity( value );
4353 updatePreviewImage();
4356void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4358 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4362void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4366 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4367 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4372void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4376 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4377 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4382void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4391void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4408 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4412 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4419 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4420 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4423 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4432 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4444 mSpinOffsetX->setClearValue( 0.0 );
4445 mSpinOffsetY->setClearValue( 0.0 );
4446 mRotationSpinBox->setClearValue( 0.0 );
4448 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4449 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4450 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4462 if ( layer->
layerType() !=
"RasterFill"_L1 )
4475 cboCoordinateMode->blockSignals(
true );
4476 switch (
mLayer->coordinateMode() )
4479 cboCoordinateMode->setCurrentIndex( 1 );
4483 cboCoordinateMode->setCurrentIndex( 0 );
4486 cboCoordinateMode->blockSignals(
false );
4492 mOffsetUnitWidget->blockSignals(
true );
4493 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4494 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4495 mOffsetUnitWidget->blockSignals(
false );
4498 mSizeUnitWidget->blockSignals(
true );
4499 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4500 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4501 mSizeUnitWidget->blockSignals(
false );
4505 updatePreviewImage();
4520void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4523 updatePreviewImage();
4527void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4544void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4551 mLayer->setOpacity( value );
4553 updatePreviewImage();
4556void QgsRasterFillSymbolLayerWidget::offsetChanged()
4558 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4562void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4568 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4569 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4573void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4582void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4584 bool fitsInCache =
false;
4586 if ( image.isNull() )
4588 mLabelImagePreview->setPixmap( QPixmap() );
4592 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4593 previewImage.fill( Qt::transparent );
4594 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4596 p.begin( &previewImage );
4598 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4599 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4600 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4601 QBrush checkerBrush;
4602 checkerBrush.setTexture( pix );
4603 p.fillRect( imageRect, checkerBrush );
4605 if (
mLayer->opacity() < 1.0 )
4607 p.setOpacity(
mLayer->opacity() );
4610 p.drawImage( imageRect.left(), imageRect.top(), image );
4612 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4626 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4634 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
4635 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
4640 connect( spinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
4643 mLayer->setWidth( spinWidth->value() );
4651 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4652 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4658 spinOffset->setClearValue( 0.0 );
4659 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
4662 mLayer->setOffset( val );
4667 connect( cboCapStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4670 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
4674 connect( cboJoinStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4677 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
4686 mLayer->setOpacity( opacity );
4687 updatePreviewImage();
4700 if ( layer->
layerType() !=
"RasterLine"_L1 )
4724 updatePreviewImage();
4739void QgsRasterLineSymbolLayerWidget::imageSourceChanged(
const QString &text )
4742 updatePreviewImage();
4746void QgsRasterLineSymbolLayerWidget::updatePreviewImage()
4748 bool fitsInCache =
false;
4750 if ( image.isNull() )
4752 mLabelImagePreview->setPixmap( QPixmap() );
4756 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4757 previewImage.fill( Qt::transparent );
4758 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4760 p.begin( &previewImage );
4762 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4763 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4764 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4765 QBrush checkerBrush;
4766 checkerBrush.setTexture( pix );
4767 p.fillRect( imageRect, checkerBrush );
4769 if (
mLayer->opacity() < 1.0 )
4771 p.setOpacity(
mLayer->opacity() );
4774 p.drawImage( imageRect.left(), imageRect.top(), image );
4776 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4789 modificationExpressionSelector->setMultiLine(
true );
4790 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
4791 modificationExpressionSelector->registerExpressionContextGenerator(
this );
4797 mUnitWidget->setShowMapScaleButton(
false );
4800 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
4802 if ( !mBlockSignals )
4804 mLayer->setUnits( mUnitWidget->unit() );
4814 modificationExpressionSelector->setExpression( mLayer->geometryExpression() );
4815 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData(
static_cast<int>( mLayer->symbolType() ) ) );
4816 mUnitWidget->setUnit( mLayer->units() );
4825void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
4832void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
4835 std::unique_ptr<QgsSymbol> subSymbol( mLayer->subSymbol()->clone() );
4837 mLayer->setSymbolType(
static_cast<Qgis::SymbolType>( cbxGeometryType->currentData().toInt() ) );
4839 switch ( mLayer->symbolType() )
4850 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
4852 if (
dynamic_cast<const QgsLineSymbolLayer *
>( subSymbol->symbolLayer( i ) ) )
4853 layers << subSymbol->symbolLayer( i )->clone();
4856 if ( !layers.empty() )
4857 mLayer->setSubSymbol(
new QgsLineSymbol( layers ) );
4866 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
4867 layers << subSymbol->symbolLayer( i )->clone();
4868 mLayer->setSubSymbol(
new QgsFillSymbol( layers ) );
4889 mPointCountSpinBox->setShowClearButton(
true );
4890 mPointCountSpinBox->setClearValue( 100 );
4891 mSeedSpinBox->setShowClearButton(
true );
4892 mSeedSpinBox->setClearValue( 0 );
4894 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
4895 connect( mPointCountSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
4896 connect( mDensityAreaSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
4897 connect( mSeedSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
4898 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [
this](
bool checked ) {
4901 mLayer->setClipPoints( checked );
4913 if ( !layer || layer->
layerType() !=
"RandomMarkerFill"_L1 )
4919 whileBlocking( mPointCountSpinBox )->setValue( mLayer->pointCount() );
4921 whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
4923 bool showDensityBasedCountWidgets =
false;
4924 switch ( mLayer->countMethod() )
4927 showDensityBasedCountWidgets =
true;
4932 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4933 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4934 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4935 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4937 whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData(
static_cast<int>( mLayer->countMethod() ) ) );
4938 whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
4939 mDensityAreaUnitWidget->blockSignals(
true );
4940 mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
4941 mDensityAreaUnitWidget->
setMapUnitScale( mLayer->densityAreaUnitScale() );
4942 mDensityAreaUnitWidget->blockSignals(
false );
4955void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
4957 bool showDensityBasedCountWidgets =
false;
4961 showDensityBasedCountWidgets =
true;
4966 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4967 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4968 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4969 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4973 mLayer->setCountMethod(
static_cast<Qgis::PointCountMethod>( mCountMethodComboBox->currentData().toInt() ) );
4978void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
4982 mLayer->setPointCount( d );
4987void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
4991 mLayer->setDensityArea( d );
4996void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
5000 mLayer->setDensityAreaUnit( mDensityAreaUnitWidget->unit() );
5001 mLayer->setDensityAreaUnitScale( mDensityAreaUnitWidget->getMapUnitScale() );
5006void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
5010 mLayer->setSeed( d );
5025 btnColorRamp->setShowGradientOnly(
true );
5027 btnChangeColor->setAllowOpacity(
true );
5028 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5029 btnChangeColor->setContext( u
"symbology"_s );
5030 btnChangeColor->setShowNoColor(
true );
5031 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
5032 btnChangeColor2->setAllowOpacity(
true );
5033 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5034 btnChangeColor2->setContext( u
"symbology"_s );
5035 btnChangeColor2->setShowNoColor(
true );
5036 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
5038 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
5039 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
5044 mLayer->setColor( color );
5051 mLayer->setColor2( color );
5056 if ( btnColorRamp->isNull() )
5061 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
5066 connect( radioTwoColor, &QAbstractButton::toggled,
this, [
this] {
5069 if ( radioTwoColor->isChecked() )
5072 btnChangeColor->setEnabled(
true );
5073 btnChangeColor2->setEnabled(
true );
5074 btnColorRamp->setEnabled(
false );
5079 btnColorRamp->setEnabled(
true );
5080 btnChangeColor->setEnabled(
false );
5081 btnChangeColor2->setEnabled(
false );
5093 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5094 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5099 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5102 mLayer->setWidth( spinWidth->value() );
5110 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5111 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5116 spinOffset->setClearValue( 0.0 );
5117 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5120 mLayer->setOffset( val );
5125 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5128 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5132 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5135 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5148 if ( layer->
layerType() !=
"Lineburst"_L1 )
5159 btnChangeColor->blockSignals(
true );
5161 btnChangeColor->blockSignals(
false );
5162 btnChangeColor2->blockSignals(
true );
5163 btnChangeColor2->setColor(
mLayer->color2() );
5164 btnChangeColor2->blockSignals(
false );
5168 radioTwoColor->setChecked(
true );
5169 btnColorRamp->setEnabled(
false );
5173 radioColorRamp->setChecked(
true );
5174 btnChangeColor->setEnabled(
false );
5175 btnChangeColor2->setEnabled(
false );
5179 if (
mLayer->colorRamp() )
5181 btnColorRamp->blockSignals(
true );
5182 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
5183 btnColorRamp->blockSignals(
false );
5226 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5227 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5232 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5235 mLayer->setWidth( spinWidth->value() );
5243 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5244 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5249 spinOffset->setClearValue( 0.0 );
5250 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5253 mLayer->setOffset( val );
5258 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5261 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5265 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5268 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5283 if ( layer->
layerType() !=
"FilledLine"_L1 )
5295 whileBlocking( mPenWidthUnitWidget )->setUnit( mLayer->widthUnit() );
5298 whileBlocking( mOffsetUnitWidget )->setUnit( mLayer->offsetUnit() );
5299 whileBlocking( mOffsetUnitWidget )->setMapUnitScale( mLayer->offsetMapUnitScale() );
5302 whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
5303 whileBlocking( cboCapStyle )->setPenCapStyle( mLayer->penCapStyle() );
5336 mSpinSkipMultiples->setClearValue( 0, tr(
"Not set" ) );
5337 mSpinLabelOffsetX->setClearValue( 0 );
5338 mSpinLabelOffsetY->setClearValue( 0 );
5339 mSpinAverageAngleLength->setClearValue( 4.0 );
5343 connect( mComboQuantity, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5344 if ( mLayer && !mBlockChangesSignal )
5351 if ( mLayer && !mBlockChangesSignal )
5353 mLayer->setTextFormat( mTextFormatButton->textFormat() );
5357 connect( spinInterval, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5358 if ( mLayer && !mBlockChangesSignal )
5360 mLayer->setInterval( spinInterval->value() );
5364 connect( mSpinSkipMultiples, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5365 if ( mLayer && !mBlockChangesSignal )
5367 mLayer->setSkipMultiplesOf( mSpinSkipMultiples->value() );
5371 connect( mCheckRotate, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5372 if ( mLayer && !mBlockChangesSignal )
5374 mLayer->setRotateLabels( checked );
5377 mSpinAverageAngleLength->setEnabled( checked );
5378 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5380 connect( mCheckShowMarker, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5381 if ( mLayer && !mBlockChangesSignal )
5383 mLayer->setShowMarker( checked );
5388 connect( mSpinLabelOffsetX, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5389 if ( mLayer && !mBlockChangesSignal )
5391 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5395 connect( mSpinLabelOffsetY, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5396 if ( mLayer && !mBlockChangesSignal )
5398 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5403 if ( mLayer && !mBlockChangesSignal )
5405 mLayer->setLabelOffsetUnit( mLabelOffsetUnitWidget->unit() );
5406 mLayer->setLabelOffsetMapUnitScale( mLabelOffsetUnitWidget->getMapUnitScale() );
5411 connect( mComboPlacement, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5412 if ( mLayer && !mBlockChangesSignal )
5415 mLayer->setPlacement( placement );
5416 switch ( placement )
5421 mIntervalWidget->show();
5424 mIntervalWidget->hide();
5431 connect( mSpinAverageAngleLength, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5432 if ( mLayer && !mBlockChangesSignal )
5434 mLayer->setAverageAngleLength( mSpinAverageAngleLength->value() );
5439 if ( mLayer && !mBlockChangesSignal )
5441 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
5442 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
5447 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsLinearReferencingSymbolLayerWidget::changeNumberFormat );
5449 mTextFormatButton->registerExpressionContextGenerator(
this );
5457 if ( !layer || layer->
layerType() !=
"LinearReferencing"_L1 )
5461 mLayer = qgis::down_cast<QgsLinearReferencingSymbolLayer *>( layer );
5463 mBlockChangesSignal =
true;
5465 mComboPlacement->setCurrentIndex( mComboPlacement->findData( QVariant::fromValue( mLayer->placement() ) ) );
5466 switch ( mLayer->placement() )
5471 mIntervalWidget->show();
5474 mIntervalWidget->hide();
5478 mComboQuantity->setCurrentIndex( mComboQuantity->findData( QVariant::fromValue( mLayer->labelSource() ) ) );
5480 mTextFormatButton->setTextFormat( mLayer->textFormat() );
5481 spinInterval->setValue( mLayer->interval() );
5482 mSpinSkipMultiples->setValue( mLayer->skipMultiplesOf() );
5483 mCheckRotate->setChecked( mLayer->rotateLabels() );
5484 mCheckShowMarker->setChecked( mLayer->showMarker() );
5485 mSpinLabelOffsetX->setValue( mLayer->labelOffset().x() );
5486 mSpinLabelOffsetY->setValue( mLayer->labelOffset().y() );
5487 mLabelOffsetUnitWidget->setUnit( mLayer->labelOffsetUnit() );
5488 mLabelOffsetUnitWidget->setMapUnitScale( mLayer->labelOffsetMapUnitScale() );
5490 mAverageAngleUnit->setUnit( mLayer->averageAngleUnit() );
5491 mAverageAngleUnit->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
5492 mSpinAverageAngleLength->setValue( mLayer->averageAngleLength() );
5494 mSpinAverageAngleLength->setEnabled( mCheckRotate->isChecked() );
5495 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5502 mBlockChangesSignal =
false;
5513 mTextFormatButton->setMapCanvas(
context.mapCanvas() );
5514 mTextFormatButton->setMessageBar(
context.messageBar() );
5517void QgsLinearReferencingSymbolLayerWidget::changeNumberFormat()
5527 if ( !mBlockChangesSignal )
5537 QgsNumericFormatSelectorDialog dialog(
this );
5538 dialog.setFormat( mLayer->numericFormat() );
5539 dialog.registerExpressionContextGenerator(
this );
5540 if ( dialog.exec() )
5542 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.