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;
118 << u
"symbol_layer_count"_s
119 << u
"symbol_layer_index"_s
120 << u
"symbol_frame"_s;
125 highlights << u
"zoom_level"_s;
127 if ( expContext.
hasVariable( u
"vector_tile_zoom"_s ) )
129 highlights << u
"vector_tile_zoom"_s;
140 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
143 unitWidget->setMapCanvas( mContext.mapCanvas() );
161void QgsSymbolLayerWidget::createAuxiliaryField()
171 if ( !mVectorLayer->auxiliaryLayer() )
174 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
179 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
181 QgsNewAuxiliaryFieldDialog dlg( def, mVectorLayer,
true,
this );
182 if ( dlg.exec() == QDialog::Accepted )
183 def = dlg.propertyDefinition();
187 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
193 property.setActive(
true );
215 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
216 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
220 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
222 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [
this] {
223 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
224 if ( !mCheckAlignDash->isChecked() )
225 mCheckDashCorners->setChecked(
false );
229 mLayer->setAlignDashPattern( mCheckAlignDash->isChecked() );
233 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [
this] {
236 mLayer->setTweakDashPatternOnCorners( mCheckDashCorners->isChecked() );
241 mPenWidthUnitWidget->setUnits(
244 mOffsetUnitWidget->setUnits(
247 mDashPatternUnitWidget->setUnits(
250 mPatternOffsetUnitWidget->setUnits(
253 mTrimDistanceStartUnitWidget->setUnits(
263 mTrimDistanceEndUnitWidget->setUnits(
274 btnChangeColor->setAllowOpacity(
true );
275 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
276 btnChangeColor->setContext( u
"symbology"_s );
278 mColorDDBtn->registerLinkedWidget( btnChangeColor );
283 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
291 spinOffset->setClearValue( 0.0 );
292 spinPatternOffset->setClearValue( 0.0 );
294 mTrimStartDistanceSpin->setClearValue( 0.0 );
295 mTrimDistanceEndSpin->setClearValue( 0.0 );
298 mAssistantPreviewSymbol = std::make_shared<QgsLineSymbol>();
301 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
303 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
305 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
306 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
307 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
308 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
309 connect( spinPatternOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
311 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
315 mLayer->setTrimDistanceStart( value );
322 mLayer->setTrimDistanceStartUnit( mTrimDistanceStartUnitWidget->unit() );
323 mLayer->setTrimDistanceStartMapUnitScale( mTrimDistanceStartUnitWidget->getMapUnitScale() );
326 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
330 mLayer->setTrimDistanceEnd( value );
337 mLayer->setTrimDistanceEndUnit( mTrimDistanceEndUnitWidget->unit() );
338 mLayer->setTrimDistanceEndMapUnitScale( mTrimDistanceEndUnitWidget->getMapUnitScale() );
350void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
352 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
354 mAssistantPreviewSymbol->deleteSymbolLayer( i );
356 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
359 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
365 if ( !layer || layer->
layerType() !=
"SimpleLine"_L1 )
372 mPenWidthUnitWidget->blockSignals(
true );
373 mPenWidthUnitWidget->setUnit(
mLayer->widthUnit() );
375 mPenWidthUnitWidget->blockSignals(
false );
376 mOffsetUnitWidget->blockSignals(
true );
377 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
378 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
379 mOffsetUnitWidget->blockSignals(
false );
380 mDashPatternUnitWidget->blockSignals(
true );
381 mDashPatternUnitWidget->setUnit(
mLayer->customDashPatternUnit() );
382 mDashPatternUnitWidget->setMapUnitScale(
mLayer->customDashPatternMapUnitScale() );
383 mDashPatternUnitWidget->blockSignals(
false );
386 whileBlocking( mPatternOffsetUnitWidget )->setMapUnitScale(
mLayer->dashPatternOffsetMapUnitScale() );
388 whileBlocking( mTrimDistanceStartUnitWidget )->setMapUnitScale(
mLayer->trimDistanceStartMapUnitScale() );
390 whileBlocking( mTrimDistanceEndUnitWidget )->setMapUnitScale(
mLayer->trimDistanceEndMapUnitScale() );
393 spinWidth->blockSignals(
true );
394 spinWidth->setValue(
mLayer->width() );
395 spinWidth->blockSignals(
false );
396 btnChangeColor->blockSignals(
true );
397 btnChangeColor->setColor(
mLayer->color() );
398 btnChangeColor->blockSignals(
false );
399 spinOffset->blockSignals(
true );
400 spinOffset->setValue(
mLayer->offset() );
401 spinOffset->blockSignals(
false );
402 cboPenStyle->blockSignals(
true );
403 cboJoinStyle->blockSignals(
true );
404 cboCapStyle->blockSignals(
true );
405 cboPenStyle->setPenStyle(
mLayer->penStyle() );
406 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
407 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
408 cboPenStyle->blockSignals(
false );
409 cboJoinStyle->blockSignals(
false );
410 cboCapStyle->blockSignals(
false );
416 const bool useCustomDashPattern =
mLayer->useCustomDashPattern();
417 mChangePatternButton->setEnabled( useCustomDashPattern );
418 label_3->setEnabled( !useCustomDashPattern );
419 cboPenStyle->setEnabled( !useCustomDashPattern );
420 mCustomCheckBox->blockSignals(
true );
421 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
422 mCustomCheckBox->blockSignals(
false );
425 const QSize size = mChangePatternButton->minimumSizeHint();
427 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
430 const bool drawInsidePolygon =
mLayer->drawInsidePolygon();
431 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
433 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData(
mLayer->ringFilter() ) );
436 mCheckDashCorners->setEnabled(
mLayer->alignDashPattern() );
452 updateAssistantSymbol();
464 switch (
context.symbolType() )
469 mDrawInsideCheckBox->hide();
470 mRingFilterComboBox->hide();
480void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
487void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
489 mLayer->setColor( color );
493void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
495 mLayer->setPenStyle( cboPenStyle->penStyle() );
496 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
497 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
502void QgsSimpleLineSymbolLayerWidget::offsetChanged()
504 mLayer->setOffset( spinOffset->value() );
509void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
511 mLayer->setDashPatternOffset( spinPatternOffset->value() );
516void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
518 const bool checked = ( state == Qt::Checked );
519 mChangePatternButton->setEnabled( checked );
520 label_3->setEnabled( !checked );
521 cboPenStyle->setEnabled( !checked );
523 mLayer->setUseCustomDashPattern( checked );
527void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
532 QgsDashSpaceWidget *widget =
new QgsDashSpaceWidget(
mLayer->customDashVector(), panel );
534 widget->
setUnit( mDashPatternUnitWidget->unit() );
544 QgsDashSpaceDialog d(
mLayer->customDashVector() );
545 d.setUnit( mDashPatternUnitWidget->unit() );
546 if ( d.exec() == QDialog::Accepted )
548 mLayer->setCustomDashVector( d.dashDotVector() );
554void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
558 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
559 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
565void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
569 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
570 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
575void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
579 mLayer->setCustomDashPatternUnit( mDashPatternUnitWidget->unit() );
580 mLayer->setCustomDashPatternMapUnitScale( mDashPatternUnitWidget->getMapUnitScale() );
586void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
588 const bool checked = ( state == Qt::Checked );
589 mLayer->setDrawInsidePolygon( checked );
593void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
597 mLayer->setDashPatternOffsetUnit( mPatternOffsetUnitWidget->unit() );
598 mLayer->setDashPatternOffsetMapUnitScale( mPatternOffsetUnitWidget->getMapUnitScale() );
610 std::unique_ptr<QgsSimpleLineSymbolLayer> layerCopy(
mLayer->clone() );
615 const QColor color = qApp->palette().color( QPalette::WindowText );
616 layerCopy->setColor( color );
618 layerCopy->setOffset( 0 );
619 layerCopy->setUseCustomDashPattern(
true );
621 QSize currentIconSize;
624 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
626 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
629 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
635 const std::unique_ptr<QgsLineSymbol> previewSymbol = std::make_unique<QgsLineSymbol>(
QgsSymbolLayerList() << layerCopy.release() );
637 mChangePatternButton->setIconSize( currentIconSize );
638 mChangePatternButton->setIcon( icon );
642 const int width =
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
643 const int height =
static_cast<int>( width / 1.61803398875 );
647 QBuffer buffer( &data );
648 pm.save( &buffer,
"PNG", 100 );
649 mChangePatternButton->setToolTip( u
"<img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString( data.toBase64() ) ).arg( width ) );
654 QgsSymbolLayerWidget::resizeEvent( event );
681 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
682 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
683 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
684 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
685 mSizeUnitWidget->setUnits(
688 mOffsetUnitWidget->setUnits(
691 mStrokeWidthUnitWidget->setUnits(
695 btnChangeColorFill->setAllowOpacity(
true );
696 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
697 btnChangeColorFill->setContext( u
"symbology"_s );
698 btnChangeColorFill->setShowNoColor(
true );
699 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
700 btnChangeColorStroke->setAllowOpacity(
true );
701 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
702 btnChangeColorStroke->setContext( u
"symbology"_s );
703 btnChangeColorStroke->setShowNoColor(
true );
704 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
706 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
707 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
709 spinOffsetX->setClearValue( 0.0 );
710 spinOffsetY->setClearValue( 0.0 );
711 spinAngle->setClearValue( 0.0 );
714 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
717 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
719 int size = lstNames->iconSize().width();
721 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
723 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
724 lstNames->setIconSize( QSize( size, size ) );
726 const double markerSize = size * 0.8;
732 lyr->
setColor( QColor( 200, 200, 200 ) );
736 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
737 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
742 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
744 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
747 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
748 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
749 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
750 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
751 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
752 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
760 if ( layer->
layerType() !=
"SimpleMarker"_L1 )
768 for (
int i = 0; i < lstNames->count(); ++i )
770 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
772 lstNames->setCurrentRow( i );
776 btnChangeColorStroke->blockSignals(
true );
777 btnChangeColorStroke->setColor(
mLayer->strokeColor() );
778 btnChangeColorStroke->blockSignals(
false );
779 btnChangeColorFill->blockSignals(
true );
780 btnChangeColorFill->setColor(
mLayer->fillColor() );
782 btnChangeColorFill->blockSignals(
false );
783 spinSize->blockSignals(
true );
784 spinSize->setValue(
mLayer->size() );
785 spinSize->blockSignals(
false );
786 spinAngle->blockSignals(
true );
787 spinAngle->setValue(
mLayer->angle() );
788 spinAngle->blockSignals(
false );
789 mStrokeStyleComboBox->blockSignals(
true );
790 mStrokeStyleComboBox->setPenStyle(
mLayer->strokeStyle() );
791 mStrokeStyleComboBox->blockSignals(
false );
792 mStrokeWidthSpinBox->blockSignals(
true );
793 mStrokeWidthSpinBox->setValue(
mLayer->strokeWidth() );
794 mStrokeWidthSpinBox->blockSignals(
false );
795 cboJoinStyle->blockSignals(
true );
796 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
797 cboJoinStyle->blockSignals(
false );
798 cboCapStyle->blockSignals(
true );
799 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
800 cboCapStyle->blockSignals(
false );
803 spinOffsetX->blockSignals(
true );
804 spinOffsetX->setValue(
mLayer->offset().x() );
805 spinOffsetX->blockSignals(
false );
806 spinOffsetY->blockSignals(
true );
807 spinOffsetY->setValue(
mLayer->offset().y() );
808 spinOffsetY->blockSignals(
false );
810 mSizeUnitWidget->blockSignals(
true );
811 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
812 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
813 mSizeUnitWidget->blockSignals(
false );
814 mOffsetUnitWidget->blockSignals(
true );
815 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
816 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
817 mOffsetUnitWidget->blockSignals(
false );
818 mStrokeWidthUnitWidget->blockSignals(
true );
819 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
820 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
821 mStrokeWidthUnitWidget->blockSignals(
false );
824 mHorizontalAnchorComboBox->blockSignals(
true );
825 mVerticalAnchorComboBox->blockSignals(
true );
826 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
827 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
828 mHorizontalAnchorComboBox->blockSignals(
false );
829 mVerticalAnchorComboBox->blockSignals(
false );
844 updateAssistantSymbol();
852void QgsSimpleMarkerSymbolLayerWidget::setShape()
861 mLayer->setStrokeColor( color );
867 mLayer->setColor( color );
871void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
877void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
879 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
883void QgsSimpleMarkerSymbolLayerWidget::setSize()
885 mLayer->setSize( spinSize->value() );
889void QgsSimpleMarkerSymbolLayerWidget::setAngle()
891 mLayer->setAngle( spinAngle->value() );
895void QgsSimpleMarkerSymbolLayerWidget::setOffset()
897 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
901void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
907 mLayer->setStrokeStyle( mStrokeStyleComboBox->penStyle() );
912void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
916 mLayer->setStrokeWidth( d );
921void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
925 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
926 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
931void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
935 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
936 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
941void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
945 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
946 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
951void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
960void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
969void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
971 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
973 mAssistantPreviewSymbol->deleteSymbolLayer( i );
975 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
978 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
992 mStrokeWidthUnitWidget->setUnits(
995 mOffsetUnitWidget->setUnits(
999 btnChangeColor->setAllowOpacity(
true );
1000 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
1001 btnChangeColor->setContext( u
"symbology"_s );
1002 btnChangeColor->setShowNoColor(
true );
1003 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
1004 btnChangeStrokeColor->setAllowOpacity(
true );
1005 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
1006 btnChangeStrokeColor->setContext( u
"symbology"_s );
1007 btnChangeStrokeColor->setShowNoColor(
true );
1008 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
1010 spinOffsetX->setClearValue( 0.0 );
1011 spinOffsetY->setClearValue( 0.0 );
1014 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
1016 connect( spinStrokeWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
1017 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1018 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1019 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1020 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1022 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
1023 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
1028 if ( layer->
layerType() !=
"SimpleFill"_L1 )
1035 btnChangeColor->blockSignals(
true );
1037 btnChangeColor->blockSignals(
false );
1038 cboFillStyle->blockSignals(
true );
1039 cboFillStyle->setBrushStyle(
mLayer->brushStyle() );
1040 cboFillStyle->blockSignals(
false );
1041 btnChangeStrokeColor->blockSignals(
true );
1042 btnChangeStrokeColor->setColor(
mLayer->strokeColor() );
1043 btnChangeStrokeColor->blockSignals(
false );
1044 cboStrokeStyle->blockSignals(
true );
1045 cboStrokeStyle->setPenStyle(
mLayer->strokeStyle() );
1046 cboStrokeStyle->blockSignals(
false );
1047 spinStrokeWidth->blockSignals(
true );
1048 spinStrokeWidth->setValue(
mLayer->strokeWidth() );
1049 spinStrokeWidth->blockSignals(
false );
1050 cboJoinStyle->blockSignals(
true );
1051 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
1052 cboJoinStyle->blockSignals(
false );
1053 spinOffsetX->blockSignals(
true );
1054 spinOffsetX->setValue(
mLayer->offset().x() );
1055 spinOffsetX->blockSignals(
false );
1056 spinOffsetY->blockSignals(
true );
1057 spinOffsetY->setValue(
mLayer->offset().y() );
1058 spinOffsetY->blockSignals(
false );
1060 mStrokeWidthUnitWidget->blockSignals(
true );
1061 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
1062 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
1063 mStrokeWidthUnitWidget->blockSignals(
false );
1064 mOffsetUnitWidget->blockSignals(
true );
1065 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1066 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1067 mOffsetUnitWidget->blockSignals(
false );
1085 mLayer->setColor( color );
1091 mLayer->setStrokeColor( color );
1095void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1101void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1103 mLayer->setStrokeWidth( spinStrokeWidth->value() );
1107void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1109 mLayer->setStrokeStyle( cboStrokeStyle->penStyle() );
1110 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
1114void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1116 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1120void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1124 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
1125 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
1130void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1134 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1135 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1159 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1160 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1161 mSizeUnitWidget->setUnits(
1164 mOffsetUnitWidget->setUnits(
1168 spinOffsetX->setClearValue( 0.0 );
1169 spinOffsetY->setClearValue( 0.0 );
1170 spinAngle->setClearValue( 0.0 );
1173 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
1176 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1178 int size = lstNames->iconSize().width();
1179 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1180 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1181 lstNames->setIconSize( QSize( size, size ) );
1183 const double markerSize = size * 0.8;
1189 lyr->
setColor( QColor( 200, 200, 200 ) );
1193 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1194 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
1199 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1201 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1202 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1203 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1204 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1205 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1213 if ( layer->
layerType() !=
"FilledMarker"_L1 )
1221 for (
int i = 0; i < lstNames->count(); ++i )
1223 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1225 lstNames->setCurrentRow( i );
1234 mSizeUnitWidget->blockSignals(
true );
1235 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
1236 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
1237 mSizeUnitWidget->blockSignals(
false );
1238 mOffsetUnitWidget->blockSignals(
true );
1239 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1240 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1241 mOffsetUnitWidget->blockSignals(
false );
1244 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
1245 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
1254 updateAssistantSymbol();
1262void QgsFilledMarkerSymbolLayerWidget::setShape()
1268void QgsFilledMarkerSymbolLayerWidget::setSize()
1270 mLayer->setSize( spinSize->value() );
1274void QgsFilledMarkerSymbolLayerWidget::setAngle()
1276 mLayer->setAngle( spinAngle->value() );
1280void QgsFilledMarkerSymbolLayerWidget::setOffset()
1282 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1286void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1290 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
1291 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
1296void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1300 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1301 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1306void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
1315void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
1324void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1326 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
1328 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1330 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
1333 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1346 connect( mSpinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1347 mOffsetUnitWidget->setUnits(
1351 btnColorRamp->setShowGradientOnly(
true );
1353 btnChangeColor->setAllowOpacity(
true );
1354 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1355 btnChangeColor->setContext( u
"symbology"_s );
1356 btnChangeColor->setShowNoColor(
true );
1357 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1358 btnChangeColor2->setAllowOpacity(
true );
1359 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1360 btnChangeColor2->setContext( u
"symbology"_s );
1361 btnChangeColor2->setShowNoColor(
true );
1362 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1364 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1365 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1367 spinOffsetX->setClearValue( 0.0 );
1368 spinOffsetY->setClearValue( 0.0 );
1369 mSpinAngle->setClearValue( 0.0 );
1377 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1378 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1379 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1380 connect( spinRefPoint1X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1381 connect( spinRefPoint1Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1382 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1383 connect( spinRefPoint2X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1384 connect( spinRefPoint2Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1385 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1390 if ( layer->
layerType() !=
"GradientFill"_L1 )
1397 btnChangeColor->blockSignals(
true );
1399 btnChangeColor->blockSignals(
false );
1400 btnChangeColor2->blockSignals(
true );
1401 btnChangeColor2->setColor(
mLayer->color2() );
1402 btnChangeColor2->blockSignals(
false );
1406 radioTwoColor->setChecked(
true );
1407 btnColorRamp->setEnabled(
false );
1411 radioColorRamp->setChecked(
true );
1412 btnChangeColor->setEnabled(
false );
1413 btnChangeColor2->setEnabled(
false );
1417 if (
mLayer->colorRamp() )
1419 btnColorRamp->blockSignals(
true );
1420 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1421 btnColorRamp->blockSignals(
false );
1424 cboGradientType->blockSignals(
true );
1425 switch (
mLayer->gradientType() )
1428 cboGradientType->setCurrentIndex( 0 );
1431 cboGradientType->setCurrentIndex( 1 );
1434 cboGradientType->setCurrentIndex( 2 );
1437 cboGradientType->blockSignals(
false );
1439 cboCoordinateMode->blockSignals(
true );
1440 switch (
mLayer->coordinateMode() )
1443 cboCoordinateMode->setCurrentIndex( 1 );
1444 checkRefPoint1Centroid->setEnabled(
false );
1445 checkRefPoint2Centroid->setEnabled(
false );
1449 cboCoordinateMode->setCurrentIndex( 0 );
1452 cboCoordinateMode->blockSignals(
false );
1454 cboGradientSpread->blockSignals(
true );
1455 switch (
mLayer->gradientSpread() )
1458 cboGradientSpread->setCurrentIndex( 0 );
1461 cboGradientSpread->setCurrentIndex( 1 );
1464 cboGradientSpread->setCurrentIndex( 2 );
1467 cboGradientSpread->blockSignals(
false );
1469 spinRefPoint1X->blockSignals(
true );
1470 spinRefPoint1X->setValue(
mLayer->referencePoint1().x() );
1471 spinRefPoint1X->blockSignals(
false );
1472 spinRefPoint1Y->blockSignals(
true );
1473 spinRefPoint1Y->setValue(
mLayer->referencePoint1().y() );
1474 spinRefPoint1Y->blockSignals(
false );
1475 checkRefPoint1Centroid->blockSignals(
true );
1476 checkRefPoint1Centroid->setChecked(
mLayer->referencePoint1IsCentroid() );
1477 if (
mLayer->referencePoint1IsCentroid() )
1479 spinRefPoint1X->setEnabled(
false );
1480 spinRefPoint1Y->setEnabled(
false );
1482 checkRefPoint1Centroid->blockSignals(
false );
1483 spinRefPoint2X->blockSignals(
true );
1484 spinRefPoint2X->setValue(
mLayer->referencePoint2().x() );
1485 spinRefPoint2X->blockSignals(
false );
1486 spinRefPoint2Y->blockSignals(
true );
1487 spinRefPoint2Y->setValue(
mLayer->referencePoint2().y() );
1488 spinRefPoint2Y->blockSignals(
false );
1489 checkRefPoint2Centroid->blockSignals(
true );
1490 checkRefPoint2Centroid->setChecked(
mLayer->referencePoint2IsCentroid() );
1491 if (
mLayer->referencePoint2IsCentroid() )
1493 spinRefPoint2X->setEnabled(
false );
1494 spinRefPoint2Y->setEnabled(
false );
1496 checkRefPoint2Centroid->blockSignals(
false );
1498 spinOffsetX->blockSignals(
true );
1499 spinOffsetX->setValue(
mLayer->offset().x() );
1500 spinOffsetX->blockSignals(
false );
1501 spinOffsetY->blockSignals(
true );
1502 spinOffsetY->setValue(
mLayer->offset().y() );
1503 spinOffsetY->blockSignals(
false );
1504 mSpinAngle->blockSignals(
true );
1505 mSpinAngle->setValue(
mLayer->angle() );
1506 mSpinAngle->blockSignals(
false );
1508 mOffsetUnitWidget->blockSignals(
true );
1509 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1510 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1511 mOffsetUnitWidget->blockSignals(
false );
1535 mLayer->setColor( color );
1541 mLayer->setColor2( color );
1545void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1547 if ( radioTwoColor->isChecked() )
1560 if ( btnColorRamp->isNull() )
1563 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
1574 spinRefPoint1X->setValue( 0.5 );
1575 spinRefPoint1Y->setValue( 0 );
1576 spinRefPoint2X->setValue( 0.5 );
1577 spinRefPoint2Y->setValue( 1 );
1582 spinRefPoint1X->setValue( 0 );
1583 spinRefPoint1Y->setValue( 0 );
1584 spinRefPoint2X->setValue( 1 );
1585 spinRefPoint2Y->setValue( 1 );
1589 spinRefPoint1X->setValue( 0.5 );
1590 spinRefPoint1Y->setValue( 0.5 );
1591 spinRefPoint2X->setValue( 1 );
1592 spinRefPoint2Y->setValue( 1 );
1606 checkRefPoint1Centroid->setEnabled(
true );
1607 checkRefPoint2Centroid->setEnabled(
true );
1613 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1614 checkRefPoint1Centroid->setEnabled(
false );
1615 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1616 checkRefPoint2Centroid->setEnabled(
false );
1641void QgsGradientFillSymbolLayerWidget::offsetChanged()
1643 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1647void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1649 mLayer->setReferencePoint1( QPointF( spinRefPoint1X->value(), spinRefPoint1Y->value() ) );
1650 mLayer->setReferencePoint1IsCentroid( checkRefPoint1Centroid->isChecked() );
1651 mLayer->setReferencePoint2( QPointF( spinRefPoint2X->value(), spinRefPoint2Y->value() ) );
1652 mLayer->setReferencePoint2IsCentroid( checkRefPoint2Centroid->isChecked() );
1656void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1658 mLayer->setAngle( value );
1662void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1666 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1667 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1680 connect( mSpinBlurRadius, qOverload<int>( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1681 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1683 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1685 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1686 mDistanceUnitWidget->setUnits(
1689 mOffsetUnitWidget->setUnits(
1693 QButtonGroup *group1 =
new QButtonGroup(
this );
1694 group1->addButton( radioColorRamp );
1695 group1->addButton( radioTwoColor );
1696 QButtonGroup *group2 =
new QButtonGroup(
this );
1697 group2->addButton( mRadioUseMaxDistance );
1698 group2->addButton( mRadioUseWholeShape );
1699 btnChangeColor->setAllowOpacity(
true );
1700 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1701 btnChangeColor->setContext( u
"symbology"_s );
1702 btnChangeColor->setShowNoColor(
true );
1703 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1704 btnChangeColor2->setAllowOpacity(
true );
1705 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1706 btnChangeColor2->setContext( u
"symbology"_s );
1707 btnChangeColor2->setShowNoColor(
true );
1708 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1710 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1711 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1713 spinOffsetX->setClearValue( 0.0 );
1714 spinOffsetY->setClearValue( 0.0 );
1715 mSpinMaxDistance->setClearValue( 5.0 );
1717 btnColorRamp->setShowGradientOnly(
true );
1723 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1724 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1725 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1727 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1728 connect( mSpinBlurRadius,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1733 if ( layer->
layerType() !=
"ShapeburstFill"_L1 )
1740 btnChangeColor->blockSignals(
true );
1742 btnChangeColor->blockSignals(
false );
1743 btnChangeColor2->blockSignals(
true );
1744 btnChangeColor2->setColor(
mLayer->color2() );
1745 btnChangeColor2->blockSignals(
false );
1749 radioTwoColor->setChecked(
true );
1750 btnColorRamp->setEnabled(
false );
1754 radioColorRamp->setChecked(
true );
1755 btnChangeColor->setEnabled(
false );
1756 btnChangeColor2->setEnabled(
false );
1759 mSpinBlurRadius->blockSignals(
true );
1760 mBlurSlider->blockSignals(
true );
1761 mSpinBlurRadius->setValue(
mLayer->blurRadius() );
1762 mBlurSlider->setValue(
mLayer->blurRadius() );
1763 mSpinBlurRadius->blockSignals(
false );
1764 mBlurSlider->blockSignals(
false );
1766 mSpinMaxDistance->blockSignals(
true );
1767 mSpinMaxDistance->setValue(
mLayer->maxDistance() );
1768 mSpinMaxDistance->blockSignals(
false );
1770 mRadioUseWholeShape->blockSignals(
true );
1771 mRadioUseMaxDistance->blockSignals(
true );
1772 if (
mLayer->useWholeShape() )
1774 mRadioUseWholeShape->setChecked(
true );
1775 mSpinMaxDistance->setEnabled(
false );
1776 mDistanceUnitWidget->setEnabled(
false );
1780 mRadioUseMaxDistance->setChecked(
true );
1781 mSpinMaxDistance->setEnabled(
true );
1782 mDistanceUnitWidget->setEnabled(
true );
1784 mRadioUseWholeShape->blockSignals(
false );
1785 mRadioUseMaxDistance->blockSignals(
false );
1787 mDistanceUnitWidget->blockSignals(
true );
1788 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
1789 mDistanceUnitWidget->setMapUnitScale(
mLayer->distanceMapUnitScale() );
1790 mDistanceUnitWidget->blockSignals(
false );
1792 mIgnoreRingsCheckBox->blockSignals(
true );
1793 mIgnoreRingsCheckBox->setCheckState(
mLayer->ignoreRings() ? Qt::Checked : Qt::Unchecked );
1794 mIgnoreRingsCheckBox->blockSignals(
false );
1797 if (
mLayer->colorRamp() )
1799 btnColorRamp->blockSignals(
true );
1800 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1801 btnColorRamp->blockSignals(
false );
1804 spinOffsetX->blockSignals(
true );
1805 spinOffsetX->setValue(
mLayer->offset().x() );
1806 spinOffsetX->blockSignals(
false );
1807 spinOffsetY->blockSignals(
true );
1808 spinOffsetY->setValue(
mLayer->offset().y() );
1809 spinOffsetY->blockSignals(
false );
1810 mOffsetUnitWidget->blockSignals(
true );
1811 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1812 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1813 mOffsetUnitWidget->blockSignals(
false );
1833 mLayer->setColor( color );
1842 mLayer->setColor2( color );
1847void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1854 if ( radioTwoColor->isChecked() )
1865void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1869 mLayer->setBlurRadius( value );
1874void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1878 mLayer->setMaxDistance( value );
1883void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1887 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
1888 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
1893void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1897 mLayer->setUseWholeShape( value );
1898 mDistanceUnitWidget->setEnabled( !value );
1903void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1905 QgsColorRamp *ramp = btnColorRamp->colorRamp();
1909 mLayer->setColorRamp( ramp );
1913void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1917 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1922void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1926 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1927 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1933void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1935 const bool checked = ( state == Qt::Checked );
1936 mLayer->setIgnoreRings( checked );
1944 , mSymbolType( symbolType )
1951 connect( mOffsetAlongLineUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed );
1957 mIntervalUnitWidget->setUnits( units );
1958 mOffsetUnitWidget->setUnits( units );
1960 mAverageAngleUnit->setUnits( units );
1961 mIntervalUnitWidget->setUnits( units );
1962 mBlankSegmentsUnitWidget->setUnits( units );
1967 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1975 spinOffset->setClearValue( 0.0 );
1976 mSpinOffsetAlongLine->setClearValue( 0.0 );
1977 mHashRotationSpinBox->setClearValue( 0 );
1978 mSpinAverageAngleLength->setClearValue( 4.0 );
1982 connect( mSpinHashLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashLength );
1983 connect( mHashRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashAngle );
1984 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsTemplatedLineSymbolLayerWidget::setRotate );
1985 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setOffset );
1986 connect( mSpinAverageAngleLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setAverageAngle );
1987 connect( mEditBlankSegmentsBtn, &QToolButton::toggled,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolEditBlankSegments );
1989 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1990 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1991 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1992 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1993 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1994 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1995 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1997 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [
this] {
2000 mLayer->setPlaceOnEveryPart( mCheckPlaceOnEveryPart->isChecked() );
2006 switch ( mSymbolType )
2011 mHashLengthUnitWidget->setUnits(
2014 mPlacementLabel->setText( tr(
"Hash placement" ) );
2015 chkRotateMarker->setText( tr(
"Rotate hash to follow line direction" ) );
2016 mHashLengthLabel->setVisible(
true );
2017 mSpinHashLength->setVisible(
true );
2018 mHashLengthUnitWidget->setVisible(
true );
2019 mHashLengthDDBtn->setVisible(
true );
2020 mHashRotationLabel->setVisible(
true );
2021 mHashRotationSpinBox->setVisible(
true );
2022 mHashRotationDDBtn->setVisible(
true );
2027 mPlacementLabel->setText( tr(
"Marker placement" ) );
2028 chkRotateMarker->setText( tr(
"Rotate marker to follow line direction" ) );
2029 mHashLengthLabel->setVisible(
false );
2030 mSpinHashLength->setVisible(
false );
2031 mHashLengthUnitWidget->setVisible(
false );
2032 mHashLengthDDBtn->setVisible(
false );
2033 mHashRotationLabel->setVisible(
false );
2034 mHashRotationSpinBox->setVisible(
false );
2035 mHashRotationDDBtn->setVisible(
false );
2041 switch ( mSymbolType )
2044 if ( layer->
layerType() !=
"HashLine"_L1 )
2049 if ( layer->
layerType() !=
"MarkerLine"_L1 )
2057 spinInterval->blockSignals(
true );
2058 spinInterval->setValue( mLayer->interval() );
2059 spinInterval->blockSignals(
false );
2060 mSpinOffsetAlongLine->blockSignals(
true );
2061 mSpinOffsetAlongLine->setValue( mLayer->offsetAlongLine() );
2062 mSpinOffsetAlongLine->blockSignals(
false );
2064 chkRotateMarker->blockSignals(
true );
2065 chkRotateMarker->setChecked( mLayer->rotateSymbols() );
2066 chkRotateMarker->blockSignals(
false );
2067 spinOffset->blockSignals(
true );
2068 spinOffset->setValue( mLayer->offset() );
2069 spinOffset->blockSignals(
false );
2078 whileBlocking( mCheckPlaceOnEveryPart )->setChecked( mLayer->placeOnEveryPart() );
2081 mIntervalUnitWidget->blockSignals(
true );
2082 mIntervalUnitWidget->setUnit( mLayer->intervalUnit() );
2083 mIntervalUnitWidget->
setMapUnitScale( mLayer->intervalMapUnitScale() );
2084 mIntervalUnitWidget->blockSignals(
false );
2085 mOffsetUnitWidget->blockSignals(
true );
2086 mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2087 mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2088 mOffsetUnitWidget->blockSignals(
false );
2089 mOffsetAlongLineUnitWidget->blockSignals(
true );
2090 mOffsetAlongLineUnitWidget->setUnit( mLayer->offsetAlongLineUnit() );
2091 mOffsetAlongLineUnitWidget->setMapUnitScale( mLayer->offsetAlongLineMapUnitScale() );
2092 mOffsetAlongLineUnitWidget->blockSignals(
false );
2093 whileBlocking( mAverageAngleUnit )->setUnit( mLayer->averageAngleUnit() );
2094 whileBlocking( mAverageAngleUnit )->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
2095 whileBlocking( mSpinAverageAngleLength )->setValue( mLayer->averageAngleLength() );
2096 whileBlocking( mBlankSegmentsUnitWidget )->setUnit( mLayer->blankSegmentsUnit() );
2098 switch ( mSymbolType )
2116 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
2130 updateBlankSegmentsWidget();
2142 switch (
context.symbolType() )
2147 mRingFilterComboBox->hide();
2148 mRingsLabel->hide();
2159 mLayer->setInterval( val );
2165 mLayer->setOffsetAlongLine( val );
2169void QgsTemplatedLineSymbolLayerWidget::setHashLength(
double val )
2171 switch ( mSymbolType )
2186void QgsTemplatedLineSymbolLayerWidget::setHashAngle(
double val )
2191 switch ( mSymbolType )
2195 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2206void QgsTemplatedLineSymbolLayerWidget::setRotate()
2208 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2209 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2211 mLayer->setRotateSymbols( chkRotateMarker->isChecked() );
2215void QgsTemplatedLineSymbolLayerWidget::setOffset()
2217 mLayer->setOffset( spinOffset->value() );
2221void QgsTemplatedLineSymbolLayerWidget::setPlacement()
2223 const bool interval = mCheckInterval->isChecked();
2224 spinInterval->setEnabled( interval );
2225 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2226 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2227 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2228 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2229 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2232 if ( mCheckInterval->isChecked() )
2234 if ( mCheckVertex->isChecked() )
2236 if ( mCheckVertexLast->isChecked() )
2238 if ( mCheckVertexFirst->isChecked() )
2240 if ( mCheckCurvePoint->isChecked() )
2242 if ( mCheckSegmentCentralPoint->isChecked() )
2244 if ( mCheckCentralPoint->isChecked() )
2246 mLayer->setPlacements( placements );
2251void QgsTemplatedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2255 mLayer->setIntervalUnit( mIntervalUnitWidget->unit() );
2256 mLayer->setIntervalMapUnitScale( mIntervalUnitWidget->getMapUnitScale() );
2261void QgsTemplatedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2265 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2266 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2271void QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2275 mLayer->setOffsetAlongLineUnit( mOffsetAlongLineUnitWidget->unit() );
2276 mLayer->setOffsetAlongLineMapUnitScale( mOffsetAlongLineUnitWidget->getMapUnitScale() );
2281void QgsTemplatedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2286 switch ( mSymbolType )
2290 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2302void QgsTemplatedLineSymbolLayerWidget::averageAngleUnitChanged()
2306 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
2307 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
2312void QgsTemplatedLineSymbolLayerWidget::blankSegmentsUnitChanged()
2316 mLayer->setBlankSegmentsUnit( mBlankSegmentsUnitWidget->unit() );
2321void QgsTemplatedLineSymbolLayerWidget::setAverageAngle(
double val )
2325 mLayer->setAverageAngleLength( val );
2330void QgsTemplatedLineSymbolLayerWidget::toggleMapToolEditBlankSegments(
bool toggled )
2332 if ( mMapToolEditBlankSegments )
2335 mMapToolEditBlankSegments.reset();
2340 switch ( mSymbolType )
2355void QgsTemplatedLineSymbolLayerWidget::updateBlankSegmentsWidget()
2357 mEditBlankSegmentsBtn->setEnabled( blankSegmentsFieldIndex() > -1 );
2359 switch ( mSymbolType )
2362 tooltip = tr(
"Tool to create blank segments where hashed lines won't be displayed" );
2366 tooltip = tr(
"Tool to create blank segments where marker lines won't be displayed" );
2370 if ( !mEditBlankSegmentsBtn->isEnabled() )
2372 tooltip += u
"<br/><br/>"_s + tr(
"This tool is disabled because no valid field property has been set" );
2375 mEditBlankSegmentsBtn->setToolTip( tooltip );
2378int QgsTemplatedLineSymbolLayerWidget::blankSegmentsFieldIndex()
const
2416 mSvgSelectorWidget->setAllowParameters(
true );
2417 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2418 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( u
"/UI/lastSVGMarkerDir"_s );
2419 mSvgSelectorWidget->initParametersModel(
this, vl );
2423 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2424 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2428 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2429 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2430 mSizeUnitWidget->setUnits(
2433 mStrokeWidthUnitWidget->setUnits(
2436 mOffsetUnitWidget->setUnits(
2439 mChangeColorButton->setAllowOpacity(
true );
2440 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2441 mChangeColorButton->setContext( u
"symbology"_s );
2442 mChangeStrokeColorButton->setAllowOpacity(
true );
2443 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2444 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2446 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2447 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2449 spinOffsetX->setClearValue( 0.0 );
2450 spinOffsetY->setClearValue( 0.0 );
2451 spinAngle->setClearValue( 0.0 );
2453 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2454 connect( spinHeight,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2456 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2457 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2458 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2465 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
2469 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2470 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2477#include <QAbstractListModel>
2478#include <QPixmapCache>
2491 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2492 QColor defaultFill, defaultStroke;
2493 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2494 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2498 hasDefaultFillColor,
2500 hasFillOpacityParam,
2501 hasDefaultFillOpacity,
2504 hasDefaultStrokeColor,
2506 hasStrokeWidthParam,
2507 hasDefaultStrokeWidth,
2509 hasStrokeOpacityParam,
2510 hasDefaultStrokeOpacity,
2511 defaultStrokeOpacity
2513 mChangeColorButton->setEnabled( hasFillParam );
2514 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2515 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2516 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2517 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2522 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2523 if ( hasDefaultFillColor && !skipDefaultColors )
2527 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2528 mChangeColorButton->setColor( fill );
2530 if ( hasStrokeParam )
2533 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2534 if ( hasDefaultStrokeColor && !skipDefaultColors )
2536 stroke = defaultStroke;
2538 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2539 mChangeStrokeColorButton->setColor( stroke );
2542 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2544 mStrokeWidthSpinBox->blockSignals(
true );
2545 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2546 mStrokeWidthSpinBox->blockSignals(
false );
2549 spinHeight->blockSignals(
true );
2550 if ( preservedAspectRatio )
2559 spinHeight->blockSignals(
false );
2560 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2563void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2565 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
2567 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2569 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
2572 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2583 if ( layer->
layerType() !=
"SvgMarker"_L1 )
2590 mSvgSelectorWidget->setSvgPath(
mLayer->path() );
2591 mSvgSelectorWidget->setSvgParameters(
mLayer->parameters() );
2593 spinWidth->blockSignals(
true );
2594 spinWidth->setValue(
mLayer->size() );
2595 spinWidth->blockSignals(
false );
2596 spinAngle->blockSignals(
true );
2597 spinAngle->setValue(
mLayer->angle() );
2598 spinAngle->blockSignals(
false );
2601 spinOffsetX->blockSignals(
true );
2602 spinOffsetX->setValue(
mLayer->offset().x() );
2603 spinOffsetX->blockSignals(
false );
2604 spinOffsetY->blockSignals(
true );
2605 spinOffsetY->setValue(
mLayer->offset().y() );
2606 spinOffsetY->blockSignals(
false );
2608 mSizeUnitWidget->blockSignals(
true );
2609 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
2611 mSizeUnitWidget->blockSignals(
false );
2612 mStrokeWidthUnitWidget->blockSignals(
true );
2613 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
2614 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
2615 mStrokeWidthUnitWidget->blockSignals(
false );
2616 mOffsetUnitWidget->blockSignals(
true );
2617 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
2618 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
2619 mOffsetUnitWidget->blockSignals(
false );
2622 mHorizontalAnchorComboBox->blockSignals(
true );
2623 mVerticalAnchorComboBox->blockSignals(
true );
2624 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
2625 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
2626 mHorizontalAnchorComboBox->blockSignals(
false );
2627 mVerticalAnchorComboBox->blockSignals(
false );
2643 updateAssistantSymbol();
2654 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2660 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2668 mLayer->setParameters( parameters );
2669 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2675void QgsSvgMarkerSymbolLayerWidget::setWidth()
2678 double fixedAspectRatio = 0.0;
2679 spinHeight->blockSignals(
true );
2680 if ( defaultAspectRatio <= 0.0 )
2682 spinHeight->setValue( spinWidth->value() );
2684 else if ( mLockAspectRatio->locked() )
2686 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2690 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2692 spinHeight->blockSignals(
false );
2693 mLayer->setSize( spinWidth->value() );
2694 mLayer->setFixedAspectRatio( fixedAspectRatio );
2698void QgsSvgMarkerSymbolLayerWidget::setHeight()
2700 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2701 double fixedAspectRatio = 0.0;
2702 spinWidth->blockSignals(
true );
2703 if ( defaultAspectRatio <= 0.0 )
2705 spinWidth->setValue( spinHeight->value() );
2707 else if ( mLockAspectRatio->locked() )
2709 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2713 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2715 spinWidth->blockSignals(
false );
2716 mLayer->setSize( spinWidth->value() );
2717 mLayer->setFixedAspectRatio( fixedAspectRatio );
2721void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2724 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2725 if ( defaultAspectRatio <= 0.0 )
2731 mLayer->setFixedAspectRatio( 0.0 );
2736 mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
2741void QgsSvgMarkerSymbolLayerWidget::setAngle()
2743 mLayer->setAngle( spinAngle->value() );
2747void QgsSvgMarkerSymbolLayerWidget::setOffset()
2749 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2753void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2760void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2767 mLayer->setFillColor( color );
2771void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2778 mLayer->setStrokeColor( color );
2782void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2786 mLayer->setStrokeWidth( d );
2791void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2795 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
2796 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
2801void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2805 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
2806 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
2811void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2815 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2816 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2821void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
2830void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
2847 mSvgSelectorWidget->setAllowParameters(
true );
2848 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2850 connect( mTextureWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2852 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2854 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2855 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2858 mTextureWidthUnitWidget->setUnits(
2861 mSvgStrokeWidthUnitWidget->setUnits(
2865 mRotationSpinBox->setClearValue( 0.0 );
2867 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2868 mChangeColorButton->setContext( u
"symbology"_s );
2869 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2870 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2872 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2873 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2886 if ( layer->
layerType() !=
"SVGFill"_L1 )
2894 const double width =
mLayer->patternWidth();
2895 mTextureWidthSpinBox->blockSignals(
true );
2896 mTextureWidthSpinBox->setValue( width );
2897 mTextureWidthSpinBox->blockSignals(
false );
2898 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource(
mLayer->svgFilePath() );
2899 mRotationSpinBox->blockSignals(
true );
2900 mRotationSpinBox->setValue(
mLayer->angle() );
2901 mRotationSpinBox->blockSignals(
false );
2902 mTextureWidthUnitWidget->blockSignals(
true );
2903 mTextureWidthUnitWidget->setUnit(
mLayer->patternWidthUnit() );
2904 mTextureWidthUnitWidget->setMapUnitScale(
mLayer->patternWidthMapUnitScale() );
2905 mTextureWidthUnitWidget->blockSignals(
false );
2906 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2907 mSvgStrokeWidthUnitWidget->setUnit(
mLayer->svgStrokeWidthUnit() );
2908 mSvgStrokeWidthUnitWidget->setMapUnitScale(
mLayer->svgStrokeWidthMapUnitScale() );
2909 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2910 mChangeColorButton->blockSignals(
true );
2911 mChangeColorButton->setColor(
mLayer->svgFillColor() );
2912 mChangeColorButton->blockSignals(
false );
2913 mChangeStrokeColorButton->blockSignals(
true );
2914 mChangeStrokeColorButton->setColor(
mLayer->svgStrokeColor() );
2915 mChangeStrokeColorButton->blockSignals(
false );
2916 mStrokeWidthSpinBox->blockSignals(
true );
2917 mStrokeWidthSpinBox->setValue(
mLayer->svgStrokeWidth() );
2918 mStrokeWidthSpinBox->blockSignals(
false );
2939 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2942void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2951void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2958 mLayer->setSvgFilePath( text );
2963void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2965 mLayer->setSvgFilePath( name );
2966 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2972void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
2974 mLayer->setParameters( parameters );
2975 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2982void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2994 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2995 QColor defaultFill, defaultStroke;
2996 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2997 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2999 mSvgSelectorWidget->sourceLineEdit()->source(),
3001 hasDefaultFillColor,
3003 hasFillOpacityParam,
3004 hasDefaultFillOpacity,
3007 hasDefaultStrokeColor,
3009 hasStrokeWidthParam,
3010 hasDefaultStrokeWidth,
3012 hasStrokeOpacityParam,
3013 hasDefaultStrokeOpacity,
3014 defaultStrokeOpacity
3018 QColor fill = mChangeColorButton->color();
3019 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
3020 if ( hasDefaultFillColor )
3024 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
3025 mChangeColorButton->setColor( fill );
3027 mChangeColorButton->setEnabled( hasFillParam );
3028 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
3031 QColor stroke = mChangeStrokeColorButton->color();
3032 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
3033 if ( hasDefaultStrokeColor )
3035 stroke = defaultStroke;
3037 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
3038 mChangeStrokeColorButton->setColor( stroke );
3040 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
3041 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
3042 if ( hasDefaultStrokeWidth && resetValues )
3044 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
3046 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
3049void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
3056 mLayer->setSvgFillColor( color );
3060void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
3067 mLayer->setSvgStrokeColor( color );
3071void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3075 mLayer->setSvgStrokeWidth( d );
3080void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
3084 mLayer->setPatternWidthUnit( mTextureWidthUnitWidget->unit() );
3085 mLayer->setPatternWidthMapUnitScale( mTextureWidthUnitWidget->getMapUnitScale() );
3090void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3094 mLayer->setSvgStrokeWidthUnit( mSvgStrokeWidthUnitWidget->unit() );
3095 mLayer->setSvgStrokeWidthMapUnitScale( mSvgStrokeWidthUnitWidget->getMapUnitScale() );
3106 connect( mAngleSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3107 connect( mDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3108 connect( mOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3111 mDistanceUnitWidget->setUnits(
3114 mOffsetUnitWidget->setUnits(
3124 mOffsetSpinBox->setClearValue( 0 );
3125 mAngleSpinBox->setClearValue( 0 );
3129 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3140 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3151 if ( layer->
layerType() !=
"LinePatternFill"_L1 )
3165 mDistanceUnitWidget->blockSignals(
true );
3166 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
3168 mDistanceUnitWidget->blockSignals(
false );
3169 mOffsetUnitWidget->blockSignals(
true );
3170 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3171 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3172 mOffsetUnitWidget->blockSignals(
false );
3174 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3176 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3190void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3199void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3203 mLayer->setDistance( d );
3208void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3217void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3221 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
3222 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
3227void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3231 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3232 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3243 connect( mHorizontalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3244 connect( mVerticalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3245 connect( mHorizontalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3246 connect( mVerticalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3247 connect( mHorizontalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3248 connect( mVerticalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3249 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3250 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3251 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3252 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3253 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3254 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3255 mHorizontalDistanceUnitWidget->setUnits(
3258 mVerticalDistanceUnitWidget->setUnits(
3261 mHorizontalDisplacementUnitWidget->setUnits(
3271 mVerticalDisplacementUnitWidget->setUnits(
3281 mHorizontalOffsetUnitWidget->setUnits(
3291 mVerticalOffsetUnitWidget->setUnits(
3306 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3316 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3324 mSeedSpinBox->setShowClearButton(
true );
3325 mSeedSpinBox->setClearValue( 0 );
3326 mRandomXSpinBox->setClearValue( 0 );
3327 mRandomYSpinBox->setClearValue( 0 );
3329 mRandomXOffsetUnitWidget->setUnits(
3339 mRandomYOffsetUnitWidget->setUnits(
3349 connect( mRandomXSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3352 mLayer->setMaximumRandomDeviationX( d );
3356 connect( mRandomYSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3359 mLayer->setMaximumRandomDeviationY( d );
3366 mLayer->setRandomDeviationXUnit( mRandomXOffsetUnitWidget->unit() );
3367 mLayer->setRandomDeviationXMapUnitScale( mRandomXOffsetUnitWidget->getMapUnitScale() );
3374 mLayer->setRandomDeviationYUnit( mRandomYOffsetUnitWidget->unit() );
3375 mLayer->setRandomDeviationYMapUnitScale( mRandomYOffsetUnitWidget->getMapUnitScale() );
3379 connect( mSeedSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [
this](
int v ) {
3387 mAngleSpinBox->setShowClearButton(
true );
3388 mAngleSpinBox->setClearValue( 0 );
3389 connect( mAngleSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3400 if ( !layer || layer->
layerType() !=
"PointPatternFill"_L1 )
3414 mHorizontalDistanceUnitWidget->blockSignals(
true );
3415 mHorizontalDistanceUnitWidget->setUnit(
mLayer->distanceXUnit() );
3417 mHorizontalDistanceUnitWidget->blockSignals(
false );
3418 mVerticalDistanceUnitWidget->blockSignals(
true );
3419 mVerticalDistanceUnitWidget->setUnit(
mLayer->distanceYUnit() );
3420 mVerticalDistanceUnitWidget->setMapUnitScale(
mLayer->distanceYMapUnitScale() );
3421 mVerticalDistanceUnitWidget->blockSignals(
false );
3422 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3423 mHorizontalDisplacementUnitWidget->setUnit(
mLayer->displacementXUnit() );
3424 mHorizontalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementXMapUnitScale() );
3425 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3426 mVerticalDisplacementUnitWidget->blockSignals(
true );
3427 mVerticalDisplacementUnitWidget->setUnit(
mLayer->displacementYUnit() );
3428 mVerticalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementYMapUnitScale() );
3429 mVerticalDisplacementUnitWidget->blockSignals(
false );
3430 mHorizontalOffsetUnitWidget->blockSignals(
true );
3431 mHorizontalOffsetUnitWidget->setUnit(
mLayer->offsetXUnit() );
3432 mHorizontalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetXMapUnitScale() );
3433 mHorizontalOffsetUnitWidget->blockSignals(
false );
3434 mVerticalOffsetUnitWidget->blockSignals(
true );
3435 mVerticalOffsetUnitWidget->setUnit(
mLayer->offsetYUnit() );
3436 mVerticalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetYMapUnitScale() );
3437 mVerticalOffsetUnitWidget->blockSignals(
false );
3439 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3440 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3445 whileBlocking( mRandomXOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationXMapUnitScale() );
3447 whileBlocking( mRandomYOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationYMapUnitScale() );
3469void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3478void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3482 mLayer->setDistanceY( d );
3487void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3491 mLayer->setDisplacementX( d );
3496void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3500 mLayer->setDisplacementY( d );
3505void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3514void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3523void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3527 mLayer->setDistanceXUnit( mHorizontalDistanceUnitWidget->unit() );
3528 mLayer->setDistanceXMapUnitScale( mHorizontalDistanceUnitWidget->getMapUnitScale() );
3533void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3537 mLayer->setDistanceYUnit( mVerticalDistanceUnitWidget->unit() );
3538 mLayer->setDistanceYMapUnitScale( mVerticalDistanceUnitWidget->getMapUnitScale() );
3543void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3547 mLayer->setDisplacementXUnit( mHorizontalDisplacementUnitWidget->unit() );
3548 mLayer->setDisplacementXMapUnitScale( mHorizontalDisplacementUnitWidget->getMapUnitScale() );
3553void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3557 mLayer->setDisplacementYUnit( mVerticalDisplacementUnitWidget->unit() );
3558 mLayer->setDisplacementYMapUnitScale( mVerticalDisplacementUnitWidget->getMapUnitScale() );
3563void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3567 mLayer->setOffsetXUnit( mHorizontalOffsetUnitWidget->unit() );
3568 mLayer->setOffsetXMapUnitScale( mHorizontalOffsetUnitWidget->getMapUnitScale() );
3573void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3577 mLayer->setOffsetYUnit( mVerticalOffsetUnitWidget->unit() );
3578 mLayer->setOffsetYMapUnitScale( mVerticalOffsetUnitWidget->getMapUnitScale() );
3604 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3605 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3606 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3607 mSizeUnitWidget->setUnits(
3610 mStrokeWidthUnitWidget->setUnits(
3613 mOffsetUnitWidget->setUnits(
3619 scrollArea->setVerticalOnly(
true );
3621 btnColor->setAllowOpacity(
true );
3622 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3623 btnColor->setContext( u
"symbology"_s );
3624 btnStrokeColor->setAllowOpacity(
true );
3625 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3626 btnStrokeColor->setContext( u
"symbology"_s );
3628 mColorDDBtn->registerLinkedWidget( btnColor );
3629 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3631 spinOffsetX->setClearValue( 0.0 );
3632 spinOffsetY->setClearValue( 0.0 );
3633 spinAngle->setClearValue( 0.0 );
3636 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
3639 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3642 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3644 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3647 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3649 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3650 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3661 if ( layer->
layerType() !=
"FontMarker"_L1 )
3670 mFontStyleComboBox->blockSignals(
true );
3671 populateFontStyleComboBox();
3672 mFontStyleComboBox->blockSignals(
false );
3684 if (
mLayer->character().length() == 1 )
3690 mCharPreview->setFont( mRefFont );
3696 mSizeUnitWidget->blockSignals(
true );
3697 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3698 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3699 mSizeUnitWidget->blockSignals(
false );
3701 mStrokeWidthUnitWidget->blockSignals(
true );
3702 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
3703 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
3704 mStrokeWidthUnitWidget->blockSignals(
false );
3706 mOffsetUnitWidget->blockSignals(
true );
3707 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3708 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3709 mOffsetUnitWidget->blockSignals(
false );
3714 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3715 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3730 updateAssistantSymbol();
3742 mLayer->setFontFamily( font.family() );
3745 mCharPreview->setFont( mRefFont );
3746 populateFontStyleComboBox();
3751void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3758 mCharPreview->setFont( mRefFont );
3765 mLayer->setColor( color );
3771 mLayer->setStrokeColor( color );
3784 mLayer->setAngle( angle );
3790 mCharPreview->setText( text );
3792 if ( text.isEmpty() )
3796 QString character = text;
3797 if ( text.contains( QRegularExpression( u
"^0x[0-9a-fA-F]{1,4}$"_s ) ) )
3800 const unsigned int value = text.toUInt( &ok, 0 );
3803 character = QChar( value );
3804 mCharPreview->setText( character );
3808 if ( character !=
mLayer->character() )
3810 mLayer->setCharacter( character );
3811 if (
mLayer->character().length() == 1 )
3825 if (
mLayer->character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3827 mCharLineEdit->insert( chr );
3831 mLayer->setCharacter( chr );
3833 mCharPreview->setText( chr );
3837void QgsFontMarkerSymbolLayerWidget::setOffset()
3839 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3843void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3845 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
3849void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3853 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
3854 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3859void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3863 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3864 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3869void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3873 mLayer->setStrokeWidthUnit( mSizeUnitWidget->unit() );
3874 mLayer->setStrokeWidthMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3879void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3881 mFontStyleComboBox->clear();
3882 const QStringList styles = mFontDB.styles( mRefFont.family() );
3883 const auto constStyles = styles;
3884 for (
const QString &style : constStyles )
3886 mFontStyleComboBox->addItem( style );
3889 QString targetStyle = mFontDB.styleString( mRefFont );
3890 if ( !styles.contains( targetStyle ) )
3893 targetStyle = QFontInfo( f ).styleName();
3894 mRefFont.setStyleName( targetStyle );
3897 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
3898 if ( stylIndx > -1 )
3903 mFontStyleComboBox->setCurrentIndex( curIndx );
3906void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3909 setFontStyle( mFontStyleComboBox->currentText() );
3912void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
3921void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
3930void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3934 mLayer->setStrokeWidth( d );
3939void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3941 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
3943 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3945 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
3948 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3960 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3961 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3962 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3963 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3968 if ( layer->
layerType() !=
"CentroidFill"_L1 )
3978 whileBlocking( mClipOnCurrentPartOnlyCheckBox )->setChecked(
mLayer->clipOnCurrentPartOnly() );
3986void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3992void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3994 mLayer->setPointOnAllParts( state == Qt::Checked );
3998void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
4000 mLayer->setClipPoints( state == Qt::Checked );
4004void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
4006 mLayer->setClipOnCurrentPartOnly( state == Qt::Checked );
4027 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4031 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
4033 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
4034 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
4037 mSizeUnitWidget->setUnits(
4047 mOffsetUnitWidget->setUnits(
4051 mSpinOffsetX->setClearValue( 0.0 );
4052 mSpinOffsetY->setClearValue( 0.0 );
4053 mRotationSpinBox->setClearValue( 0.0 );
4055 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4056 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4059 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4060 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4070 if ( layer->
layerType() !=
"RasterMarker"_L1 )
4080 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4081 mHeightSpinBox->blockSignals(
true );
4082 if ( preservedAspectRatio )
4084 mHeightSpinBox->setValue(
mLayer->size() );
4088 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4090 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4091 mHeightSpinBox->blockSignals(
false );
4092 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4100 mSizeUnitWidget->blockSignals(
true );
4101 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4102 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4103 mSizeUnitWidget->blockSignals(
false );
4104 mOffsetUnitWidget->blockSignals(
true );
4105 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4106 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4107 mOffsetUnitWidget->blockSignals(
false );
4110 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4111 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4122 updatePreviewImage();
4133 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4136void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4139 updatePreviewImage();
4143void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
4145 bool fitsInCache =
false;
4147 if ( image.isNull() )
4149 mLabelImagePreview->setPixmap( QPixmap() );
4153 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4154 previewImage.fill( Qt::transparent );
4155 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4157 p.begin( &previewImage );
4159 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4160 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4161 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4162 QBrush checkerBrush;
4163 checkerBrush.setTexture( pix );
4164 p.fillRect( imageRect, checkerBrush );
4166 if (
mLayer->opacity() < 1.0 )
4168 p.setOpacity(
mLayer->opacity() );
4171 p.drawImage( imageRect.left(), imageRect.top(), image );
4173 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4176void QgsRasterMarkerSymbolLayerWidget::setWidth()
4178 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4179 double fixedAspectRatio = 0.0;
4180 mHeightSpinBox->blockSignals(
true );
4181 if ( defaultAspectRatio <= 0.0 )
4183 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4185 else if ( mLockAspectRatio->locked() )
4187 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4191 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4193 mHeightSpinBox->blockSignals(
false );
4194 mLayer->setSize( mWidthSpinBox->value() );
4195 mLayer->setFixedAspectRatio( fixedAspectRatio );
4199void QgsRasterMarkerSymbolLayerWidget::setHeight()
4201 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4202 double fixedAspectRatio = 0.0;
4203 mWidthSpinBox->blockSignals(
true );
4204 if ( defaultAspectRatio <= 0.0 )
4206 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4208 else if ( mLockAspectRatio->locked() )
4210 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4214 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4216 mWidthSpinBox->blockSignals(
false );
4217 mLayer->setSize( mWidthSpinBox->value() );
4218 mLayer->setFixedAspectRatio( fixedAspectRatio );
4222void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4224 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4225 if ( defaultAspectRatio <= 0.0 )
4231 mLayer->setFixedAspectRatio( 0.0 );
4236 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4240void QgsRasterMarkerSymbolLayerWidget::setAngle()
4242 mLayer->setAngle( mRotationSpinBox->value() );
4246void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4248 mLayer->setOpacity( value );
4250 updatePreviewImage();
4253void QgsRasterMarkerSymbolLayerWidget::setOffset()
4255 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4259void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4263 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4264 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4269void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4273 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4274 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4279void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4288void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4315 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastAnimatedMarkerImageDir"_s );
4319 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4321 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4322 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4325 mFrameRateSpin->setClearValue( 10 );
4326 mFrameRateSpin->setShowClearButton(
true );
4327 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
4328 mLayer->setFrameRate( value );
4332 mSizeUnitWidget->setUnits(
4342 mOffsetUnitWidget->setUnits(
4346 mSpinOffsetX->setClearValue( 0.0 );
4347 mSpinOffsetY->setClearValue( 0.0 );
4348 mRotationSpinBox->setClearValue( 0.0 );
4350 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4351 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4354 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4355 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4365 if ( layer->
layerType() !=
"AnimatedMarker"_L1 )
4375 if ( firstFrameTime > 0 )
4377 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4381 mFrameRateSpin->setClearValue( 10 );
4385 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4386 mHeightSpinBox->blockSignals(
true );
4387 if ( preservedAspectRatio )
4389 mHeightSpinBox->setValue(
mLayer->size() );
4393 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4395 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4396 mHeightSpinBox->blockSignals(
false );
4397 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4407 mSizeUnitWidget->blockSignals(
true );
4408 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4409 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4410 mSizeUnitWidget->blockSignals(
false );
4411 mOffsetUnitWidget->blockSignals(
true );
4412 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4413 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4414 mOffsetUnitWidget->blockSignals(
false );
4417 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4418 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4429 updatePreviewImage();
4440 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4443void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4448 if ( firstFrameTime > 0 )
4450 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4454 mFrameRateSpin->setClearValue( 10 );
4456 updatePreviewImage();
4460void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4462 if ( mPreviewMovie )
4464 mLabelImagePreview->setMovie(
nullptr );
4465 mPreviewMovie->deleteLater();
4466 mPreviewMovie =
nullptr;
4469 mPreviewMovie =
new QMovie(
mLayer->path(), QByteArray(),
this );
4470 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4471 mLabelImagePreview->setMovie( mPreviewMovie );
4472 mPreviewMovie->start();
4475void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4477 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4478 double fixedAspectRatio = 0.0;
4479 mHeightSpinBox->blockSignals(
true );
4480 if ( defaultAspectRatio <= 0.0 )
4482 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4484 else if ( mLockAspectRatio->locked() )
4486 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4490 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4492 mHeightSpinBox->blockSignals(
false );
4493 mLayer->setSize( mWidthSpinBox->value() );
4494 mLayer->setFixedAspectRatio( fixedAspectRatio );
4498void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4500 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4501 double fixedAspectRatio = 0.0;
4502 mWidthSpinBox->blockSignals(
true );
4503 if ( defaultAspectRatio <= 0.0 )
4505 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4507 else if ( mLockAspectRatio->locked() )
4509 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4513 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4515 mWidthSpinBox->blockSignals(
false );
4516 mLayer->setSize( mWidthSpinBox->value() );
4517 mLayer->setFixedAspectRatio( fixedAspectRatio );
4521void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4523 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4524 if ( defaultAspectRatio <= 0.0 )
4530 mLayer->setFixedAspectRatio( 0.0 );
4535 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4539void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4541 mLayer->setAngle( mRotationSpinBox->value() );
4545void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4547 mLayer->setOpacity( value );
4549 updatePreviewImage();
4552void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4554 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4558void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4562 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4563 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4568void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4572 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4573 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4578void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4587void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4604 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4608 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4615 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4616 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4619 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4628 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4637 mSizeUnitWidget->setUnits(
4647 mOffsetUnitWidget->setUnits(
4651 mSpinOffsetX->setClearValue( 0.0 );
4652 mSpinOffsetY->setClearValue( 0.0 );
4653 mRotationSpinBox->setClearValue( 0.0 );
4655 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4656 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4657 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4669 if ( layer->
layerType() !=
"RasterFill"_L1 )
4682 cboCoordinateMode->blockSignals(
true );
4683 switch (
mLayer->coordinateMode() )
4686 cboCoordinateMode->setCurrentIndex( 1 );
4690 cboCoordinateMode->setCurrentIndex( 0 );
4693 cboCoordinateMode->blockSignals(
false );
4699 mOffsetUnitWidget->blockSignals(
true );
4700 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4701 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4702 mOffsetUnitWidget->blockSignals(
false );
4705 mSizeUnitWidget->blockSignals(
true );
4706 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4707 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4708 mSizeUnitWidget->blockSignals(
false );
4712 updatePreviewImage();
4727void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4730 updatePreviewImage();
4734void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4751void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4758 mLayer->setOpacity( value );
4760 updatePreviewImage();
4763void QgsRasterFillSymbolLayerWidget::offsetChanged()
4765 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4769void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4775 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4776 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4780void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4789void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4791 bool fitsInCache =
false;
4793 if ( image.isNull() )
4795 mLabelImagePreview->setPixmap( QPixmap() );
4799 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4800 previewImage.fill( Qt::transparent );
4801 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4803 p.begin( &previewImage );
4805 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4806 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4807 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4808 QBrush checkerBrush;
4809 checkerBrush.setTexture( pix );
4810 p.fillRect( imageRect, checkerBrush );
4812 if (
mLayer->opacity() < 1.0 )
4814 p.setOpacity(
mLayer->opacity() );
4817 p.drawImage( imageRect.left(), imageRect.top(), image );
4819 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4833 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4835 mPenWidthUnitWidget->setUnits(
4838 mOffsetUnitWidget->setUnits(
4845 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
4846 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
4851 connect( spinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
4854 mLayer->setWidth( spinWidth->value() );
4862 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4863 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4869 spinOffset->setClearValue( 0.0 );
4870 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
4873 mLayer->setOffset( val );
4878 connect( cboCapStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4881 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
4885 connect( cboJoinStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4888 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
4897 mLayer->setOpacity( opacity );
4898 updatePreviewImage();
4911 if ( layer->
layerType() !=
"RasterLine"_L1 )
4935 updatePreviewImage();
4950void QgsRasterLineSymbolLayerWidget::imageSourceChanged(
const QString &text )
4953 updatePreviewImage();
4957void QgsRasterLineSymbolLayerWidget::updatePreviewImage()
4959 bool fitsInCache =
false;
4961 if ( image.isNull() )
4963 mLabelImagePreview->setPixmap( QPixmap() );
4967 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4968 previewImage.fill( Qt::transparent );
4969 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4971 p.begin( &previewImage );
4973 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4974 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4975 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4976 QBrush checkerBrush;
4977 checkerBrush.setTexture( pix );
4978 p.fillRect( imageRect, checkerBrush );
4980 if (
mLayer->opacity() < 1.0 )
4982 p.setOpacity(
mLayer->opacity() );
4985 p.drawImage( imageRect.left(), imageRect.top(), image );
4987 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
5000 modificationExpressionSelector->setMultiLine(
true );
5001 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
5002 modificationExpressionSelector->registerExpressionContextGenerator(
this );
5008 mUnitWidget->setShowMapScaleButton(
false );
5011 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
5013 if ( !mBlockSignals )
5015 mLayer->setUnits( mUnitWidget->unit() );
5025 modificationExpressionSelector->setExpression( mLayer->geometryExpression() );
5026 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData(
static_cast<int>( mLayer->symbolType() ) ) );
5027 mUnitWidget->setUnit( mLayer->units() );
5036void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
5043void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
5046 std::unique_ptr<QgsSymbol> subSymbol( mLayer->subSymbol()->clone() );
5048 mLayer->setSymbolType(
static_cast<Qgis::SymbolType>( cbxGeometryType->currentData().toInt() ) );
5050 switch ( mLayer->symbolType() )
5061 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5063 if (
dynamic_cast<const QgsLineSymbolLayer *
>( subSymbol->symbolLayer( i ) ) )
5064 layers << subSymbol->symbolLayer( i )->clone();
5067 if ( !layers.empty() )
5068 mLayer->setSubSymbol(
new QgsLineSymbol( layers ) );
5077 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5078 layers << subSymbol->symbolLayer( i )->clone();
5079 mLayer->setSubSymbol(
new QgsFillSymbol( layers ) );
5100 mPointCountSpinBox->setShowClearButton(
true );
5101 mPointCountSpinBox->setClearValue( 100 );
5102 mSeedSpinBox->setShowClearButton(
true );
5103 mSeedSpinBox->setClearValue( 0 );
5105 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
5106 connect( mPointCountSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
5107 connect( mDensityAreaSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
5108 connect( mSeedSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
5109 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5112 mLayer->setClipPoints( checked );
5117 mDensityAreaUnitWidget->setUnits(
5126 if ( !layer || layer->
layerType() !=
"RandomMarkerFill"_L1 )
5132 whileBlocking( mPointCountSpinBox )->setValue( mLayer->pointCount() );
5134 whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
5136 bool showDensityBasedCountWidgets =
false;
5137 switch ( mLayer->countMethod() )
5140 showDensityBasedCountWidgets =
true;
5145 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5146 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5147 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5148 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5150 whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData(
static_cast<int>( mLayer->countMethod() ) ) );
5151 whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
5152 mDensityAreaUnitWidget->blockSignals(
true );
5153 mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
5154 mDensityAreaUnitWidget->
setMapUnitScale( mLayer->densityAreaUnitScale() );
5155 mDensityAreaUnitWidget->blockSignals(
false );
5168void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
5170 bool showDensityBasedCountWidgets =
false;
5174 showDensityBasedCountWidgets =
true;
5179 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5180 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5181 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5182 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5186 mLayer->setCountMethod(
static_cast<Qgis::PointCountMethod>( mCountMethodComboBox->currentData().toInt() ) );
5191void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
5195 mLayer->setPointCount( d );
5200void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
5204 mLayer->setDensityArea( d );
5209void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
5213 mLayer->setDensityAreaUnit( mDensityAreaUnitWidget->unit() );
5214 mLayer->setDensityAreaUnitScale( mDensityAreaUnitWidget->getMapUnitScale() );
5219void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
5223 mLayer->setSeed( d );
5238 btnColorRamp->setShowGradientOnly(
true );
5240 btnChangeColor->setAllowOpacity(
true );
5241 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5242 btnChangeColor->setContext( u
"symbology"_s );
5243 btnChangeColor->setShowNoColor(
true );
5244 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
5245 btnChangeColor2->setAllowOpacity(
true );
5246 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5247 btnChangeColor2->setContext( u
"symbology"_s );
5248 btnChangeColor2->setShowNoColor(
true );
5249 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
5251 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
5252 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
5257 mLayer->setColor( color );
5264 mLayer->setColor2( color );
5269 if ( btnColorRamp->isNull() )
5274 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
5279 connect( radioTwoColor, &QAbstractButton::toggled,
this, [
this] {
5282 if ( radioTwoColor->isChecked() )
5285 btnChangeColor->setEnabled(
true );
5286 btnChangeColor2->setEnabled(
true );
5287 btnColorRamp->setEnabled(
false );
5292 btnColorRamp->setEnabled(
true );
5293 btnChangeColor->setEnabled(
false );
5294 btnChangeColor2->setEnabled(
false );
5300 mPenWidthUnitWidget->setUnits(
5303 mOffsetUnitWidget->setUnits(
5310 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5311 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5316 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5319 mLayer->setWidth( spinWidth->value() );
5327 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5328 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5333 spinOffset->setClearValue( 0.0 );
5334 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5337 mLayer->setOffset( val );
5342 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5345 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5349 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5352 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5365 if ( layer->
layerType() !=
"Lineburst"_L1 )
5376 btnChangeColor->blockSignals(
true );
5378 btnChangeColor->blockSignals(
false );
5379 btnChangeColor2->blockSignals(
true );
5380 btnChangeColor2->setColor(
mLayer->color2() );
5381 btnChangeColor2->blockSignals(
false );
5385 radioTwoColor->setChecked(
true );
5386 btnColorRamp->setEnabled(
false );
5390 radioColorRamp->setChecked(
true );
5391 btnChangeColor->setEnabled(
false );
5392 btnChangeColor2->setEnabled(
false );
5396 if (
mLayer->colorRamp() )
5398 btnColorRamp->blockSignals(
true );
5399 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
5400 btnColorRamp->blockSignals(
false );
5437 mPenWidthUnitWidget->setUnits(
5440 mOffsetUnitWidget->setUnits(
5447 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5448 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5453 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5456 mLayer->setWidth( spinWidth->value() );
5464 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5465 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5470 spinOffset->setClearValue( 0.0 );
5471 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5474 mLayer->setOffset( val );
5479 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5482 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5486 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5489 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5504 if ( layer->
layerType() !=
"FilledLine"_L1 )
5516 whileBlocking( mPenWidthUnitWidget )->setUnit( mLayer->widthUnit() );
5519 whileBlocking( mOffsetUnitWidget )->setUnit( mLayer->offsetUnit() );
5520 whileBlocking( mOffsetUnitWidget )->setMapUnitScale( mLayer->offsetMapUnitScale() );
5523 whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
5524 whileBlocking( cboCapStyle )->setPenCapStyle( mLayer->penCapStyle() );
5557 mSpinSkipMultiples->setClearValue( 0, tr(
"Not set" ) );
5558 mSpinLabelOffsetX->setClearValue( 0 );
5559 mSpinLabelOffsetY->setClearValue( 0 );
5560 mSpinAverageAngleLength->setClearValue( 4.0 );
5561 mLabelOffsetUnitWidget->setUnits(
5564 mAverageAngleUnit->setUnits(
5568 connect( mComboQuantity, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5569 if ( mLayer && !mBlockChangesSignal )
5576 if ( mLayer && !mBlockChangesSignal )
5578 mLayer->setTextFormat( mTextFormatButton->textFormat() );
5582 connect( spinInterval, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5583 if ( mLayer && !mBlockChangesSignal )
5585 mLayer->setInterval( spinInterval->value() );
5589 connect( mSpinSkipMultiples, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5590 if ( mLayer && !mBlockChangesSignal )
5592 mLayer->setSkipMultiplesOf( mSpinSkipMultiples->value() );
5596 connect( mCheckRotate, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5597 if ( mLayer && !mBlockChangesSignal )
5599 mLayer->setRotateLabels( checked );
5602 mSpinAverageAngleLength->setEnabled( checked );
5603 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5605 connect( mCheckShowMarker, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5606 if ( mLayer && !mBlockChangesSignal )
5608 mLayer->setShowMarker( checked );
5613 connect( mSpinLabelOffsetX, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5614 if ( mLayer && !mBlockChangesSignal )
5616 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5620 connect( mSpinLabelOffsetY, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5621 if ( mLayer && !mBlockChangesSignal )
5623 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5628 if ( mLayer && !mBlockChangesSignal )
5630 mLayer->setLabelOffsetUnit( mLabelOffsetUnitWidget->unit() );
5631 mLayer->setLabelOffsetMapUnitScale( mLabelOffsetUnitWidget->getMapUnitScale() );
5636 connect( mComboPlacement, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5637 if ( mLayer && !mBlockChangesSignal )
5640 mLayer->setPlacement( placement );
5641 switch ( placement )
5646 mIntervalWidget->show();
5649 mIntervalWidget->hide();
5656 connect( mSpinAverageAngleLength, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5657 if ( mLayer && !mBlockChangesSignal )
5659 mLayer->setAverageAngleLength( mSpinAverageAngleLength->value() );
5664 if ( mLayer && !mBlockChangesSignal )
5666 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
5667 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
5672 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsLinearReferencingSymbolLayerWidget::changeNumberFormat );
5674 mTextFormatButton->registerExpressionContextGenerator(
this );
5682 if ( !layer || layer->
layerType() !=
"LinearReferencing"_L1 )
5686 mLayer = qgis::down_cast<QgsLinearReferencingSymbolLayer *>( layer );
5688 mBlockChangesSignal =
true;
5690 mComboPlacement->setCurrentIndex( mComboPlacement->findData( QVariant::fromValue( mLayer->placement() ) ) );
5691 switch ( mLayer->placement() )
5696 mIntervalWidget->show();
5699 mIntervalWidget->hide();
5703 mComboQuantity->setCurrentIndex( mComboQuantity->findData( QVariant::fromValue( mLayer->labelSource() ) ) );
5705 mTextFormatButton->setTextFormat( mLayer->textFormat() );
5706 spinInterval->setValue( mLayer->interval() );
5707 mSpinSkipMultiples->setValue( mLayer->skipMultiplesOf() );
5708 mCheckRotate->setChecked( mLayer->rotateLabels() );
5709 mCheckShowMarker->setChecked( mLayer->showMarker() );
5710 mSpinLabelOffsetX->setValue( mLayer->labelOffset().x() );
5711 mSpinLabelOffsetY->setValue( mLayer->labelOffset().y() );
5712 mLabelOffsetUnitWidget->setUnit( mLayer->labelOffsetUnit() );
5713 mLabelOffsetUnitWidget->setMapUnitScale( mLayer->labelOffsetMapUnitScale() );
5715 mAverageAngleUnit->setUnit( mLayer->averageAngleUnit() );
5716 mAverageAngleUnit->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
5717 mSpinAverageAngleLength->setValue( mLayer->averageAngleLength() );
5719 mSpinAverageAngleLength->setEnabled( mCheckRotate->isChecked() );
5720 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5727 mBlockChangesSignal =
false;
5738 mTextFormatButton->setMapCanvas(
context.mapCanvas() );
5739 mTextFormatButton->setMessageBar(
context.messageBar() );
5742void QgsLinearReferencingSymbolLayerWidget::changeNumberFormat()
5752 if ( !mBlockChangesSignal )
5762 QgsNumericFormatSelectorDialog dialog(
this );
5763 dialog.setFormat( mLayer->numericFormat() );
5764 dialog.registerExpressionContextGenerator(
this );
5765 if ( dialog.exec() )
5767 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.