50#include <QAbstractButton>
53#include <QButtonGroup>
54#include <QColorDialog>
58#include <QInputDialog>
64#include <QRegularExpression>
65#include <QStandardItemModel>
67#include <QSvgRenderer>
69#include "moc_qgssymbollayerwidget.cpp"
71using namespace Qt::StringLiterals;
75 if (
auto *lExpressionContext = mContext.expressionContext() )
76 return *lExpressionContext;
87 expContext << symbolScope;
100 const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
109 QStringList highlights;
120 << u
"symbol_layer_count"_s
121 << u
"symbol_layer_index"_s
122 << u
"symbol_frame"_s;
127 highlights << u
"zoom_level"_s;
129 if ( expContext.
hasVariable( u
"vector_tile_zoom"_s ) )
131 highlights << u
"vector_tile_zoom"_s;
142 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
145 unitWidget->setMapCanvas( mContext.mapCanvas() );
163void QgsSymbolLayerWidget::createAuxiliaryField()
166 if ( !mVectorLayer->auxiliaryLayer() )
173 if ( !mVectorLayer->auxiliaryLayer() )
176 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
181 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
183 QgsNewAuxiliaryFieldDialog dlg( def, mVectorLayer,
true,
this );
184 if ( dlg.exec() == QDialog::Accepted )
185 def = dlg.propertyDefinition();
189 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
195 property.setActive(
true );
217 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
218 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
222 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
224 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [
this] {
225 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
226 if ( !mCheckAlignDash->isChecked() )
227 mCheckDashCorners->setChecked(
false );
231 mLayer->setAlignDashPattern( mCheckAlignDash->isChecked() );
235 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [
this] {
238 mLayer->setTweakDashPatternOnCorners( mCheckDashCorners->isChecked() );
243 mPenWidthUnitWidget->setUnits(
246 mOffsetUnitWidget->setUnits(
249 mDashPatternUnitWidget->setUnits(
252 mPatternOffsetUnitWidget->setUnits(
255 mTrimDistanceStartUnitWidget->setUnits(
265 mTrimDistanceEndUnitWidget->setUnits(
276 btnChangeColor->setAllowOpacity(
true );
277 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
278 btnChangeColor->setContext( u
"symbology"_s );
280 mColorDDBtn->registerLinkedWidget( btnChangeColor );
285 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
293 spinOffset->setClearValue( 0.0 );
294 spinPatternOffset->setClearValue( 0.0 );
296 mTrimStartDistanceSpin->setClearValue( 0.0 );
297 mTrimDistanceEndSpin->setClearValue( 0.0 );
300 mAssistantPreviewSymbol = std::make_shared<QgsLineSymbol>();
303 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
305 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
307 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
308 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
309 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
310 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
311 connect( spinPatternOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
313 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
317 mLayer->setTrimDistanceStart( value );
324 mLayer->setTrimDistanceStartUnit( mTrimDistanceStartUnitWidget->unit() );
325 mLayer->setTrimDistanceStartMapUnitScale( mTrimDistanceStartUnitWidget->getMapUnitScale() );
328 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
332 mLayer->setTrimDistanceEnd( value );
339 mLayer->setTrimDistanceEndUnit( mTrimDistanceEndUnitWidget->unit() );
340 mLayer->setTrimDistanceEndMapUnitScale( mTrimDistanceEndUnitWidget->getMapUnitScale() );
352void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
354 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
356 mAssistantPreviewSymbol->deleteSymbolLayer( i );
358 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
361 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
367 if ( !layer || layer->
layerType() !=
"SimpleLine"_L1 )
374 mPenWidthUnitWidget->blockSignals(
true );
375 mPenWidthUnitWidget->setUnit(
mLayer->widthUnit() );
377 mPenWidthUnitWidget->blockSignals(
false );
378 mOffsetUnitWidget->blockSignals(
true );
379 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
380 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
381 mOffsetUnitWidget->blockSignals(
false );
382 mDashPatternUnitWidget->blockSignals(
true );
383 mDashPatternUnitWidget->setUnit(
mLayer->customDashPatternUnit() );
384 mDashPatternUnitWidget->setMapUnitScale(
mLayer->customDashPatternMapUnitScale() );
385 mDashPatternUnitWidget->blockSignals(
false );
388 whileBlocking( mPatternOffsetUnitWidget )->setMapUnitScale(
mLayer->dashPatternOffsetMapUnitScale() );
390 whileBlocking( mTrimDistanceStartUnitWidget )->setMapUnitScale(
mLayer->trimDistanceStartMapUnitScale() );
392 whileBlocking( mTrimDistanceEndUnitWidget )->setMapUnitScale(
mLayer->trimDistanceEndMapUnitScale() );
395 spinWidth->blockSignals(
true );
396 spinWidth->setValue(
mLayer->width() );
397 spinWidth->blockSignals(
false );
398 btnChangeColor->blockSignals(
true );
399 btnChangeColor->setColor(
mLayer->color() );
400 btnChangeColor->blockSignals(
false );
401 spinOffset->blockSignals(
true );
402 spinOffset->setValue(
mLayer->offset() );
403 spinOffset->blockSignals(
false );
404 cboPenStyle->blockSignals(
true );
405 cboJoinStyle->blockSignals(
true );
406 cboCapStyle->blockSignals(
true );
407 cboPenStyle->setPenStyle(
mLayer->penStyle() );
408 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
409 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
410 cboPenStyle->blockSignals(
false );
411 cboJoinStyle->blockSignals(
false );
412 cboCapStyle->blockSignals(
false );
418 const bool useCustomDashPattern =
mLayer->useCustomDashPattern();
419 mChangePatternButton->setEnabled( useCustomDashPattern );
420 label_3->setEnabled( !useCustomDashPattern );
421 cboPenStyle->setEnabled( !useCustomDashPattern );
422 mCustomCheckBox->blockSignals(
true );
423 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
424 mCustomCheckBox->blockSignals(
false );
427 const QSize size = mChangePatternButton->minimumSizeHint();
429 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
432 const bool drawInsidePolygon =
mLayer->drawInsidePolygon();
433 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
435 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData(
mLayer->ringFilter() ) );
438 mCheckDashCorners->setEnabled(
mLayer->alignDashPattern() );
454 updateAssistantSymbol();
466 switch (
context.symbolType() )
471 mDrawInsideCheckBox->hide();
472 mRingFilterComboBox->hide();
482void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
489void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
491 mLayer->setColor( color );
495void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
497 mLayer->setPenStyle( cboPenStyle->penStyle() );
498 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
499 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
504void QgsSimpleLineSymbolLayerWidget::offsetChanged()
506 mLayer->setOffset( spinOffset->value() );
511void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
513 mLayer->setDashPatternOffset( spinPatternOffset->value() );
518void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
520 const bool checked = ( state == Qt::Checked );
521 mChangePatternButton->setEnabled( checked );
522 label_3->setEnabled( !checked );
523 cboPenStyle->setEnabled( !checked );
525 mLayer->setUseCustomDashPattern( checked );
529void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
534 QgsDashSpaceWidget *widget =
new QgsDashSpaceWidget(
mLayer->customDashVector(), panel );
536 widget->
setUnit( mDashPatternUnitWidget->unit() );
546 QgsDashSpaceDialog d(
mLayer->customDashVector() );
547 d.setUnit( mDashPatternUnitWidget->unit() );
548 if ( d.exec() == QDialog::Accepted )
550 mLayer->setCustomDashVector( d.dashDotVector() );
556void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
560 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
561 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
567void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
571 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
572 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
577void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
581 mLayer->setCustomDashPatternUnit( mDashPatternUnitWidget->unit() );
582 mLayer->setCustomDashPatternMapUnitScale( mDashPatternUnitWidget->getMapUnitScale() );
588void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
590 const bool checked = ( state == Qt::Checked );
591 mLayer->setDrawInsidePolygon( checked );
595void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
599 mLayer->setDashPatternOffsetUnit( mPatternOffsetUnitWidget->unit() );
600 mLayer->setDashPatternOffsetMapUnitScale( mPatternOffsetUnitWidget->getMapUnitScale() );
612 std::unique_ptr<QgsSimpleLineSymbolLayer> layerCopy(
mLayer->clone() );
617 const QColor color = qApp->palette().color( QPalette::WindowText );
618 layerCopy->setColor( color );
620 layerCopy->setOffset( 0 );
621 layerCopy->setUseCustomDashPattern(
true );
623 QSize currentIconSize;
626 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
628 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
631 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
637 const std::unique_ptr<QgsLineSymbol> previewSymbol = std::make_unique<QgsLineSymbol>(
QgsSymbolLayerList() << layerCopy.release() );
639 mChangePatternButton->setIconSize( currentIconSize );
640 mChangePatternButton->setIcon( icon );
644 const int width =
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
645 const int height =
static_cast<int>( width / 1.61803398875 );
649 QBuffer buffer( &data );
650 pm.save( &buffer,
"PNG", 100 );
651 mChangePatternButton->setToolTip( u
"<img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString( data.toBase64() ) ).arg( width ) );
656 QgsSymbolLayerWidget::resizeEvent( event );
683 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
684 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
685 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
686 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
687 mSizeUnitWidget->setUnits(
690 mOffsetUnitWidget->setUnits(
693 mStrokeWidthUnitWidget->setUnits(
697 btnChangeColorFill->setAllowOpacity(
true );
698 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
699 btnChangeColorFill->setContext( u
"symbology"_s );
700 btnChangeColorFill->setShowNoColor(
true );
701 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
702 btnChangeColorStroke->setAllowOpacity(
true );
703 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
704 btnChangeColorStroke->setContext( u
"symbology"_s );
705 btnChangeColorStroke->setShowNoColor(
true );
706 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
708 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
709 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
711 spinOffsetX->setClearValue( 0.0 );
712 spinOffsetY->setClearValue( 0.0 );
713 spinAngle->setClearValue( 0.0 );
716 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
719 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
721 int size = lstNames->iconSize().width();
723 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
725 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
726 lstNames->setIconSize( QSize( size, size ) );
728 const double markerSize = size * 0.8;
734 lyr->
setColor( QColor( 200, 200, 200 ) );
738 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
739 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
744 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
746 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
749 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
750 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
751 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
752 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
753 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
754 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
762 if ( layer->
layerType() !=
"SimpleMarker"_L1 )
770 for (
int i = 0; i < lstNames->count(); ++i )
772 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
774 lstNames->setCurrentRow( i );
778 btnChangeColorStroke->blockSignals(
true );
779 btnChangeColorStroke->setColor(
mLayer->strokeColor() );
780 btnChangeColorStroke->blockSignals(
false );
781 btnChangeColorFill->blockSignals(
true );
782 btnChangeColorFill->setColor(
mLayer->fillColor() );
784 btnChangeColorFill->blockSignals(
false );
785 spinSize->blockSignals(
true );
786 spinSize->setValue(
mLayer->size() );
787 spinSize->blockSignals(
false );
788 spinAngle->blockSignals(
true );
789 spinAngle->setValue(
mLayer->angle() );
790 spinAngle->blockSignals(
false );
791 mStrokeStyleComboBox->blockSignals(
true );
792 mStrokeStyleComboBox->setPenStyle(
mLayer->strokeStyle() );
793 mStrokeStyleComboBox->blockSignals(
false );
794 mStrokeWidthSpinBox->blockSignals(
true );
795 mStrokeWidthSpinBox->setValue(
mLayer->strokeWidth() );
796 mStrokeWidthSpinBox->blockSignals(
false );
797 cboJoinStyle->blockSignals(
true );
798 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
799 cboJoinStyle->blockSignals(
false );
800 cboCapStyle->blockSignals(
true );
801 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
802 cboCapStyle->blockSignals(
false );
805 spinOffsetX->blockSignals(
true );
806 spinOffsetX->setValue(
mLayer->offset().x() );
807 spinOffsetX->blockSignals(
false );
808 spinOffsetY->blockSignals(
true );
809 spinOffsetY->setValue(
mLayer->offset().y() );
810 spinOffsetY->blockSignals(
false );
812 mSizeUnitWidget->blockSignals(
true );
813 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
814 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
815 mSizeUnitWidget->blockSignals(
false );
816 mOffsetUnitWidget->blockSignals(
true );
817 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
818 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
819 mOffsetUnitWidget->blockSignals(
false );
820 mStrokeWidthUnitWidget->blockSignals(
true );
821 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
822 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
823 mStrokeWidthUnitWidget->blockSignals(
false );
826 mHorizontalAnchorComboBox->blockSignals(
true );
827 mVerticalAnchorComboBox->blockSignals(
true );
828 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
829 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
830 mHorizontalAnchorComboBox->blockSignals(
false );
831 mVerticalAnchorComboBox->blockSignals(
false );
846 updateAssistantSymbol();
854void QgsSimpleMarkerSymbolLayerWidget::setShape()
863 mLayer->setStrokeColor( color );
869 mLayer->setColor( color );
873void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
879void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
881 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
885void QgsSimpleMarkerSymbolLayerWidget::setSize()
887 mLayer->setSize( spinSize->value() );
891void QgsSimpleMarkerSymbolLayerWidget::setAngle()
893 mLayer->setAngle( spinAngle->value() );
897void QgsSimpleMarkerSymbolLayerWidget::setOffset()
899 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
903void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
909 mLayer->setStrokeStyle( mStrokeStyleComboBox->penStyle() );
914void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
918 mLayer->setStrokeWidth( d );
923void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
927 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
928 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
933void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
937 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
938 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
943void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
947 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
948 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
953void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
962void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
971void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
973 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
975 mAssistantPreviewSymbol->deleteSymbolLayer( i );
977 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
980 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
994 mStrokeWidthUnitWidget->setUnits(
997 mOffsetUnitWidget->setUnits(
1001 btnChangeColor->setAllowOpacity(
true );
1002 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
1003 btnChangeColor->setContext( u
"symbology"_s );
1004 btnChangeColor->setShowNoColor(
true );
1005 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
1006 btnChangeStrokeColor->setAllowOpacity(
true );
1007 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
1008 btnChangeStrokeColor->setContext( u
"symbology"_s );
1009 btnChangeStrokeColor->setShowNoColor(
true );
1010 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
1012 spinOffsetX->setClearValue( 0.0 );
1013 spinOffsetY->setClearValue( 0.0 );
1016 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
1018 connect( spinStrokeWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
1019 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1020 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1021 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1022 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1024 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
1025 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
1030 if ( layer->
layerType() !=
"SimpleFill"_L1 )
1037 btnChangeColor->blockSignals(
true );
1039 btnChangeColor->blockSignals(
false );
1040 cboFillStyle->blockSignals(
true );
1041 cboFillStyle->setBrushStyle(
mLayer->brushStyle() );
1042 cboFillStyle->blockSignals(
false );
1043 btnChangeStrokeColor->blockSignals(
true );
1044 btnChangeStrokeColor->setColor(
mLayer->strokeColor() );
1045 btnChangeStrokeColor->blockSignals(
false );
1046 cboStrokeStyle->blockSignals(
true );
1047 cboStrokeStyle->setPenStyle(
mLayer->strokeStyle() );
1048 cboStrokeStyle->blockSignals(
false );
1049 spinStrokeWidth->blockSignals(
true );
1050 spinStrokeWidth->setValue(
mLayer->strokeWidth() );
1051 spinStrokeWidth->blockSignals(
false );
1052 cboJoinStyle->blockSignals(
true );
1053 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
1054 cboJoinStyle->blockSignals(
false );
1055 spinOffsetX->blockSignals(
true );
1056 spinOffsetX->setValue(
mLayer->offset().x() );
1057 spinOffsetX->blockSignals(
false );
1058 spinOffsetY->blockSignals(
true );
1059 spinOffsetY->setValue(
mLayer->offset().y() );
1060 spinOffsetY->blockSignals(
false );
1062 mStrokeWidthUnitWidget->blockSignals(
true );
1063 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
1064 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
1065 mStrokeWidthUnitWidget->blockSignals(
false );
1066 mOffsetUnitWidget->blockSignals(
true );
1067 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1068 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1069 mOffsetUnitWidget->blockSignals(
false );
1087 mLayer->setColor( color );
1093 mLayer->setStrokeColor( color );
1097void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1103void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1105 mLayer->setStrokeWidth( spinStrokeWidth->value() );
1109void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1111 mLayer->setStrokeStyle( cboStrokeStyle->penStyle() );
1112 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
1116void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1118 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1122void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1126 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
1127 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
1132void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1136 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1137 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1161 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1162 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1163 mSizeUnitWidget->setUnits(
1166 mOffsetUnitWidget->setUnits(
1170 spinOffsetX->setClearValue( 0.0 );
1171 spinOffsetY->setClearValue( 0.0 );
1172 spinAngle->setClearValue( 0.0 );
1175 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
1178 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1180 int size = lstNames->iconSize().width();
1181 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1182 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1183 lstNames->setIconSize( QSize( size, size ) );
1185 const double markerSize = size * 0.8;
1191 lyr->
setColor( QColor( 200, 200, 200 ) );
1195 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1196 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
1201 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1203 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1204 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1205 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1206 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1207 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1215 if ( layer->
layerType() !=
"FilledMarker"_L1 )
1223 for (
int i = 0; i < lstNames->count(); ++i )
1225 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1227 lstNames->setCurrentRow( i );
1236 mSizeUnitWidget->blockSignals(
true );
1237 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
1238 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
1239 mSizeUnitWidget->blockSignals(
false );
1240 mOffsetUnitWidget->blockSignals(
true );
1241 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1242 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1243 mOffsetUnitWidget->blockSignals(
false );
1246 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
1247 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
1256 updateAssistantSymbol();
1264void QgsFilledMarkerSymbolLayerWidget::setShape()
1270void QgsFilledMarkerSymbolLayerWidget::setSize()
1272 mLayer->setSize( spinSize->value() );
1276void QgsFilledMarkerSymbolLayerWidget::setAngle()
1278 mLayer->setAngle( spinAngle->value() );
1282void QgsFilledMarkerSymbolLayerWidget::setOffset()
1284 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1288void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1292 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
1293 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
1298void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1302 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1303 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1308void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
1317void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
1326void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1328 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
1330 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1332 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
1335 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1348 connect( mSpinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1349 mOffsetUnitWidget->setUnits(
1353 btnColorRamp->setShowGradientOnly(
true );
1355 btnChangeColor->setAllowOpacity(
true );
1356 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1357 btnChangeColor->setContext( u
"symbology"_s );
1358 btnChangeColor->setShowNoColor(
true );
1359 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1360 btnChangeColor2->setAllowOpacity(
true );
1361 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1362 btnChangeColor2->setContext( u
"symbology"_s );
1363 btnChangeColor2->setShowNoColor(
true );
1364 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1366 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1367 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1369 spinOffsetX->setClearValue( 0.0 );
1370 spinOffsetY->setClearValue( 0.0 );
1371 mSpinAngle->setClearValue( 0.0 );
1379 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1380 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1381 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1382 connect( spinRefPoint1X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1383 connect( spinRefPoint1Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1384 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1385 connect( spinRefPoint2X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1386 connect( spinRefPoint2Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1387 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1392 if ( layer->
layerType() !=
"GradientFill"_L1 )
1399 btnChangeColor->blockSignals(
true );
1401 btnChangeColor->blockSignals(
false );
1402 btnChangeColor2->blockSignals(
true );
1403 btnChangeColor2->setColor(
mLayer->color2() );
1404 btnChangeColor2->blockSignals(
false );
1408 radioTwoColor->setChecked(
true );
1409 btnColorRamp->setEnabled(
false );
1413 radioColorRamp->setChecked(
true );
1414 btnChangeColor->setEnabled(
false );
1415 btnChangeColor2->setEnabled(
false );
1419 if (
mLayer->colorRamp() )
1421 btnColorRamp->blockSignals(
true );
1422 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1423 btnColorRamp->blockSignals(
false );
1426 cboGradientType->blockSignals(
true );
1427 switch (
mLayer->gradientType() )
1430 cboGradientType->setCurrentIndex( 0 );
1433 cboGradientType->setCurrentIndex( 1 );
1436 cboGradientType->setCurrentIndex( 2 );
1439 cboGradientType->blockSignals(
false );
1441 cboCoordinateMode->blockSignals(
true );
1442 switch (
mLayer->coordinateMode() )
1445 cboCoordinateMode->setCurrentIndex( 1 );
1446 checkRefPoint1Centroid->setEnabled(
false );
1447 checkRefPoint2Centroid->setEnabled(
false );
1451 cboCoordinateMode->setCurrentIndex( 0 );
1454 cboCoordinateMode->blockSignals(
false );
1456 cboGradientSpread->blockSignals(
true );
1457 switch (
mLayer->gradientSpread() )
1460 cboGradientSpread->setCurrentIndex( 0 );
1463 cboGradientSpread->setCurrentIndex( 1 );
1466 cboGradientSpread->setCurrentIndex( 2 );
1469 cboGradientSpread->blockSignals(
false );
1471 spinRefPoint1X->blockSignals(
true );
1472 spinRefPoint1X->setValue(
mLayer->referencePoint1().x() );
1473 spinRefPoint1X->blockSignals(
false );
1474 spinRefPoint1Y->blockSignals(
true );
1475 spinRefPoint1Y->setValue(
mLayer->referencePoint1().y() );
1476 spinRefPoint1Y->blockSignals(
false );
1477 checkRefPoint1Centroid->blockSignals(
true );
1478 checkRefPoint1Centroid->setChecked(
mLayer->referencePoint1IsCentroid() );
1479 if (
mLayer->referencePoint1IsCentroid() )
1481 spinRefPoint1X->setEnabled(
false );
1482 spinRefPoint1Y->setEnabled(
false );
1484 checkRefPoint1Centroid->blockSignals(
false );
1485 spinRefPoint2X->blockSignals(
true );
1486 spinRefPoint2X->setValue(
mLayer->referencePoint2().x() );
1487 spinRefPoint2X->blockSignals(
false );
1488 spinRefPoint2Y->blockSignals(
true );
1489 spinRefPoint2Y->setValue(
mLayer->referencePoint2().y() );
1490 spinRefPoint2Y->blockSignals(
false );
1491 checkRefPoint2Centroid->blockSignals(
true );
1492 checkRefPoint2Centroid->setChecked(
mLayer->referencePoint2IsCentroid() );
1493 if (
mLayer->referencePoint2IsCentroid() )
1495 spinRefPoint2X->setEnabled(
false );
1496 spinRefPoint2Y->setEnabled(
false );
1498 checkRefPoint2Centroid->blockSignals(
false );
1500 spinOffsetX->blockSignals(
true );
1501 spinOffsetX->setValue(
mLayer->offset().x() );
1502 spinOffsetX->blockSignals(
false );
1503 spinOffsetY->blockSignals(
true );
1504 spinOffsetY->setValue(
mLayer->offset().y() );
1505 spinOffsetY->blockSignals(
false );
1506 mSpinAngle->blockSignals(
true );
1507 mSpinAngle->setValue(
mLayer->angle() );
1508 mSpinAngle->blockSignals(
false );
1510 mOffsetUnitWidget->blockSignals(
true );
1511 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1512 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1513 mOffsetUnitWidget->blockSignals(
false );
1537 mLayer->setColor( color );
1543 mLayer->setColor2( color );
1547void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1549 if ( radioTwoColor->isChecked() )
1562 if ( btnColorRamp->isNull() )
1565 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
1576 spinRefPoint1X->setValue( 0.5 );
1577 spinRefPoint1Y->setValue( 0 );
1578 spinRefPoint2X->setValue( 0.5 );
1579 spinRefPoint2Y->setValue( 1 );
1584 spinRefPoint1X->setValue( 0 );
1585 spinRefPoint1Y->setValue( 0 );
1586 spinRefPoint2X->setValue( 1 );
1587 spinRefPoint2Y->setValue( 1 );
1591 spinRefPoint1X->setValue( 0.5 );
1592 spinRefPoint1Y->setValue( 0.5 );
1593 spinRefPoint2X->setValue( 1 );
1594 spinRefPoint2Y->setValue( 1 );
1608 checkRefPoint1Centroid->setEnabled(
true );
1609 checkRefPoint2Centroid->setEnabled(
true );
1615 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1616 checkRefPoint1Centroid->setEnabled(
false );
1617 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1618 checkRefPoint2Centroid->setEnabled(
false );
1643void QgsGradientFillSymbolLayerWidget::offsetChanged()
1645 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1649void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1651 mLayer->setReferencePoint1( QPointF( spinRefPoint1X->value(), spinRefPoint1Y->value() ) );
1652 mLayer->setReferencePoint1IsCentroid( checkRefPoint1Centroid->isChecked() );
1653 mLayer->setReferencePoint2( QPointF( spinRefPoint2X->value(), spinRefPoint2Y->value() ) );
1654 mLayer->setReferencePoint2IsCentroid( checkRefPoint2Centroid->isChecked() );
1658void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1660 mLayer->setAngle( value );
1664void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1668 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1669 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1682 connect( mSpinBlurRadius, qOverload<int>( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1683 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1685 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1687 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1688 mDistanceUnitWidget->setUnits(
1691 mOffsetUnitWidget->setUnits(
1695 QButtonGroup *group1 =
new QButtonGroup(
this );
1696 group1->addButton( radioColorRamp );
1697 group1->addButton( radioTwoColor );
1698 QButtonGroup *group2 =
new QButtonGroup(
this );
1699 group2->addButton( mRadioUseMaxDistance );
1700 group2->addButton( mRadioUseWholeShape );
1701 btnChangeColor->setAllowOpacity(
true );
1702 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1703 btnChangeColor->setContext( u
"symbology"_s );
1704 btnChangeColor->setShowNoColor(
true );
1705 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1706 btnChangeColor2->setAllowOpacity(
true );
1707 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1708 btnChangeColor2->setContext( u
"symbology"_s );
1709 btnChangeColor2->setShowNoColor(
true );
1710 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1712 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1713 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1715 spinOffsetX->setClearValue( 0.0 );
1716 spinOffsetY->setClearValue( 0.0 );
1717 mSpinMaxDistance->setClearValue( 5.0 );
1719 btnColorRamp->setShowGradientOnly(
true );
1725 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1726 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1727 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1729 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1730 connect( mSpinBlurRadius,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1735 if ( layer->
layerType() !=
"ShapeburstFill"_L1 )
1742 btnChangeColor->blockSignals(
true );
1744 btnChangeColor->blockSignals(
false );
1745 btnChangeColor2->blockSignals(
true );
1746 btnChangeColor2->setColor(
mLayer->color2() );
1747 btnChangeColor2->blockSignals(
false );
1751 radioTwoColor->setChecked(
true );
1752 btnColorRamp->setEnabled(
false );
1756 radioColorRamp->setChecked(
true );
1757 btnChangeColor->setEnabled(
false );
1758 btnChangeColor2->setEnabled(
false );
1761 mSpinBlurRadius->blockSignals(
true );
1762 mBlurSlider->blockSignals(
true );
1763 mSpinBlurRadius->setValue(
mLayer->blurRadius() );
1764 mBlurSlider->setValue(
mLayer->blurRadius() );
1765 mSpinBlurRadius->blockSignals(
false );
1766 mBlurSlider->blockSignals(
false );
1768 mSpinMaxDistance->blockSignals(
true );
1769 mSpinMaxDistance->setValue(
mLayer->maxDistance() );
1770 mSpinMaxDistance->blockSignals(
false );
1772 mRadioUseWholeShape->blockSignals(
true );
1773 mRadioUseMaxDistance->blockSignals(
true );
1774 if (
mLayer->useWholeShape() )
1776 mRadioUseWholeShape->setChecked(
true );
1777 mSpinMaxDistance->setEnabled(
false );
1778 mDistanceUnitWidget->setEnabled(
false );
1782 mRadioUseMaxDistance->setChecked(
true );
1783 mSpinMaxDistance->setEnabled(
true );
1784 mDistanceUnitWidget->setEnabled(
true );
1786 mRadioUseWholeShape->blockSignals(
false );
1787 mRadioUseMaxDistance->blockSignals(
false );
1789 mDistanceUnitWidget->blockSignals(
true );
1790 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
1791 mDistanceUnitWidget->setMapUnitScale(
mLayer->distanceMapUnitScale() );
1792 mDistanceUnitWidget->blockSignals(
false );
1794 mIgnoreRingsCheckBox->blockSignals(
true );
1795 mIgnoreRingsCheckBox->setCheckState(
mLayer->ignoreRings() ? Qt::Checked : Qt::Unchecked );
1796 mIgnoreRingsCheckBox->blockSignals(
false );
1799 if (
mLayer->colorRamp() )
1801 btnColorRamp->blockSignals(
true );
1802 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1803 btnColorRamp->blockSignals(
false );
1806 spinOffsetX->blockSignals(
true );
1807 spinOffsetX->setValue(
mLayer->offset().x() );
1808 spinOffsetX->blockSignals(
false );
1809 spinOffsetY->blockSignals(
true );
1810 spinOffsetY->setValue(
mLayer->offset().y() );
1811 spinOffsetY->blockSignals(
false );
1812 mOffsetUnitWidget->blockSignals(
true );
1813 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1814 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1815 mOffsetUnitWidget->blockSignals(
false );
1835 mLayer->setColor( color );
1844 mLayer->setColor2( color );
1849void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1856 if ( radioTwoColor->isChecked() )
1867void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1871 mLayer->setBlurRadius( value );
1876void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1880 mLayer->setMaxDistance( value );
1885void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1889 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
1890 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
1895void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1899 mLayer->setUseWholeShape( value );
1900 mDistanceUnitWidget->setEnabled( !value );
1905void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1907 QgsColorRamp *ramp = btnColorRamp->colorRamp();
1911 mLayer->setColorRamp( ramp );
1915void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1919 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1924void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1928 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1929 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1935void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1937 const bool checked = ( state == Qt::Checked );
1938 mLayer->setIgnoreRings( checked );
1946 , mSymbolType( symbolType )
1953 connect( mOffsetAlongLineUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed );
1959 mIntervalUnitWidget->setUnits( units );
1960 mOffsetUnitWidget->setUnits( units );
1962 mAverageAngleUnit->setUnits( units );
1963 mIntervalUnitWidget->setUnits( units );
1964 mBlankSegmentsUnitWidget->setUnits( units );
1971 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1979 spinOffset->setClearValue( 0.0 );
1980 mSpinOffsetAlongLine->setClearValue( 0.0 );
1981 mHashRotationSpinBox->setClearValue( 0 );
1982 mSpinAverageAngleLength->setClearValue( 4.0 );
1983 mTrimStartDistanceSpin->setClearValue( 0.0 );
1984 mTrimDistanceEndSpin->setClearValue( 0.0 );
1988 connect( mSpinHashLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashLength );
1989 connect( mHashRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashAngle );
1990 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsTemplatedLineSymbolLayerWidget::setRotate );
1991 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setOffset );
1992 connect( mSpinAverageAngleLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setAverageAngle );
1993 connect( mEditBlankSegmentsBtn, &QToolButton::toggled,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolEditBlankSegments );
1995 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1996 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1997 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1998 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
1999 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2000 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2001 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2003 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [
this] {
2006 mLayer->setPlaceOnEveryPart( mCheckPlaceOnEveryPart->isChecked() );
2011 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
2015 mLayer->setTrimDistanceStart( value );
2022 mLayer->setTrimDistanceStartUnit( mTrimDistanceStartUnitWidget->unit() );
2023 mLayer->setTrimDistanceStartMapUnitScale( mTrimDistanceStartUnitWidget->getMapUnitScale() );
2026 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
2030 mLayer->setTrimDistanceEnd( value );
2037 mLayer->setTrimDistanceEndUnit( mTrimDistanceEndUnitWidget->unit() );
2038 mLayer->setTrimDistanceEndMapUnitScale( mTrimDistanceEndUnitWidget->getMapUnitScale() );
2042 switch ( mSymbolType )
2047 mHashLengthUnitWidget->setUnits(
2050 mPlacementLabel->setText( tr(
"Hash placement" ) );
2051 chkRotateMarker->setText( tr(
"Rotate hash to follow line direction" ) );
2052 mSpinOffsetAlongLine->setToolTip( tr(
"Offset hashes in line direction if positive or in opposite line direction if negative" ) );
2053 mHashLengthLabel->setVisible(
true );
2054 mSpinHashLength->setVisible(
true );
2055 mHashLengthUnitWidget->setVisible(
true );
2056 mHashLengthDDBtn->setVisible(
true );
2057 mHashRotationLabel->setVisible(
true );
2058 mHashRotationSpinBox->setVisible(
true );
2059 mHashRotationDDBtn->setVisible(
true );
2064 mPlacementLabel->setText( tr(
"Marker placement" ) );
2065 chkRotateMarker->setText( tr(
"Rotate marker to follow line direction" ) );
2066 mSpinOffsetAlongLine->setToolTip( tr(
"Offset markers in line direction if positive or in opposite line direction if negative" ) );
2067 mHashLengthLabel->setVisible(
false );
2068 mSpinHashLength->setVisible(
false );
2069 mHashLengthUnitWidget->setVisible(
false );
2070 mHashLengthDDBtn->setVisible(
false );
2071 mHashRotationLabel->setVisible(
false );
2072 mHashRotationSpinBox->setVisible(
false );
2073 mHashRotationDDBtn->setVisible(
false );
2079 if (
event->type() == QEvent::Show )
2083 updateBlankSegmentsWidget();
2086 return QgsSymbolLayerWidget::event(
event );
2091 switch ( mSymbolType )
2094 if ( layer->
layerType() !=
"HashLine"_L1 )
2099 if ( layer->
layerType() !=
"MarkerLine"_L1 )
2107 spinInterval->blockSignals(
true );
2108 spinInterval->setValue( mLayer->interval() );
2109 spinInterval->blockSignals(
false );
2110 mSpinOffsetAlongLine->blockSignals(
true );
2111 mSpinOffsetAlongLine->setValue( mLayer->offsetAlongLine() );
2112 mSpinOffsetAlongLine->blockSignals(
false );
2114 chkRotateMarker->blockSignals(
true );
2115 chkRotateMarker->setChecked( mLayer->rotateSymbols() );
2116 chkRotateMarker->blockSignals(
false );
2117 spinOffset->blockSignals(
true );
2118 spinOffset->setValue( mLayer->offset() );
2119 spinOffset->blockSignals(
false );
2121 whileBlocking( mTrimStartDistanceSpin )->setValue( mLayer->trimDistanceStart() );
2122 whileBlocking( mTrimDistanceEndSpin )->setValue( mLayer->trimDistanceEnd() );
2131 whileBlocking( mCheckPlaceOnEveryPart )->setChecked( mLayer->placeOnEveryPart() );
2134 mIntervalUnitWidget->blockSignals(
true );
2135 mIntervalUnitWidget->setUnit( mLayer->intervalUnit() );
2136 mIntervalUnitWidget->
setMapUnitScale( mLayer->intervalMapUnitScale() );
2137 mIntervalUnitWidget->blockSignals(
false );
2138 mOffsetUnitWidget->blockSignals(
true );
2139 mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2140 mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2141 mOffsetUnitWidget->blockSignals(
false );
2142 mOffsetAlongLineUnitWidget->blockSignals(
true );
2143 mOffsetAlongLineUnitWidget->setUnit( mLayer->offsetAlongLineUnit() );
2144 mOffsetAlongLineUnitWidget->setMapUnitScale( mLayer->offsetAlongLineMapUnitScale() );
2145 mOffsetAlongLineUnitWidget->blockSignals(
false );
2146 whileBlocking( mAverageAngleUnit )->setUnit( mLayer->averageAngleUnit() );
2147 whileBlocking( mAverageAngleUnit )->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
2148 whileBlocking( mSpinAverageAngleLength )->setValue( mLayer->averageAngleLength() );
2149 whileBlocking( mBlankSegmentsUnitWidget )->setUnit( mLayer->blankSegmentsUnit() );
2150 whileBlocking( mTrimDistanceStartUnitWidget )->setUnit( mLayer->trimDistanceStartUnit() );
2151 whileBlocking( mTrimDistanceStartUnitWidget )->setMapUnitScale( mLayer->trimDistanceStartMapUnitScale() );
2152 whileBlocking( mTrimDistanceEndUnitWidget )->setUnit( mLayer->trimDistanceEndUnit() );
2153 whileBlocking( mTrimDistanceEndUnitWidget )->setMapUnitScale( mLayer->trimDistanceEndMapUnitScale() );
2155 switch ( mSymbolType )
2173 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
2195 updateBlankSegmentsWidget();
2207 switch (
context.symbolType() )
2212 mRingFilterComboBox->hide();
2213 mRingsLabel->hide();
2224 mLayer->setInterval( val );
2230 mLayer->setOffsetAlongLine( val );
2234void QgsTemplatedLineSymbolLayerWidget::setHashLength(
double val )
2236 switch ( mSymbolType )
2251void QgsTemplatedLineSymbolLayerWidget::setHashAngle(
double val )
2256 switch ( mSymbolType )
2260 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2271void QgsTemplatedLineSymbolLayerWidget::setRotate()
2273 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2274 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2276 mLayer->setRotateSymbols( chkRotateMarker->isChecked() );
2280void QgsTemplatedLineSymbolLayerWidget::setOffset()
2282 mLayer->setOffset( spinOffset->value() );
2286void QgsTemplatedLineSymbolLayerWidget::setPlacement()
2288 const bool interval = mCheckInterval->isChecked();
2289 spinInterval->setEnabled( interval );
2290 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2291 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2292 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2293 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2294 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2297 if ( mCheckInterval->isChecked() )
2299 if ( mCheckVertex->isChecked() )
2301 if ( mCheckVertexLast->isChecked() )
2303 if ( mCheckVertexFirst->isChecked() )
2305 if ( mCheckCurvePoint->isChecked() )
2307 if ( mCheckSegmentCentralPoint->isChecked() )
2309 if ( mCheckCentralPoint->isChecked() )
2311 mLayer->setPlacements( placements );
2316void QgsTemplatedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2320 mLayer->setIntervalUnit( mIntervalUnitWidget->unit() );
2321 mLayer->setIntervalMapUnitScale( mIntervalUnitWidget->getMapUnitScale() );
2326void QgsTemplatedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2330 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2331 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2336void QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2340 mLayer->setOffsetAlongLineUnit( mOffsetAlongLineUnitWidget->unit() );
2341 mLayer->setOffsetAlongLineMapUnitScale( mOffsetAlongLineUnitWidget->getMapUnitScale() );
2346void QgsTemplatedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2351 switch ( mSymbolType )
2355 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2367void QgsTemplatedLineSymbolLayerWidget::averageAngleUnitChanged()
2371 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
2372 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
2377void QgsTemplatedLineSymbolLayerWidget::blankSegmentsUnitChanged()
2381 mLayer->setBlankSegmentsUnit( mBlankSegmentsUnitWidget->unit() );
2386void QgsTemplatedLineSymbolLayerWidget::setAverageAngle(
double val )
2390 mLayer->setAverageAngleLength( val );
2395void QgsTemplatedLineSymbolLayerWidget::toggleMapToolEditBlankSegments(
bool toggled )
2397 if ( mMapToolEditBlankSegments )
2400 mMapToolEditBlankSegments.reset();
2405 switch ( mSymbolType )
2420void QgsTemplatedLineSymbolLayerWidget::updateBlankSegmentsWidget()
2423 switch ( mSymbolType )
2426 tooltip = tr(
"Tool to create blank segments where hashed lines won't be displayed" );
2430 tooltip = tr(
"Tool to create blank segments where marker lines won't be displayed" );
2437 mEditBlankSegmentsBtn->setEnabled(
false );
2438 tooltip += u
"<br/><br/>"_s + tr(
"This tool is disabled because map canvas interaction is only possible from Layer Styling panel, Layer properties dialog doesn't allow blank segments creation." );
2440 else if ( blankSegmentsFieldIndex() < 0 )
2442 mEditBlankSegmentsBtn->setEnabled(
false );
2443 tooltip += u
"<br/><br/>"_s + tr(
"This tool is disabled because no valid field property has been set" );
2447 mEditBlankSegmentsBtn->setEnabled(
false );
2448 tooltip += u
"<br/><br/>"_s + tr(
"This tool is disabled because field property is not editable" );
2452 mEditBlankSegmentsBtn->setEnabled(
true );
2455 mEditBlankSegmentsBtn->setToolTip( tooltip );
2458int QgsTemplatedLineSymbolLayerWidget::blankSegmentsFieldIndex()
const
2496 mSvgSelectorWidget->setAllowParameters(
true );
2497 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2498 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( u
"/UI/lastSVGMarkerDir"_s );
2499 mSvgSelectorWidget->initParametersModel(
this, vl );
2503 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2504 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2508 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2509 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2510 mSizeUnitWidget->setUnits(
2513 mStrokeWidthUnitWidget->setUnits(
2516 mOffsetUnitWidget->setUnits(
2519 mChangeColorButton->setAllowOpacity(
true );
2520 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2521 mChangeColorButton->setContext( u
"symbology"_s );
2522 mChangeStrokeColorButton->setAllowOpacity(
true );
2523 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2524 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2526 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2527 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2529 spinOffsetX->setClearValue( 0.0 );
2530 spinOffsetY->setClearValue( 0.0 );
2531 spinAngle->setClearValue( 0.0 );
2533 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2534 connect( spinHeight,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2536 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2537 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2538 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2545 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
2549 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2550 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2557#include <QAbstractListModel>
2558#include <QPixmapCache>
2571 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2572 QColor defaultFill, defaultStroke;
2573 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2574 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2578 hasDefaultFillColor,
2580 hasFillOpacityParam,
2581 hasDefaultFillOpacity,
2584 hasDefaultStrokeColor,
2586 hasStrokeWidthParam,
2587 hasDefaultStrokeWidth,
2589 hasStrokeOpacityParam,
2590 hasDefaultStrokeOpacity,
2591 defaultStrokeOpacity
2593 mChangeColorButton->setEnabled( hasFillParam );
2594 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2595 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2596 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2597 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2602 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2603 if ( hasDefaultFillColor && !skipDefaultColors )
2607 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2608 mChangeColorButton->setColor( fill );
2610 if ( hasStrokeParam )
2613 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2614 if ( hasDefaultStrokeColor && !skipDefaultColors )
2616 stroke = defaultStroke;
2618 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2619 mChangeStrokeColorButton->setColor( stroke );
2622 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2624 mStrokeWidthSpinBox->blockSignals(
true );
2625 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2626 mStrokeWidthSpinBox->blockSignals(
false );
2629 spinHeight->blockSignals(
true );
2630 if ( preservedAspectRatio )
2639 spinHeight->blockSignals(
false );
2640 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2643void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2645 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
2647 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2649 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
2652 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2663 if ( layer->
layerType() !=
"SvgMarker"_L1 )
2670 mSvgSelectorWidget->setSvgPath(
mLayer->path() );
2671 mSvgSelectorWidget->setSvgParameters(
mLayer->parameters() );
2673 spinWidth->blockSignals(
true );
2674 spinWidth->setValue(
mLayer->size() );
2675 spinWidth->blockSignals(
false );
2676 spinAngle->blockSignals(
true );
2677 spinAngle->setValue(
mLayer->angle() );
2678 spinAngle->blockSignals(
false );
2681 spinOffsetX->blockSignals(
true );
2682 spinOffsetX->setValue(
mLayer->offset().x() );
2683 spinOffsetX->blockSignals(
false );
2684 spinOffsetY->blockSignals(
true );
2685 spinOffsetY->setValue(
mLayer->offset().y() );
2686 spinOffsetY->blockSignals(
false );
2688 mSizeUnitWidget->blockSignals(
true );
2689 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
2691 mSizeUnitWidget->blockSignals(
false );
2692 mStrokeWidthUnitWidget->blockSignals(
true );
2693 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
2694 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
2695 mStrokeWidthUnitWidget->blockSignals(
false );
2696 mOffsetUnitWidget->blockSignals(
true );
2697 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
2698 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
2699 mOffsetUnitWidget->blockSignals(
false );
2702 mHorizontalAnchorComboBox->blockSignals(
true );
2703 mVerticalAnchorComboBox->blockSignals(
true );
2704 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
2705 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
2706 mHorizontalAnchorComboBox->blockSignals(
false );
2707 mVerticalAnchorComboBox->blockSignals(
false );
2723 updateAssistantSymbol();
2734 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2740 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2748 mLayer->setParameters( parameters );
2749 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2755void QgsSvgMarkerSymbolLayerWidget::setWidth()
2758 double fixedAspectRatio = 0.0;
2759 spinHeight->blockSignals(
true );
2760 if ( defaultAspectRatio <= 0.0 )
2762 spinHeight->setValue( spinWidth->value() );
2764 else if ( mLockAspectRatio->locked() )
2766 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2770 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2772 spinHeight->blockSignals(
false );
2773 mLayer->setSize( spinWidth->value() );
2774 mLayer->setFixedAspectRatio( fixedAspectRatio );
2778void QgsSvgMarkerSymbolLayerWidget::setHeight()
2780 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2781 double fixedAspectRatio = 0.0;
2782 spinWidth->blockSignals(
true );
2783 if ( defaultAspectRatio <= 0.0 )
2785 spinWidth->setValue( spinHeight->value() );
2787 else if ( mLockAspectRatio->locked() )
2789 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2793 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2795 spinWidth->blockSignals(
false );
2796 mLayer->setSize( spinWidth->value() );
2797 mLayer->setFixedAspectRatio( fixedAspectRatio );
2801void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2804 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2805 if ( defaultAspectRatio <= 0.0 )
2811 mLayer->setFixedAspectRatio( 0.0 );
2816 mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
2821void QgsSvgMarkerSymbolLayerWidget::setAngle()
2823 mLayer->setAngle( spinAngle->value() );
2827void QgsSvgMarkerSymbolLayerWidget::setOffset()
2829 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2833void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2840void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2847 mLayer->setFillColor( color );
2851void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2858 mLayer->setStrokeColor( color );
2862void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2866 mLayer->setStrokeWidth( d );
2871void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2875 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
2876 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
2881void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2885 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
2886 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
2891void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2895 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2896 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2901void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
2910void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
2927 mSvgSelectorWidget->setAllowParameters(
true );
2928 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2930 connect( mTextureWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2932 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2934 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2935 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2938 mTextureWidthUnitWidget->setUnits(
2941 mSvgStrokeWidthUnitWidget->setUnits(
2945 mRotationSpinBox->setClearValue( 0.0 );
2947 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2948 mChangeColorButton->setContext( u
"symbology"_s );
2949 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2950 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2952 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2953 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2966 if ( layer->
layerType() !=
"SVGFill"_L1 )
2974 const double width =
mLayer->patternWidth();
2975 mTextureWidthSpinBox->blockSignals(
true );
2976 mTextureWidthSpinBox->setValue( width );
2977 mTextureWidthSpinBox->blockSignals(
false );
2978 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource(
mLayer->svgFilePath() );
2979 mRotationSpinBox->blockSignals(
true );
2980 mRotationSpinBox->setValue(
mLayer->angle() );
2981 mRotationSpinBox->blockSignals(
false );
2982 mTextureWidthUnitWidget->blockSignals(
true );
2983 mTextureWidthUnitWidget->setUnit(
mLayer->patternWidthUnit() );
2984 mTextureWidthUnitWidget->setMapUnitScale(
mLayer->patternWidthMapUnitScale() );
2985 mTextureWidthUnitWidget->blockSignals(
false );
2986 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2987 mSvgStrokeWidthUnitWidget->setUnit(
mLayer->svgStrokeWidthUnit() );
2988 mSvgStrokeWidthUnitWidget->setMapUnitScale(
mLayer->svgStrokeWidthMapUnitScale() );
2989 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2990 mChangeColorButton->blockSignals(
true );
2991 mChangeColorButton->setColor(
mLayer->svgFillColor() );
2992 mChangeColorButton->blockSignals(
false );
2993 mChangeStrokeColorButton->blockSignals(
true );
2994 mChangeStrokeColorButton->setColor(
mLayer->svgStrokeColor() );
2995 mChangeStrokeColorButton->blockSignals(
false );
2996 mStrokeWidthSpinBox->blockSignals(
true );
2997 mStrokeWidthSpinBox->setValue(
mLayer->svgStrokeWidth() );
2998 mStrokeWidthSpinBox->blockSignals(
false );
3019 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
3022void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
3031void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
3038 mLayer->setSvgFilePath( text );
3043void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
3045 mLayer->setSvgFilePath( name );
3046 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
3052void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
3054 mLayer->setParameters( parameters );
3055 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
3062void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
3074 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
3075 QColor defaultFill, defaultStroke;
3076 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
3077 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
3079 mSvgSelectorWidget->sourceLineEdit()->source(),
3081 hasDefaultFillColor,
3083 hasFillOpacityParam,
3084 hasDefaultFillOpacity,
3087 hasDefaultStrokeColor,
3089 hasStrokeWidthParam,
3090 hasDefaultStrokeWidth,
3092 hasStrokeOpacityParam,
3093 hasDefaultStrokeOpacity,
3094 defaultStrokeOpacity
3098 QColor fill = mChangeColorButton->color();
3099 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
3100 if ( hasDefaultFillColor )
3104 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
3105 mChangeColorButton->setColor( fill );
3107 mChangeColorButton->setEnabled( hasFillParam );
3108 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
3111 QColor stroke = mChangeStrokeColorButton->color();
3112 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
3113 if ( hasDefaultStrokeColor )
3115 stroke = defaultStroke;
3117 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
3118 mChangeStrokeColorButton->setColor( stroke );
3120 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
3121 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
3122 if ( hasDefaultStrokeWidth && resetValues )
3124 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
3126 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
3129void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
3136 mLayer->setSvgFillColor( color );
3140void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
3147 mLayer->setSvgStrokeColor( color );
3151void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3155 mLayer->setSvgStrokeWidth( d );
3160void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
3164 mLayer->setPatternWidthUnit( mTextureWidthUnitWidget->unit() );
3165 mLayer->setPatternWidthMapUnitScale( mTextureWidthUnitWidget->getMapUnitScale() );
3170void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3174 mLayer->setSvgStrokeWidthUnit( mSvgStrokeWidthUnitWidget->unit() );
3175 mLayer->setSvgStrokeWidthMapUnitScale( mSvgStrokeWidthUnitWidget->getMapUnitScale() );
3186 connect( mAngleSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3187 connect( mDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3188 connect( mOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3191 mDistanceUnitWidget->setUnits(
3194 mOffsetUnitWidget->setUnits(
3204 mOffsetSpinBox->setClearValue( 0 );
3205 mAngleSpinBox->setClearValue( 0 );
3209 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3220 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3231 if ( layer->
layerType() !=
"LinePatternFill"_L1 )
3245 mDistanceUnitWidget->blockSignals(
true );
3246 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
3248 mDistanceUnitWidget->blockSignals(
false );
3249 mOffsetUnitWidget->blockSignals(
true );
3250 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3251 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3252 mOffsetUnitWidget->blockSignals(
false );
3254 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3256 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3270void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3279void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3283 mLayer->setDistance( d );
3288void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3297void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3301 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
3302 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
3307void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3311 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3312 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3323 connect( mHorizontalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3324 connect( mVerticalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3325 connect( mHorizontalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3326 connect( mVerticalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3327 connect( mHorizontalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3328 connect( mVerticalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3329 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3330 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3331 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3332 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3333 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3334 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3335 mHorizontalDistanceUnitWidget->setUnits(
3338 mVerticalDistanceUnitWidget->setUnits(
3341 mHorizontalDisplacementUnitWidget->setUnits(
3351 mVerticalDisplacementUnitWidget->setUnits(
3361 mHorizontalOffsetUnitWidget->setUnits(
3371 mVerticalOffsetUnitWidget->setUnits(
3386 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3396 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3404 mSeedSpinBox->setShowClearButton(
true );
3405 mSeedSpinBox->setClearValue( 0 );
3406 mRandomXSpinBox->setClearValue( 0 );
3407 mRandomYSpinBox->setClearValue( 0 );
3409 mRandomXOffsetUnitWidget->setUnits(
3419 mRandomYOffsetUnitWidget->setUnits(
3429 connect( mRandomXSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3432 mLayer->setMaximumRandomDeviationX( d );
3436 connect( mRandomYSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3439 mLayer->setMaximumRandomDeviationY( d );
3446 mLayer->setRandomDeviationXUnit( mRandomXOffsetUnitWidget->unit() );
3447 mLayer->setRandomDeviationXMapUnitScale( mRandomXOffsetUnitWidget->getMapUnitScale() );
3454 mLayer->setRandomDeviationYUnit( mRandomYOffsetUnitWidget->unit() );
3455 mLayer->setRandomDeviationYMapUnitScale( mRandomYOffsetUnitWidget->getMapUnitScale() );
3459 connect( mSeedSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [
this](
int v ) {
3467 mAngleSpinBox->setShowClearButton(
true );
3468 mAngleSpinBox->setClearValue( 0 );
3469 connect( mAngleSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3480 if ( !layer || layer->
layerType() !=
"PointPatternFill"_L1 )
3494 mHorizontalDistanceUnitWidget->blockSignals(
true );
3495 mHorizontalDistanceUnitWidget->setUnit(
mLayer->distanceXUnit() );
3497 mHorizontalDistanceUnitWidget->blockSignals(
false );
3498 mVerticalDistanceUnitWidget->blockSignals(
true );
3499 mVerticalDistanceUnitWidget->setUnit(
mLayer->distanceYUnit() );
3500 mVerticalDistanceUnitWidget->setMapUnitScale(
mLayer->distanceYMapUnitScale() );
3501 mVerticalDistanceUnitWidget->blockSignals(
false );
3502 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3503 mHorizontalDisplacementUnitWidget->setUnit(
mLayer->displacementXUnit() );
3504 mHorizontalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementXMapUnitScale() );
3505 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3506 mVerticalDisplacementUnitWidget->blockSignals(
true );
3507 mVerticalDisplacementUnitWidget->setUnit(
mLayer->displacementYUnit() );
3508 mVerticalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementYMapUnitScale() );
3509 mVerticalDisplacementUnitWidget->blockSignals(
false );
3510 mHorizontalOffsetUnitWidget->blockSignals(
true );
3511 mHorizontalOffsetUnitWidget->setUnit(
mLayer->offsetXUnit() );
3512 mHorizontalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetXMapUnitScale() );
3513 mHorizontalOffsetUnitWidget->blockSignals(
false );
3514 mVerticalOffsetUnitWidget->blockSignals(
true );
3515 mVerticalOffsetUnitWidget->setUnit(
mLayer->offsetYUnit() );
3516 mVerticalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetYMapUnitScale() );
3517 mVerticalOffsetUnitWidget->blockSignals(
false );
3519 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3520 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3525 whileBlocking( mRandomXOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationXMapUnitScale() );
3527 whileBlocking( mRandomYOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationYMapUnitScale() );
3549void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3558void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3562 mLayer->setDistanceY( d );
3567void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3571 mLayer->setDisplacementX( d );
3576void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3580 mLayer->setDisplacementY( d );
3585void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3594void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3603void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3607 mLayer->setDistanceXUnit( mHorizontalDistanceUnitWidget->unit() );
3608 mLayer->setDistanceXMapUnitScale( mHorizontalDistanceUnitWidget->getMapUnitScale() );
3613void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3617 mLayer->setDistanceYUnit( mVerticalDistanceUnitWidget->unit() );
3618 mLayer->setDistanceYMapUnitScale( mVerticalDistanceUnitWidget->getMapUnitScale() );
3623void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3627 mLayer->setDisplacementXUnit( mHorizontalDisplacementUnitWidget->unit() );
3628 mLayer->setDisplacementXMapUnitScale( mHorizontalDisplacementUnitWidget->getMapUnitScale() );
3633void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3637 mLayer->setDisplacementYUnit( mVerticalDisplacementUnitWidget->unit() );
3638 mLayer->setDisplacementYMapUnitScale( mVerticalDisplacementUnitWidget->getMapUnitScale() );
3643void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3647 mLayer->setOffsetXUnit( mHorizontalOffsetUnitWidget->unit() );
3648 mLayer->setOffsetXMapUnitScale( mHorizontalOffsetUnitWidget->getMapUnitScale() );
3653void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3657 mLayer->setOffsetYUnit( mVerticalOffsetUnitWidget->unit() );
3658 mLayer->setOffsetYMapUnitScale( mVerticalOffsetUnitWidget->getMapUnitScale() );
3684 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3685 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3686 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3687 mSizeUnitWidget->setUnits(
3690 mStrokeWidthUnitWidget->setUnits(
3693 mOffsetUnitWidget->setUnits(
3699 scrollArea->setVerticalOnly(
true );
3701 btnColor->setAllowOpacity(
true );
3702 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3703 btnColor->setContext( u
"symbology"_s );
3704 btnStrokeColor->setAllowOpacity(
true );
3705 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3706 btnStrokeColor->setContext( u
"symbology"_s );
3708 mColorDDBtn->registerLinkedWidget( btnColor );
3709 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3711 spinOffsetX->setClearValue( 0.0 );
3712 spinOffsetY->setClearValue( 0.0 );
3713 spinAngle->setClearValue( 0.0 );
3716 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
3719 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3722 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3724 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3727 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3729 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3730 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3741 if ( layer->
layerType() !=
"FontMarker"_L1 )
3750 mFontStyleComboBox->blockSignals(
true );
3751 populateFontStyleComboBox();
3752 mFontStyleComboBox->blockSignals(
false );
3764 if (
mLayer->character().length() == 1 )
3770 mCharPreview->setFont( mRefFont );
3776 mSizeUnitWidget->blockSignals(
true );
3777 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3778 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3779 mSizeUnitWidget->blockSignals(
false );
3781 mStrokeWidthUnitWidget->blockSignals(
true );
3782 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
3783 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
3784 mStrokeWidthUnitWidget->blockSignals(
false );
3786 mOffsetUnitWidget->blockSignals(
true );
3787 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3788 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3789 mOffsetUnitWidget->blockSignals(
false );
3794 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3795 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3810 updateAssistantSymbol();
3822 mLayer->setFontFamily( font.family() );
3825 mCharPreview->setFont( mRefFont );
3826 populateFontStyleComboBox();
3831void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3838 mCharPreview->setFont( mRefFont );
3845 mLayer->setColor( color );
3851 mLayer->setStrokeColor( color );
3864 mLayer->setAngle( angle );
3870 mCharPreview->setText( text );
3872 if ( text.isEmpty() )
3876 QString character = text;
3877 if ( text.contains( QRegularExpression( u
"^0x[0-9a-fA-F]{1,4}$"_s ) ) )
3880 const unsigned int value = text.toUInt( &ok, 0 );
3883 character = QChar( value );
3884 mCharPreview->setText( character );
3888 if ( character !=
mLayer->character() )
3890 mLayer->setCharacter( character );
3891 if (
mLayer->character().length() == 1 )
3905 if (
mLayer->character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3907 mCharLineEdit->insert( chr );
3911 mLayer->setCharacter( chr );
3913 mCharPreview->setText( chr );
3917void QgsFontMarkerSymbolLayerWidget::setOffset()
3919 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3923void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3925 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
3929void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3933 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
3934 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3939void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3943 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3944 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3949void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3953 mLayer->setStrokeWidthUnit( mSizeUnitWidget->unit() );
3954 mLayer->setStrokeWidthMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
3959void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3961 mFontStyleComboBox->clear();
3962 const QStringList styles = mFontDB.styles( mRefFont.family() );
3963 const auto constStyles = styles;
3964 for (
const QString &style : constStyles )
3966 mFontStyleComboBox->addItem( style );
3969 QString targetStyle = mFontDB.styleString( mRefFont );
3970 if ( !styles.contains( targetStyle ) )
3973 targetStyle = QFontInfo( f ).styleName();
3974 mRefFont.setStyleName( targetStyle );
3977 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
3978 if ( stylIndx > -1 )
3983 mFontStyleComboBox->setCurrentIndex( curIndx );
3986void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3989 setFontStyle( mFontStyleComboBox->currentText() );
3992void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4001void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4010void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
4014 mLayer->setStrokeWidth( d );
4019void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
4021 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
4023 mAssistantPreviewSymbol->deleteSymbolLayer( i );
4025 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
4028 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
4040 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
4041 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
4042 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
4043 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
4048 if ( layer->
layerType() !=
"CentroidFill"_L1 )
4058 whileBlocking( mClipOnCurrentPartOnlyCheckBox )->setChecked(
mLayer->clipOnCurrentPartOnly() );
4066void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
4072void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
4074 mLayer->setPointOnAllParts( state == Qt::Checked );
4078void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
4080 mLayer->setClipPoints( state == Qt::Checked );
4084void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
4086 mLayer->setClipOnCurrentPartOnly( state == Qt::Checked );
4107 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4111 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
4113 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
4114 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
4117 mSizeUnitWidget->setUnits(
4127 mOffsetUnitWidget->setUnits(
4131 mSpinOffsetX->setClearValue( 0.0 );
4132 mSpinOffsetY->setClearValue( 0.0 );
4133 mRotationSpinBox->setClearValue( 0.0 );
4135 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4136 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4139 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4140 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4150 if ( layer->
layerType() !=
"RasterMarker"_L1 )
4160 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4161 mHeightSpinBox->blockSignals(
true );
4162 if ( preservedAspectRatio )
4164 mHeightSpinBox->setValue(
mLayer->size() );
4168 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4170 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4171 mHeightSpinBox->blockSignals(
false );
4172 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4180 mSizeUnitWidget->blockSignals(
true );
4181 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4182 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4183 mSizeUnitWidget->blockSignals(
false );
4184 mOffsetUnitWidget->blockSignals(
true );
4185 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4186 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4187 mOffsetUnitWidget->blockSignals(
false );
4190 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4191 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4202 updatePreviewImage();
4213 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4216void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4219 updatePreviewImage();
4223void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
4225 bool fitsInCache =
false;
4227 if ( image.isNull() )
4229 mLabelImagePreview->setPixmap( QPixmap() );
4233 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4234 previewImage.fill( Qt::transparent );
4235 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4237 p.begin( &previewImage );
4239 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4240 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4241 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4242 QBrush checkerBrush;
4243 checkerBrush.setTexture( pix );
4244 p.fillRect( imageRect, checkerBrush );
4246 if (
mLayer->opacity() < 1.0 )
4248 p.setOpacity(
mLayer->opacity() );
4251 p.drawImage( imageRect.left(), imageRect.top(), image );
4253 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4256void QgsRasterMarkerSymbolLayerWidget::setWidth()
4258 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4259 double fixedAspectRatio = 0.0;
4260 mHeightSpinBox->blockSignals(
true );
4261 if ( defaultAspectRatio <= 0.0 )
4263 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4265 else if ( mLockAspectRatio->locked() )
4267 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4271 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4273 mHeightSpinBox->blockSignals(
false );
4274 mLayer->setSize( mWidthSpinBox->value() );
4275 mLayer->setFixedAspectRatio( fixedAspectRatio );
4279void QgsRasterMarkerSymbolLayerWidget::setHeight()
4281 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4282 double fixedAspectRatio = 0.0;
4283 mWidthSpinBox->blockSignals(
true );
4284 if ( defaultAspectRatio <= 0.0 )
4286 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4288 else if ( mLockAspectRatio->locked() )
4290 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4294 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4296 mWidthSpinBox->blockSignals(
false );
4297 mLayer->setSize( mWidthSpinBox->value() );
4298 mLayer->setFixedAspectRatio( fixedAspectRatio );
4302void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4304 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4305 if ( defaultAspectRatio <= 0.0 )
4311 mLayer->setFixedAspectRatio( 0.0 );
4316 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4320void QgsRasterMarkerSymbolLayerWidget::setAngle()
4322 mLayer->setAngle( mRotationSpinBox->value() );
4326void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4328 mLayer->setOpacity( value );
4330 updatePreviewImage();
4333void QgsRasterMarkerSymbolLayerWidget::setOffset()
4335 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4339void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4343 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4344 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4349void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4353 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4354 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4359void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4368void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4395 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastAnimatedMarkerImageDir"_s );
4399 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4401 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4402 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4405 mFrameRateSpin->setClearValue( 10 );
4406 mFrameRateSpin->setShowClearButton(
true );
4407 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
4408 mLayer->setFrameRate( value );
4412 mSizeUnitWidget->setUnits(
4422 mOffsetUnitWidget->setUnits(
4426 mSpinOffsetX->setClearValue( 0.0 );
4427 mSpinOffsetY->setClearValue( 0.0 );
4428 mRotationSpinBox->setClearValue( 0.0 );
4430 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4431 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4434 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4435 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4445 if ( layer->
layerType() !=
"AnimatedMarker"_L1 )
4455 if ( firstFrameTime > 0 )
4457 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4461 mFrameRateSpin->setClearValue( 10 );
4465 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4466 mHeightSpinBox->blockSignals(
true );
4467 if ( preservedAspectRatio )
4469 mHeightSpinBox->setValue(
mLayer->size() );
4473 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4475 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4476 mHeightSpinBox->blockSignals(
false );
4477 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4487 mSizeUnitWidget->blockSignals(
true );
4488 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4489 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4490 mSizeUnitWidget->blockSignals(
false );
4491 mOffsetUnitWidget->blockSignals(
true );
4492 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4493 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4494 mOffsetUnitWidget->blockSignals(
false );
4497 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4498 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4509 updatePreviewImage();
4520 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4523void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4528 if ( firstFrameTime > 0 )
4530 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4534 mFrameRateSpin->setClearValue( 10 );
4536 updatePreviewImage();
4540void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4542 if ( mPreviewMovie )
4544 mLabelImagePreview->setMovie(
nullptr );
4545 mPreviewMovie->deleteLater();
4546 mPreviewMovie =
nullptr;
4549 mPreviewMovie =
new QMovie(
mLayer->path(), QByteArray(),
this );
4550 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4551 mLabelImagePreview->setMovie( mPreviewMovie );
4552 mPreviewMovie->start();
4555void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4557 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4558 double fixedAspectRatio = 0.0;
4559 mHeightSpinBox->blockSignals(
true );
4560 if ( defaultAspectRatio <= 0.0 )
4562 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4564 else if ( mLockAspectRatio->locked() )
4566 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4570 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4572 mHeightSpinBox->blockSignals(
false );
4573 mLayer->setSize( mWidthSpinBox->value() );
4574 mLayer->setFixedAspectRatio( fixedAspectRatio );
4578void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4580 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4581 double fixedAspectRatio = 0.0;
4582 mWidthSpinBox->blockSignals(
true );
4583 if ( defaultAspectRatio <= 0.0 )
4585 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4587 else if ( mLockAspectRatio->locked() )
4589 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4593 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4595 mWidthSpinBox->blockSignals(
false );
4596 mLayer->setSize( mWidthSpinBox->value() );
4597 mLayer->setFixedAspectRatio( fixedAspectRatio );
4601void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4603 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4604 if ( defaultAspectRatio <= 0.0 )
4610 mLayer->setFixedAspectRatio( 0.0 );
4615 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4619void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4621 mLayer->setAngle( mRotationSpinBox->value() );
4625void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4627 mLayer->setOpacity( value );
4629 updatePreviewImage();
4632void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4634 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4638void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4642 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4643 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4648void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4652 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4653 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4658void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4667void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4684 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4688 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4695 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4696 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4699 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4708 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4717 mSizeUnitWidget->setUnits(
4727 mOffsetUnitWidget->setUnits(
4731 mSpinOffsetX->setClearValue( 0.0 );
4732 mSpinOffsetY->setClearValue( 0.0 );
4733 mRotationSpinBox->setClearValue( 0.0 );
4735 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4736 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4737 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4749 if ( layer->
layerType() !=
"RasterFill"_L1 )
4762 cboCoordinateMode->blockSignals(
true );
4763 switch (
mLayer->coordinateMode() )
4766 cboCoordinateMode->setCurrentIndex( 1 );
4770 cboCoordinateMode->setCurrentIndex( 0 );
4773 cboCoordinateMode->blockSignals(
false );
4779 mOffsetUnitWidget->blockSignals(
true );
4780 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4781 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4782 mOffsetUnitWidget->blockSignals(
false );
4785 mSizeUnitWidget->blockSignals(
true );
4786 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4787 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4788 mSizeUnitWidget->blockSignals(
false );
4792 updatePreviewImage();
4807void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4810 updatePreviewImage();
4814void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4831void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4838 mLayer->setOpacity( value );
4840 updatePreviewImage();
4843void QgsRasterFillSymbolLayerWidget::offsetChanged()
4845 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4849void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4855 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4856 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4860void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4869void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4871 bool fitsInCache =
false;
4873 if ( image.isNull() )
4875 mLabelImagePreview->setPixmap( QPixmap() );
4879 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4880 previewImage.fill( Qt::transparent );
4881 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4883 p.begin( &previewImage );
4885 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4886 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4887 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4888 QBrush checkerBrush;
4889 checkerBrush.setTexture( pix );
4890 p.fillRect( imageRect, checkerBrush );
4892 if (
mLayer->opacity() < 1.0 )
4894 p.setOpacity(
mLayer->opacity() );
4897 p.drawImage( imageRect.left(), imageRect.top(), image );
4899 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4913 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4915 mPenWidthUnitWidget->setUnits(
4918 mOffsetUnitWidget->setUnits(
4925 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
4926 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
4931 connect( spinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
4934 mLayer->setWidth( spinWidth->value() );
4942 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4943 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4949 spinOffset->setClearValue( 0.0 );
4950 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
4953 mLayer->setOffset( val );
4958 connect( cboCapStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4961 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
4965 connect( cboJoinStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
4968 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
4977 mLayer->setOpacity( opacity );
4978 updatePreviewImage();
4991 if ( layer->
layerType() !=
"RasterLine"_L1 )
5015 updatePreviewImage();
5030void QgsRasterLineSymbolLayerWidget::imageSourceChanged(
const QString &text )
5033 updatePreviewImage();
5037void QgsRasterLineSymbolLayerWidget::updatePreviewImage()
5039 bool fitsInCache =
false;
5041 if ( image.isNull() )
5043 mLabelImagePreview->setPixmap( QPixmap() );
5047 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
5048 previewImage.fill( Qt::transparent );
5049 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
5051 p.begin( &previewImage );
5053 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
5054 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
5055 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
5056 QBrush checkerBrush;
5057 checkerBrush.setTexture( pix );
5058 p.fillRect( imageRect, checkerBrush );
5060 if (
mLayer->opacity() < 1.0 )
5062 p.setOpacity(
mLayer->opacity() );
5065 p.drawImage( imageRect.left(), imageRect.top(), image );
5067 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
5080 modificationExpressionSelector->setMultiLine(
true );
5081 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
5082 modificationExpressionSelector->registerExpressionContextGenerator(
this );
5088 mUnitWidget->setShowMapScaleButton(
false );
5091 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
5093 if ( !mBlockSignals )
5095 mLayer->setUnits( mUnitWidget->unit() );
5105 modificationExpressionSelector->setExpression( mLayer->geometryExpression() );
5106 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData(
static_cast<int>( mLayer->symbolType() ) ) );
5107 mUnitWidget->setUnit( mLayer->units() );
5116void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
5123void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
5126 std::unique_ptr<QgsSymbol> subSymbol( mLayer->subSymbol()->clone() );
5128 mLayer->setSymbolType(
static_cast<Qgis::SymbolType>( cbxGeometryType->currentData().toInt() ) );
5130 switch ( mLayer->symbolType() )
5141 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5143 if (
dynamic_cast<const QgsLineSymbolLayer *
>( subSymbol->symbolLayer( i ) ) )
5144 layers << subSymbol->symbolLayer( i )->clone();
5147 if ( !layers.empty() )
5148 mLayer->setSubSymbol(
new QgsLineSymbol( layers ) );
5157 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5158 layers << subSymbol->symbolLayer( i )->clone();
5159 mLayer->setSubSymbol(
new QgsFillSymbol( layers ) );
5180 mPointCountSpinBox->setShowClearButton(
true );
5181 mPointCountSpinBox->setClearValue( 100 );
5182 mSeedSpinBox->setShowClearButton(
true );
5183 mSeedSpinBox->setClearValue( 0 );
5185 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
5186 connect( mPointCountSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
5187 connect( mDensityAreaSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
5188 connect( mSeedSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
5189 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5192 mLayer->setClipPoints( checked );
5197 mDensityAreaUnitWidget->setUnits(
5206 if ( !layer || layer->
layerType() !=
"RandomMarkerFill"_L1 )
5212 whileBlocking( mPointCountSpinBox )->setValue( mLayer->pointCount() );
5214 whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
5216 bool showDensityBasedCountWidgets =
false;
5217 switch ( mLayer->countMethod() )
5220 showDensityBasedCountWidgets =
true;
5225 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5226 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5227 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5228 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5230 whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData(
static_cast<int>( mLayer->countMethod() ) ) );
5231 whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
5232 mDensityAreaUnitWidget->blockSignals(
true );
5233 mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
5234 mDensityAreaUnitWidget->
setMapUnitScale( mLayer->densityAreaUnitScale() );
5235 mDensityAreaUnitWidget->blockSignals(
false );
5248void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
5250 bool showDensityBasedCountWidgets =
false;
5254 showDensityBasedCountWidgets =
true;
5259 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5260 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5261 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5262 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5266 mLayer->setCountMethod(
static_cast<Qgis::PointCountMethod>( mCountMethodComboBox->currentData().toInt() ) );
5271void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
5275 mLayer->setPointCount( d );
5280void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
5284 mLayer->setDensityArea( d );
5289void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
5293 mLayer->setDensityAreaUnit( mDensityAreaUnitWidget->unit() );
5294 mLayer->setDensityAreaUnitScale( mDensityAreaUnitWidget->getMapUnitScale() );
5299void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
5303 mLayer->setSeed( d );
5318 btnColorRamp->setShowGradientOnly(
true );
5320 btnChangeColor->setAllowOpacity(
true );
5321 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5322 btnChangeColor->setContext( u
"symbology"_s );
5323 btnChangeColor->setShowNoColor(
true );
5324 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
5325 btnChangeColor2->setAllowOpacity(
true );
5326 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5327 btnChangeColor2->setContext( u
"symbology"_s );
5328 btnChangeColor2->setShowNoColor(
true );
5329 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
5331 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
5332 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
5337 mLayer->setColor( color );
5344 mLayer->setColor2( color );
5349 if ( btnColorRamp->isNull() )
5354 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
5359 connect( radioTwoColor, &QAbstractButton::toggled,
this, [
this] {
5362 if ( radioTwoColor->isChecked() )
5365 btnChangeColor->setEnabled(
true );
5366 btnChangeColor2->setEnabled(
true );
5367 btnColorRamp->setEnabled(
false );
5372 btnColorRamp->setEnabled(
true );
5373 btnChangeColor->setEnabled(
false );
5374 btnChangeColor2->setEnabled(
false );
5380 mPenWidthUnitWidget->setUnits(
5383 mOffsetUnitWidget->setUnits(
5390 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5391 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5396 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5399 mLayer->setWidth( spinWidth->value() );
5407 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5408 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5413 spinOffset->setClearValue( 0.0 );
5414 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5417 mLayer->setOffset( val );
5422 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5425 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5429 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5432 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5445 if ( layer->
layerType() !=
"Lineburst"_L1 )
5456 btnChangeColor->blockSignals(
true );
5458 btnChangeColor->blockSignals(
false );
5459 btnChangeColor2->blockSignals(
true );
5460 btnChangeColor2->setColor(
mLayer->color2() );
5461 btnChangeColor2->blockSignals(
false );
5465 radioTwoColor->setChecked(
true );
5466 btnColorRamp->setEnabled(
false );
5470 radioColorRamp->setChecked(
true );
5471 btnChangeColor->setEnabled(
false );
5472 btnChangeColor2->setEnabled(
false );
5476 if (
mLayer->colorRamp() )
5478 btnColorRamp->blockSignals(
true );
5479 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
5480 btnColorRamp->blockSignals(
false );
5517 mPenWidthUnitWidget->setUnits(
5520 mOffsetUnitWidget->setUnits(
5527 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5528 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5533 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5536 mLayer->setWidth( spinWidth->value() );
5544 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5545 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5550 spinOffset->setClearValue( 0.0 );
5551 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5554 mLayer->setOffset( val );
5559 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5562 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5566 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5569 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5584 if ( layer->
layerType() !=
"FilledLine"_L1 )
5596 whileBlocking( mPenWidthUnitWidget )->setUnit( mLayer->widthUnit() );
5599 whileBlocking( mOffsetUnitWidget )->setUnit( mLayer->offsetUnit() );
5600 whileBlocking( mOffsetUnitWidget )->setMapUnitScale( mLayer->offsetMapUnitScale() );
5603 whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
5604 whileBlocking( cboCapStyle )->setPenCapStyle( mLayer->penCapStyle() );
5637 mSpinSkipMultiples->setClearValue( 0, tr(
"Not set" ) );
5638 mSpinLabelOffsetX->setClearValue( 0 );
5639 mSpinLabelOffsetY->setClearValue( 0 );
5640 mSpinAverageAngleLength->setClearValue( 4.0 );
5641 mLabelOffsetUnitWidget->setUnits(
5644 mAverageAngleUnit->setUnits(
5648 connect( mComboQuantity, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5649 if ( mLayer && !mBlockChangesSignal )
5656 if ( mLayer && !mBlockChangesSignal )
5658 mLayer->setTextFormat( mTextFormatButton->textFormat() );
5662 connect( spinInterval, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5663 if ( mLayer && !mBlockChangesSignal )
5665 mLayer->setInterval( spinInterval->value() );
5669 connect( mSpinSkipMultiples, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5670 if ( mLayer && !mBlockChangesSignal )
5672 mLayer->setSkipMultiplesOf( mSpinSkipMultiples->value() );
5676 connect( mCheckRotate, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5677 if ( mLayer && !mBlockChangesSignal )
5679 mLayer->setRotateLabels( checked );
5682 mSpinAverageAngleLength->setEnabled( checked );
5683 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5685 connect( mCheckShowMarker, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5686 if ( mLayer && !mBlockChangesSignal )
5688 mLayer->setShowMarker( checked );
5693 connect( mSpinLabelOffsetX, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5694 if ( mLayer && !mBlockChangesSignal )
5696 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5700 connect( mSpinLabelOffsetY, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5701 if ( mLayer && !mBlockChangesSignal )
5703 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5708 if ( mLayer && !mBlockChangesSignal )
5710 mLayer->setLabelOffsetUnit( mLabelOffsetUnitWidget->unit() );
5711 mLayer->setLabelOffsetMapUnitScale( mLabelOffsetUnitWidget->getMapUnitScale() );
5716 connect( mComboPlacement, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5717 if ( mLayer && !mBlockChangesSignal )
5720 mLayer->setPlacement( placement );
5721 switch ( placement )
5726 mIntervalWidget->show();
5729 mIntervalWidget->hide();
5736 connect( mSpinAverageAngleLength, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5737 if ( mLayer && !mBlockChangesSignal )
5739 mLayer->setAverageAngleLength( mSpinAverageAngleLength->value() );
5744 if ( mLayer && !mBlockChangesSignal )
5746 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
5747 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
5752 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsLinearReferencingSymbolLayerWidget::changeNumberFormat );
5754 mTextFormatButton->registerExpressionContextGenerator(
this );
5762 if ( !layer || layer->
layerType() !=
"LinearReferencing"_L1 )
5766 mLayer = qgis::down_cast<QgsLinearReferencingSymbolLayer *>( layer );
5768 mBlockChangesSignal =
true;
5770 mComboPlacement->setCurrentIndex( mComboPlacement->findData( QVariant::fromValue( mLayer->placement() ) ) );
5771 switch ( mLayer->placement() )
5776 mIntervalWidget->show();
5779 mIntervalWidget->hide();
5783 mComboQuantity->setCurrentIndex( mComboQuantity->findData( QVariant::fromValue( mLayer->labelSource() ) ) );
5785 mTextFormatButton->setTextFormat( mLayer->textFormat() );
5786 spinInterval->setValue( mLayer->interval() );
5787 mSpinSkipMultiples->setValue( mLayer->skipMultiplesOf() );
5788 mCheckRotate->setChecked( mLayer->rotateLabels() );
5789 mCheckShowMarker->setChecked( mLayer->showMarker() );
5790 mSpinLabelOffsetX->setValue( mLayer->labelOffset().x() );
5791 mSpinLabelOffsetY->setValue( mLayer->labelOffset().y() );
5792 mLabelOffsetUnitWidget->setUnit( mLayer->labelOffsetUnit() );
5793 mLabelOffsetUnitWidget->setMapUnitScale( mLayer->labelOffsetMapUnitScale() );
5795 mAverageAngleUnit->setUnit( mLayer->averageAngleUnit() );
5796 mAverageAngleUnit->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
5797 mSpinAverageAngleLength->setValue( mLayer->averageAngleLength() );
5799 mSpinAverageAngleLength->setEnabled( mCheckRotate->isChecked() );
5800 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5807 mBlockChangesSignal =
false;
5818 mTextFormatButton->setMapCanvas(
context.mapCanvas() );
5819 mTextFormatButton->setMessageBar(
context.messageBar() );
5822void QgsLinearReferencingSymbolLayerWidget::changeNumberFormat()
5832 if ( !mBlockChangesSignal )
5842 QgsNumericFormatSelectorDialog dialog(
this );
5843 dialog.setFormat( mLayer->numericFormat() );
5844 dialog.registerExpressionContextGenerator(
this );
5845 if ( dialog.exec() )
5847 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.
void editingStopped()
Emitted when edited changes have been successfully written to the data provider.
void editingStarted()
Emitted when editing on this layer has started.
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.
static bool fieldIsReadOnly(const QgsVectorLayer *layer, int fieldIndex)
Returns true if the field at index fieldIndex from layer is editable, false if the field is read only...
Represents a vector layer which manages a vector based dataset.
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.