54#include <QAbstractButton>
56#include <QActionGroup>
58#include <QButtonGroup>
59#include <QColorDialog>
63#include <QInputDialog>
69#include <QRegularExpression>
70#include <QStandardItemModel>
72#include <QSvgRenderer>
74#include "moc_qgssymbollayerwidget.cpp"
76using namespace Qt::StringLiterals;
80 if (
auto *lExpressionContext = mContext.expressionContext() )
81 return *lExpressionContext;
92 expContext << symbolScope;
105 const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
114 QStringList highlights;
125 << u
"symbol_layer_count"_s
126 << u
"symbol_layer_index"_s
127 << u
"symbol_frame"_s;
132 highlights << u
"zoom_level"_s;
134 if ( expContext.
hasVariable( u
"vector_tile_zoom"_s ) )
136 highlights << u
"vector_tile_zoom"_s;
147 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
150 unitWidget->setMapCanvas( mContext.mapCanvas() );
168void QgsSymbolLayerWidget::createAuxiliaryField()
171 if ( !mVectorLayer->auxiliaryLayer() )
178 if ( !mVectorLayer->auxiliaryLayer() )
181 QgsPropertyOverrideButton *button = qobject_cast<QgsPropertyOverrideButton *>( sender() );
186 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
188 QgsNewAuxiliaryFieldDialog dlg( def, mVectorLayer,
true,
this );
189 if ( dlg.exec() == QDialog::Accepted )
190 def = dlg.propertyDefinition();
194 if ( !mVectorLayer->auxiliaryLayer()->exists( def ) )
200 property.setActive(
true );
222 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
223 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
227 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
229 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [
this] {
230 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
231 if ( !mCheckAlignDash->isChecked() )
232 mCheckDashCorners->setChecked(
false );
236 mLayer->setAlignDashPattern( mCheckAlignDash->isChecked() );
240 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [
this] {
243 mLayer->setTweakDashPatternOnCorners( mCheckDashCorners->isChecked() );
248 mPenWidthUnitWidget->setUnits(
251 mOffsetUnitWidget->setUnits(
254 mDashPatternUnitWidget->setUnits(
257 mPatternOffsetUnitWidget->setUnits(
260 mTrimDistanceStartUnitWidget->setUnits(
270 mTrimDistanceEndUnitWidget->setUnits(
281 btnChangeColor->setAllowOpacity(
true );
282 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
283 btnChangeColor->setContext( u
"symbology"_s );
285 mColorDDBtn->registerLinkedWidget( btnChangeColor );
290 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
298 spinOffset->setClearValue( 0.0 );
299 spinPatternOffset->setClearValue( 0.0 );
301 mTrimStartDistanceSpin->setClearValue( 0.0 );
302 mTrimDistanceEndSpin->setClearValue( 0.0 );
305 mAssistantPreviewSymbol = std::make_shared<QgsLineSymbol>();
308 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
310 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
312 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
313 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
314 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
315 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
316 connect( spinPatternOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
318 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
322 mLayer->setTrimDistanceStart( value );
329 mLayer->setTrimDistanceStartUnit( mTrimDistanceStartUnitWidget->unit() );
330 mLayer->setTrimDistanceStartMapUnitScale( mTrimDistanceStartUnitWidget->getMapUnitScale() );
333 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
337 mLayer->setTrimDistanceEnd( value );
344 mLayer->setTrimDistanceEndUnit( mTrimDistanceEndUnitWidget->unit() );
345 mLayer->setTrimDistanceEndMapUnitScale( mTrimDistanceEndUnitWidget->getMapUnitScale() );
357void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
359 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
361 mAssistantPreviewSymbol->deleteSymbolLayer( i );
363 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
366 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
372 if ( !layer || layer->
layerType() !=
"SimpleLine"_L1 )
379 mPenWidthUnitWidget->blockSignals(
true );
380 mPenWidthUnitWidget->setUnit(
mLayer->widthUnit() );
382 mPenWidthUnitWidget->blockSignals(
false );
383 mOffsetUnitWidget->blockSignals(
true );
384 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
385 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
386 mOffsetUnitWidget->blockSignals(
false );
387 mDashPatternUnitWidget->blockSignals(
true );
388 mDashPatternUnitWidget->setUnit(
mLayer->customDashPatternUnit() );
389 mDashPatternUnitWidget->setMapUnitScale(
mLayer->customDashPatternMapUnitScale() );
390 mDashPatternUnitWidget->blockSignals(
false );
393 whileBlocking( mPatternOffsetUnitWidget )->setMapUnitScale(
mLayer->dashPatternOffsetMapUnitScale() );
395 whileBlocking( mTrimDistanceStartUnitWidget )->setMapUnitScale(
mLayer->trimDistanceStartMapUnitScale() );
397 whileBlocking( mTrimDistanceEndUnitWidget )->setMapUnitScale(
mLayer->trimDistanceEndMapUnitScale() );
400 spinWidth->blockSignals(
true );
401 spinWidth->setValue(
mLayer->width() );
402 spinWidth->blockSignals(
false );
403 btnChangeColor->blockSignals(
true );
404 btnChangeColor->setColor(
mLayer->color() );
405 btnChangeColor->blockSignals(
false );
406 spinOffset->blockSignals(
true );
407 spinOffset->setValue(
mLayer->offset() );
408 spinOffset->blockSignals(
false );
409 cboPenStyle->blockSignals(
true );
410 cboJoinStyle->blockSignals(
true );
411 cboCapStyle->blockSignals(
true );
412 cboPenStyle->setPenStyle(
mLayer->penStyle() );
413 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
414 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
415 cboPenStyle->blockSignals(
false );
416 cboJoinStyle->blockSignals(
false );
417 cboCapStyle->blockSignals(
false );
423 const bool useCustomDashPattern =
mLayer->useCustomDashPattern();
424 mChangePatternButton->setEnabled( useCustomDashPattern );
425 label_3->setEnabled( !useCustomDashPattern );
426 cboPenStyle->setEnabled( !useCustomDashPattern );
427 mCustomCheckBox->blockSignals(
true );
428 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
429 mCustomCheckBox->blockSignals(
false );
432 const QSize size = mChangePatternButton->minimumSizeHint();
434 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
437 const bool drawInsidePolygon =
mLayer->drawInsidePolygon();
438 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
440 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData(
mLayer->ringFilter() ) );
443 mCheckDashCorners->setEnabled(
mLayer->alignDashPattern() );
459 updateAssistantSymbol();
471 switch (
context.symbolType() )
476 mDrawInsideCheckBox->hide();
477 mRingFilterComboBox->hide();
487void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
494void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
496 mLayer->setColor( color );
500void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
502 mLayer->setPenStyle( cboPenStyle->penStyle() );
503 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
504 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
509void QgsSimpleLineSymbolLayerWidget::offsetChanged()
511 mLayer->setOffset( spinOffset->value() );
516void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
518 mLayer->setDashPatternOffset( spinPatternOffset->value() );
523void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
525 const bool checked = ( state == Qt::Checked );
526 mChangePatternButton->setEnabled( checked );
527 label_3->setEnabled( !checked );
528 cboPenStyle->setEnabled( !checked );
530 mLayer->setUseCustomDashPattern( checked );
534void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
539 QgsDashSpaceWidget *widget =
new QgsDashSpaceWidget(
mLayer->customDashVector(), panel );
541 widget->
setUnit( mDashPatternUnitWidget->unit() );
551 QgsDashSpaceDialog d(
mLayer->customDashVector() );
552 d.setUnit( mDashPatternUnitWidget->unit() );
553 if ( d.exec() == QDialog::Accepted )
555 mLayer->setCustomDashVector( d.dashDotVector() );
561void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
565 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
566 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
572void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
576 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
577 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
582void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
586 mLayer->setCustomDashPatternUnit( mDashPatternUnitWidget->unit() );
587 mLayer->setCustomDashPatternMapUnitScale( mDashPatternUnitWidget->getMapUnitScale() );
593void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
595 const bool checked = ( state == Qt::Checked );
596 mLayer->setDrawInsidePolygon( checked );
600void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
604 mLayer->setDashPatternOffsetUnit( mPatternOffsetUnitWidget->unit() );
605 mLayer->setDashPatternOffsetMapUnitScale( mPatternOffsetUnitWidget->getMapUnitScale() );
617 std::unique_ptr<QgsSimpleLineSymbolLayer> layerCopy(
mLayer->clone() );
622 const QColor color = qApp->palette().color( QPalette::WindowText );
623 layerCopy->setColor( color );
625 layerCopy->setOffset( 0 );
626 layerCopy->setUseCustomDashPattern(
true );
628 QSize currentIconSize;
631 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
633 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
636 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
642 const std::unique_ptr<QgsLineSymbol> previewSymbol = std::make_unique<QgsLineSymbol>(
QgsSymbolLayerList() << layerCopy.release() );
644 mChangePatternButton->setIconSize( currentIconSize );
645 mChangePatternButton->setIcon( icon );
649 const int width =
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
650 const int height =
static_cast<int>( width / 1.61803398875 );
654 QBuffer buffer( &data );
655 pm.save( &buffer,
"PNG", 100 );
656 mChangePatternButton->setToolTip( u
"<img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString( data.toBase64() ) ).arg( width ) );
661 QgsSymbolLayerWidget::resizeEvent( event );
686 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
687 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
688 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
689 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
690 mSizeUnitWidget->setUnits(
693 mOffsetUnitWidget->setUnits(
696 mStrokeWidthUnitWidget->setUnits(
700 btnChangeColorFill->setAllowOpacity(
true );
701 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
702 btnChangeColorFill->setContext( u
"symbology"_s );
703 btnChangeColorFill->setShowNoColor(
true );
704 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
705 btnChangeColorStroke->setAllowOpacity(
true );
706 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
707 btnChangeColorStroke->setContext( u
"symbology"_s );
708 btnChangeColorStroke->setShowNoColor(
true );
709 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
711 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
712 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
714 spinOffsetX->setClearValue( 0.0 );
715 spinOffsetY->setClearValue( 0.0 );
716 spinAngle->setClearValue( 0.0 );
719 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
722 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
724 int size = lstNames->iconSize().width();
726 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
728 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
729 lstNames->setIconSize( QSize( size, size ) );
731 const double markerSize = size * 0.8;
737 lyr->
setColor( QColor( 200, 200, 200 ) );
741 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
742 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
747 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
749 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
752 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
753 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
754 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
755 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
756 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
757 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
765 if ( layer->
layerType() !=
"SimpleMarker"_L1 )
773 for (
int i = 0; i < lstNames->count(); ++i )
775 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
777 lstNames->setCurrentRow( i );
781 btnChangeColorStroke->blockSignals(
true );
782 btnChangeColorStroke->setColor(
mLayer->strokeColor() );
783 btnChangeColorStroke->blockSignals(
false );
784 btnChangeColorFill->blockSignals(
true );
785 btnChangeColorFill->setColor(
mLayer->fillColor() );
787 btnChangeColorFill->blockSignals(
false );
788 spinSize->blockSignals(
true );
789 spinSize->setValue(
mLayer->size() );
790 spinSize->blockSignals(
false );
791 spinAngle->blockSignals(
true );
792 spinAngle->setValue(
mLayer->angle() );
793 spinAngle->blockSignals(
false );
794 mStrokeStyleComboBox->blockSignals(
true );
795 mStrokeStyleComboBox->setPenStyle(
mLayer->strokeStyle() );
796 mStrokeStyleComboBox->blockSignals(
false );
797 mStrokeWidthSpinBox->blockSignals(
true );
798 mStrokeWidthSpinBox->setValue(
mLayer->strokeWidth() );
799 mStrokeWidthSpinBox->blockSignals(
false );
800 cboJoinStyle->blockSignals(
true );
801 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
802 cboJoinStyle->blockSignals(
false );
803 cboCapStyle->blockSignals(
true );
804 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
805 cboCapStyle->blockSignals(
false );
808 spinOffsetX->blockSignals(
true );
809 spinOffsetX->setValue(
mLayer->offset().x() );
810 spinOffsetX->blockSignals(
false );
811 spinOffsetY->blockSignals(
true );
812 spinOffsetY->setValue(
mLayer->offset().y() );
813 spinOffsetY->blockSignals(
false );
815 mSizeUnitWidget->blockSignals(
true );
816 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
817 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
818 mSizeUnitWidget->blockSignals(
false );
819 mOffsetUnitWidget->blockSignals(
true );
820 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
821 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
822 mOffsetUnitWidget->blockSignals(
false );
823 mStrokeWidthUnitWidget->blockSignals(
true );
824 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
825 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
826 mStrokeWidthUnitWidget->blockSignals(
false );
829 mHorizontalAnchorComboBox->blockSignals(
true );
830 mVerticalAnchorComboBox->blockSignals(
true );
831 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
832 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
833 mHorizontalAnchorComboBox->blockSignals(
false );
834 mVerticalAnchorComboBox->blockSignals(
false );
849 updateAssistantSymbol();
857void QgsSimpleMarkerSymbolLayerWidget::setShape()
866 mLayer->setStrokeColor( color );
872 mLayer->setColor( color );
876void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
882void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
884 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
888void QgsSimpleMarkerSymbolLayerWidget::setSize()
890 mLayer->setSize( spinSize->value() );
894void QgsSimpleMarkerSymbolLayerWidget::setAngle()
896 mLayer->setAngle( spinAngle->value() );
900void QgsSimpleMarkerSymbolLayerWidget::setOffset()
902 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
906void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
912 mLayer->setStrokeStyle( mStrokeStyleComboBox->penStyle() );
917void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
921 mLayer->setStrokeWidth( d );
926void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
930 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
931 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
936void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
940 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
941 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
946void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
950 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
951 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
956void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
965void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
974void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
976 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
978 mAssistantPreviewSymbol->deleteSymbolLayer( i );
980 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
983 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
997 mStrokeWidthUnitWidget->setUnits(
1000 mOffsetUnitWidget->setUnits(
1004 btnChangeColor->setAllowOpacity(
true );
1005 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
1006 btnChangeColor->setContext( u
"symbology"_s );
1007 btnChangeColor->setShowNoColor(
true );
1008 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
1009 btnChangeStrokeColor->setAllowOpacity(
true );
1010 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
1011 btnChangeStrokeColor->setContext( u
"symbology"_s );
1012 btnChangeStrokeColor->setShowNoColor(
true );
1013 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
1015 spinOffsetX->setClearValue( 0.0 );
1016 spinOffsetY->setClearValue( 0.0 );
1019 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
1021 connect( spinStrokeWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
1022 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1023 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1024 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1025 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1027 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
1028 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
1033 if ( layer->
layerType() !=
"SimpleFill"_L1 )
1040 btnChangeColor->blockSignals(
true );
1042 btnChangeColor->blockSignals(
false );
1043 cboFillStyle->blockSignals(
true );
1044 cboFillStyle->setBrushStyle(
mLayer->brushStyle() );
1045 cboFillStyle->blockSignals(
false );
1046 btnChangeStrokeColor->blockSignals(
true );
1047 btnChangeStrokeColor->setColor(
mLayer->strokeColor() );
1048 btnChangeStrokeColor->blockSignals(
false );
1049 cboStrokeStyle->blockSignals(
true );
1050 cboStrokeStyle->setPenStyle(
mLayer->strokeStyle() );
1051 cboStrokeStyle->blockSignals(
false );
1052 spinStrokeWidth->blockSignals(
true );
1053 spinStrokeWidth->setValue(
mLayer->strokeWidth() );
1054 spinStrokeWidth->blockSignals(
false );
1055 cboJoinStyle->blockSignals(
true );
1056 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
1057 cboJoinStyle->blockSignals(
false );
1058 spinOffsetX->blockSignals(
true );
1059 spinOffsetX->setValue(
mLayer->offset().x() );
1060 spinOffsetX->blockSignals(
false );
1061 spinOffsetY->blockSignals(
true );
1062 spinOffsetY->setValue(
mLayer->offset().y() );
1063 spinOffsetY->blockSignals(
false );
1065 mStrokeWidthUnitWidget->blockSignals(
true );
1066 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
1067 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
1068 mStrokeWidthUnitWidget->blockSignals(
false );
1069 mOffsetUnitWidget->blockSignals(
true );
1070 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1071 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1072 mOffsetUnitWidget->blockSignals(
false );
1090 mLayer->setColor( color );
1096 mLayer->setStrokeColor( color );
1100void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1106void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1108 mLayer->setStrokeWidth( spinStrokeWidth->value() );
1112void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1114 mLayer->setStrokeStyle( cboStrokeStyle->penStyle() );
1115 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
1119void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1121 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1125void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1129 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
1130 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
1135void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1139 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1140 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1164 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1165 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1166 mSizeUnitWidget->setUnits(
1169 mOffsetUnitWidget->setUnits(
1173 spinOffsetX->setClearValue( 0.0 );
1174 spinOffsetY->setClearValue( 0.0 );
1175 spinAngle->setClearValue( 0.0 );
1178 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
1181 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1183 int size = lstNames->iconSize().width();
1184 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1185 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1186 lstNames->setIconSize( QSize( size, size ) );
1188 const double markerSize = size * 0.8;
1194 lyr->
setColor( QColor( 200, 200, 200 ) );
1198 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1199 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
1204 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1206 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1207 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1208 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1209 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1210 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1218 if ( layer->
layerType() !=
"FilledMarker"_L1 )
1226 for (
int i = 0; i < lstNames->count(); ++i )
1228 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1230 lstNames->setCurrentRow( i );
1239 mSizeUnitWidget->blockSignals(
true );
1240 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
1241 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
1242 mSizeUnitWidget->blockSignals(
false );
1243 mOffsetUnitWidget->blockSignals(
true );
1244 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1245 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1246 mOffsetUnitWidget->blockSignals(
false );
1249 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
1250 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
1259 updateAssistantSymbol();
1267void QgsFilledMarkerSymbolLayerWidget::setShape()
1273void QgsFilledMarkerSymbolLayerWidget::setSize()
1275 mLayer->setSize( spinSize->value() );
1279void QgsFilledMarkerSymbolLayerWidget::setAngle()
1281 mLayer->setAngle( spinAngle->value() );
1285void QgsFilledMarkerSymbolLayerWidget::setOffset()
1287 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1291void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1295 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
1296 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
1301void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1305 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1306 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1311void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
1320void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
1329void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1331 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
1333 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1335 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
1338 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1351 connect( mSpinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1352 mOffsetUnitWidget->setUnits(
1356 btnColorRamp->setShowGradientOnly(
true );
1358 btnChangeColor->setAllowOpacity(
true );
1359 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1360 btnChangeColor->setContext( u
"symbology"_s );
1361 btnChangeColor->setShowNoColor(
true );
1362 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1363 btnChangeColor2->setAllowOpacity(
true );
1364 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1365 btnChangeColor2->setContext( u
"symbology"_s );
1366 btnChangeColor2->setShowNoColor(
true );
1367 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1369 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1370 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1372 spinOffsetX->setClearValue( 0.0 );
1373 spinOffsetY->setClearValue( 0.0 );
1374 mSpinAngle->setClearValue( 0.0 );
1382 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1383 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1384 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1385 connect( spinRefPoint1X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1386 connect( spinRefPoint1Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1387 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1388 connect( spinRefPoint2X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1389 connect( spinRefPoint2Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1390 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1395 if ( layer->
layerType() !=
"GradientFill"_L1 )
1402 btnChangeColor->blockSignals(
true );
1404 btnChangeColor->blockSignals(
false );
1405 btnChangeColor2->blockSignals(
true );
1406 btnChangeColor2->setColor(
mLayer->color2() );
1407 btnChangeColor2->blockSignals(
false );
1411 radioTwoColor->setChecked(
true );
1412 btnColorRamp->setEnabled(
false );
1416 radioColorRamp->setChecked(
true );
1417 btnChangeColor->setEnabled(
false );
1418 btnChangeColor2->setEnabled(
false );
1422 if (
mLayer->colorRamp() )
1424 btnColorRamp->blockSignals(
true );
1425 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1426 btnColorRamp->blockSignals(
false );
1429 cboGradientType->blockSignals(
true );
1430 switch (
mLayer->gradientType() )
1433 cboGradientType->setCurrentIndex( 0 );
1436 cboGradientType->setCurrentIndex( 1 );
1439 cboGradientType->setCurrentIndex( 2 );
1442 cboGradientType->blockSignals(
false );
1444 cboCoordinateMode->blockSignals(
true );
1445 switch (
mLayer->coordinateMode() )
1448 cboCoordinateMode->setCurrentIndex( 1 );
1449 checkRefPoint1Centroid->setEnabled(
false );
1450 checkRefPoint2Centroid->setEnabled(
false );
1454 cboCoordinateMode->setCurrentIndex( 0 );
1457 cboCoordinateMode->blockSignals(
false );
1459 cboGradientSpread->blockSignals(
true );
1460 switch (
mLayer->gradientSpread() )
1463 cboGradientSpread->setCurrentIndex( 0 );
1466 cboGradientSpread->setCurrentIndex( 1 );
1469 cboGradientSpread->setCurrentIndex( 2 );
1472 cboGradientSpread->blockSignals(
false );
1474 spinRefPoint1X->blockSignals(
true );
1475 spinRefPoint1X->setValue(
mLayer->referencePoint1().x() );
1476 spinRefPoint1X->blockSignals(
false );
1477 spinRefPoint1Y->blockSignals(
true );
1478 spinRefPoint1Y->setValue(
mLayer->referencePoint1().y() );
1479 spinRefPoint1Y->blockSignals(
false );
1480 checkRefPoint1Centroid->blockSignals(
true );
1481 checkRefPoint1Centroid->setChecked(
mLayer->referencePoint1IsCentroid() );
1482 if (
mLayer->referencePoint1IsCentroid() )
1484 spinRefPoint1X->setEnabled(
false );
1485 spinRefPoint1Y->setEnabled(
false );
1487 checkRefPoint1Centroid->blockSignals(
false );
1488 spinRefPoint2X->blockSignals(
true );
1489 spinRefPoint2X->setValue(
mLayer->referencePoint2().x() );
1490 spinRefPoint2X->blockSignals(
false );
1491 spinRefPoint2Y->blockSignals(
true );
1492 spinRefPoint2Y->setValue(
mLayer->referencePoint2().y() );
1493 spinRefPoint2Y->blockSignals(
false );
1494 checkRefPoint2Centroid->blockSignals(
true );
1495 checkRefPoint2Centroid->setChecked(
mLayer->referencePoint2IsCentroid() );
1496 if (
mLayer->referencePoint2IsCentroid() )
1498 spinRefPoint2X->setEnabled(
false );
1499 spinRefPoint2Y->setEnabled(
false );
1501 checkRefPoint2Centroid->blockSignals(
false );
1503 spinOffsetX->blockSignals(
true );
1504 spinOffsetX->setValue(
mLayer->offset().x() );
1505 spinOffsetX->blockSignals(
false );
1506 spinOffsetY->blockSignals(
true );
1507 spinOffsetY->setValue(
mLayer->offset().y() );
1508 spinOffsetY->blockSignals(
false );
1509 mSpinAngle->blockSignals(
true );
1510 mSpinAngle->setValue(
mLayer->angle() );
1511 mSpinAngle->blockSignals(
false );
1513 mOffsetUnitWidget->blockSignals(
true );
1514 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1515 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1516 mOffsetUnitWidget->blockSignals(
false );
1540 mLayer->setColor( color );
1546 mLayer->setColor2( color );
1550void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1552 if ( radioTwoColor->isChecked() )
1565 if ( btnColorRamp->isNull() )
1568 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
1579 spinRefPoint1X->setValue( 0.5 );
1580 spinRefPoint1Y->setValue( 0 );
1581 spinRefPoint2X->setValue( 0.5 );
1582 spinRefPoint2Y->setValue( 1 );
1587 spinRefPoint1X->setValue( 0 );
1588 spinRefPoint1Y->setValue( 0 );
1589 spinRefPoint2X->setValue( 1 );
1590 spinRefPoint2Y->setValue( 1 );
1594 spinRefPoint1X->setValue( 0.5 );
1595 spinRefPoint1Y->setValue( 0.5 );
1596 spinRefPoint2X->setValue( 1 );
1597 spinRefPoint2Y->setValue( 1 );
1611 checkRefPoint1Centroid->setEnabled(
true );
1612 checkRefPoint2Centroid->setEnabled(
true );
1618 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1619 checkRefPoint1Centroid->setEnabled(
false );
1620 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1621 checkRefPoint2Centroid->setEnabled(
false );
1646void QgsGradientFillSymbolLayerWidget::offsetChanged()
1648 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1652void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1654 mLayer->setReferencePoint1( QPointF( spinRefPoint1X->value(), spinRefPoint1Y->value() ) );
1655 mLayer->setReferencePoint1IsCentroid( checkRefPoint1Centroid->isChecked() );
1656 mLayer->setReferencePoint2( QPointF( spinRefPoint2X->value(), spinRefPoint2Y->value() ) );
1657 mLayer->setReferencePoint2IsCentroid( checkRefPoint2Centroid->isChecked() );
1661void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1663 mLayer->setAngle( value );
1667void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1671 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1672 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1685 connect( mSpinBlurRadius, qOverload<int>( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1686 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1688 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1690 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1691 mDistanceUnitWidget->setUnits(
1694 mOffsetUnitWidget->setUnits(
1698 QButtonGroup *group1 =
new QButtonGroup(
this );
1699 group1->addButton( radioColorRamp );
1700 group1->addButton( radioTwoColor );
1701 QButtonGroup *group2 =
new QButtonGroup(
this );
1702 group2->addButton( mRadioUseMaxDistance );
1703 group2->addButton( mRadioUseWholeShape );
1704 btnChangeColor->setAllowOpacity(
true );
1705 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1706 btnChangeColor->setContext( u
"symbology"_s );
1707 btnChangeColor->setShowNoColor(
true );
1708 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1709 btnChangeColor2->setAllowOpacity(
true );
1710 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1711 btnChangeColor2->setContext( u
"symbology"_s );
1712 btnChangeColor2->setShowNoColor(
true );
1713 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1715 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1716 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1718 spinOffsetX->setClearValue( 0.0 );
1719 spinOffsetY->setClearValue( 0.0 );
1720 mSpinMaxDistance->setClearValue( 5.0 );
1722 btnColorRamp->setShowGradientOnly(
true );
1728 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1729 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1730 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1732 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1733 connect( mSpinBlurRadius,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1738 if ( layer->
layerType() !=
"ShapeburstFill"_L1 )
1745 btnChangeColor->blockSignals(
true );
1747 btnChangeColor->blockSignals(
false );
1748 btnChangeColor2->blockSignals(
true );
1749 btnChangeColor2->setColor(
mLayer->color2() );
1750 btnChangeColor2->blockSignals(
false );
1754 radioTwoColor->setChecked(
true );
1755 btnColorRamp->setEnabled(
false );
1759 radioColorRamp->setChecked(
true );
1760 btnChangeColor->setEnabled(
false );
1761 btnChangeColor2->setEnabled(
false );
1764 mSpinBlurRadius->blockSignals(
true );
1765 mBlurSlider->blockSignals(
true );
1766 mSpinBlurRadius->setValue(
mLayer->blurRadius() );
1767 mBlurSlider->setValue(
mLayer->blurRadius() );
1768 mSpinBlurRadius->blockSignals(
false );
1769 mBlurSlider->blockSignals(
false );
1771 mSpinMaxDistance->blockSignals(
true );
1772 mSpinMaxDistance->setValue(
mLayer->maxDistance() );
1773 mSpinMaxDistance->blockSignals(
false );
1775 mRadioUseWholeShape->blockSignals(
true );
1776 mRadioUseMaxDistance->blockSignals(
true );
1777 if (
mLayer->useWholeShape() )
1779 mRadioUseWholeShape->setChecked(
true );
1780 mSpinMaxDistance->setEnabled(
false );
1781 mDistanceUnitWidget->setEnabled(
false );
1785 mRadioUseMaxDistance->setChecked(
true );
1786 mSpinMaxDistance->setEnabled(
true );
1787 mDistanceUnitWidget->setEnabled(
true );
1789 mRadioUseWholeShape->blockSignals(
false );
1790 mRadioUseMaxDistance->blockSignals(
false );
1792 mDistanceUnitWidget->blockSignals(
true );
1793 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
1794 mDistanceUnitWidget->setMapUnitScale(
mLayer->distanceMapUnitScale() );
1795 mDistanceUnitWidget->blockSignals(
false );
1797 mIgnoreRingsCheckBox->blockSignals(
true );
1798 mIgnoreRingsCheckBox->setCheckState(
mLayer->ignoreRings() ? Qt::Checked : Qt::Unchecked );
1799 mIgnoreRingsCheckBox->blockSignals(
false );
1802 if (
mLayer->colorRamp() )
1804 btnColorRamp->blockSignals(
true );
1805 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1806 btnColorRamp->blockSignals(
false );
1809 spinOffsetX->blockSignals(
true );
1810 spinOffsetX->setValue(
mLayer->offset().x() );
1811 spinOffsetX->blockSignals(
false );
1812 spinOffsetY->blockSignals(
true );
1813 spinOffsetY->setValue(
mLayer->offset().y() );
1814 spinOffsetY->blockSignals(
false );
1815 mOffsetUnitWidget->blockSignals(
true );
1816 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1817 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1818 mOffsetUnitWidget->blockSignals(
false );
1838 mLayer->setColor( color );
1847 mLayer->setColor2( color );
1852void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1859 if ( radioTwoColor->isChecked() )
1870void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1874 mLayer->setBlurRadius( value );
1879void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1883 mLayer->setMaxDistance( value );
1888void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1892 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
1893 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
1898void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1902 mLayer->setUseWholeShape( value );
1903 mDistanceUnitWidget->setEnabled( !value );
1908void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1910 QgsColorRamp *ramp = btnColorRamp->colorRamp();
1914 mLayer->setColorRamp( ramp );
1918void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1922 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1927void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1931 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1932 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1938void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1940 const bool checked = ( state == Qt::Checked );
1941 mLayer->setIgnoreRings( checked );
1949 , mSymbolType( symbolType )
1956 connect( mOffsetAlongLineUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed );
1962 mIntervalUnitWidget->setUnits( units );
1963 mOffsetUnitWidget->setUnits( units );
1965 mAverageAngleUnit->setUnits( units );
1966 mIntervalUnitWidget->setUnits( units );
1967 mBlankSegmentsUnitWidget->setUnits( units );
1974 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1982 spinOffset->setClearValue( 0.0 );
1983 mSpinOffsetAlongLine->setClearValue( 0.0 );
1984 mHashRotationSpinBox->setClearValue( 0 );
1985 mSpinAverageAngleLength->setClearValue( 4.0 );
1986 mTrimStartDistanceSpin->setClearValue( 0.0 );
1987 mTrimDistanceEndSpin->setClearValue( 0.0 );
1991 connect( mSpinHashLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashLength );
1992 connect( mHashRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashAngle );
1993 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsTemplatedLineSymbolLayerWidget::setRotate );
1994 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setOffset );
1995 connect( mSpinAverageAngleLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setAverageAngle );
1997 QActionGroup *actionGroup =
new QActionGroup(
this );
1998 actionGroup->setExclusionPolicy( QActionGroup::ExclusionPolicy::Exclusive );
1999 actionGroup->addAction( mEditBlankSegmentsAction );
2000 actionGroup->addAction( mAddExtraItemAction );
2001 actionGroup->addAction( mModifyExtraItemAction );
2003 mEditBlankSegmentsBtn->setDefaultAction( mEditBlankSegmentsAction );
2004 connect( mEditBlankSegmentsAction, &QAction::triggered,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolEditBlankSegments );
2006 mAddExtraItemBtn->setDefaultAction( mAddExtraItemAction );
2007 connect( mAddExtraItemAction, &QAction::triggered,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolAddExtraItem );
2009 mModifyExtraItemBtn->setDefaultAction( mModifyExtraItemAction );
2010 connect( mModifyExtraItemAction, &QAction::triggered,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolModifyExtraItem );
2012 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2013 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2014 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2015 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2016 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2017 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2018 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2020 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [
this] {
2023 mLayer->setPlaceOnEveryPart( mCheckPlaceOnEveryPart->isChecked() );
2028 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
2032 mLayer->setTrimDistanceStart( value );
2039 mLayer->setTrimDistanceStartUnit( mTrimDistanceStartUnitWidget->unit() );
2040 mLayer->setTrimDistanceStartMapUnitScale( mTrimDistanceStartUnitWidget->getMapUnitScale() );
2043 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
2047 mLayer->setTrimDistanceEnd( value );
2054 mLayer->setTrimDistanceEndUnit( mTrimDistanceEndUnitWidget->unit() );
2055 mLayer->setTrimDistanceEndMapUnitScale( mTrimDistanceEndUnitWidget->getMapUnitScale() );
2059 switch ( mSymbolType )
2064 mHashLengthUnitWidget->setUnits(
2067 mPlacementLabel->setText( tr(
"Hash placement" ) );
2068 chkRotateMarker->setText( tr(
"Rotate hash to follow line direction" ) );
2069 mSpinOffsetAlongLine->setToolTip( tr(
"Offset hashes in line direction if positive or in opposite line direction if negative" ) );
2070 mHashLengthLabel->setVisible(
true );
2071 mSpinHashLength->setVisible(
true );
2072 mHashLengthUnitWidget->setVisible(
true );
2073 mHashLengthDDBtn->setVisible(
true );
2074 mHashRotationLabel->setVisible(
true );
2075 mHashRotationSpinBox->setVisible(
true );
2076 mHashRotationDDBtn->setVisible(
true );
2081 mPlacementLabel->setText( tr(
"Marker placement" ) );
2082 chkRotateMarker->setText( tr(
"Rotate marker to follow line direction" ) );
2083 mSpinOffsetAlongLine->setToolTip( tr(
"Offset markers in line direction if positive or in opposite line direction if negative" ) );
2084 mHashLengthLabel->setVisible(
false );
2085 mSpinHashLength->setVisible(
false );
2086 mHashLengthUnitWidget->setVisible(
false );
2087 mHashLengthDDBtn->setVisible(
false );
2088 mHashRotationLabel->setVisible(
false );
2089 mHashRotationSpinBox->setVisible(
false );
2090 mHashRotationDDBtn->setVisible(
false );
2105 if (
event->type() == QEvent::Show )
2109 updatePerFeatureCustomizationWidget();
2112 return QgsSymbolLayerWidget::event(
event );
2117 switch ( mSymbolType )
2120 if ( layer->
layerType() !=
"HashLine"_L1 )
2125 if ( layer->
layerType() !=
"MarkerLine"_L1 )
2133 spinInterval->blockSignals(
true );
2134 spinInterval->setValue( mLayer->interval() );
2135 spinInterval->blockSignals(
false );
2136 mSpinOffsetAlongLine->blockSignals(
true );
2137 mSpinOffsetAlongLine->setValue( mLayer->offsetAlongLine() );
2138 mSpinOffsetAlongLine->blockSignals(
false );
2140 chkRotateMarker->blockSignals(
true );
2141 chkRotateMarker->setChecked( mLayer->rotateSymbols() );
2142 chkRotateMarker->blockSignals(
false );
2143 spinOffset->blockSignals(
true );
2144 spinOffset->setValue( mLayer->offset() );
2145 spinOffset->blockSignals(
false );
2147 whileBlocking( mTrimStartDistanceSpin )->setValue( mLayer->trimDistanceStart() );
2148 whileBlocking( mTrimDistanceEndSpin )->setValue( mLayer->trimDistanceEnd() );
2157 whileBlocking( mCheckPlaceOnEveryPart )->setChecked( mLayer->placeOnEveryPart() );
2160 mIntervalUnitWidget->blockSignals(
true );
2161 mIntervalUnitWidget->setUnit( mLayer->intervalUnit() );
2162 mIntervalUnitWidget->
setMapUnitScale( mLayer->intervalMapUnitScale() );
2163 mIntervalUnitWidget->blockSignals(
false );
2164 mOffsetUnitWidget->blockSignals(
true );
2165 mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2166 mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2167 mOffsetUnitWidget->blockSignals(
false );
2168 mOffsetAlongLineUnitWidget->blockSignals(
true );
2169 mOffsetAlongLineUnitWidget->setUnit( mLayer->offsetAlongLineUnit() );
2170 mOffsetAlongLineUnitWidget->setMapUnitScale( mLayer->offsetAlongLineMapUnitScale() );
2171 mOffsetAlongLineUnitWidget->blockSignals(
false );
2172 whileBlocking( mAverageAngleUnit )->setUnit( mLayer->averageAngleUnit() );
2173 whileBlocking( mAverageAngleUnit )->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
2174 whileBlocking( mSpinAverageAngleLength )->setValue( mLayer->averageAngleLength() );
2175 whileBlocking( mBlankSegmentsUnitWidget )->setUnit( mLayer->blankSegmentsUnit() );
2176 whileBlocking( mTrimDistanceStartUnitWidget )->setUnit( mLayer->trimDistanceStartUnit() );
2177 whileBlocking( mTrimDistanceStartUnitWidget )->setMapUnitScale( mLayer->trimDistanceStartMapUnitScale() );
2178 whileBlocking( mTrimDistanceEndUnitWidget )->setUnit( mLayer->trimDistanceEndUnit() );
2179 whileBlocking( mTrimDistanceEndUnitWidget )->setMapUnitScale( mLayer->trimDistanceEndMapUnitScale() );
2181 switch ( mSymbolType )
2199 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
2224 updatePerFeatureCustomizationWidget();
2236 switch (
context.symbolType() )
2241 mRingFilterComboBox->hide();
2242 mRingsLabel->hide();
2253 if ( oldMapTool == mMapToolAddExtraItem.get() )
2254 mMapToolAddExtraItem.reset();
2255 if ( oldMapTool == mMapToolModifyExtraItem.get() )
2256 mMapToolModifyExtraItem.reset();
2257 if ( oldMapTool == mMapToolEditBlankSegments.get() )
2258 mMapToolEditBlankSegments.reset();
2265 mLayer->setInterval( val );
2271 mLayer->setOffsetAlongLine( val );
2275void QgsTemplatedLineSymbolLayerWidget::setHashLength(
double val )
2277 switch ( mSymbolType )
2292void QgsTemplatedLineSymbolLayerWidget::setHashAngle(
double val )
2297 switch ( mSymbolType )
2301 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2312void QgsTemplatedLineSymbolLayerWidget::setRotate()
2314 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2315 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2317 mLayer->setRotateSymbols( chkRotateMarker->isChecked() );
2321void QgsTemplatedLineSymbolLayerWidget::setOffset()
2323 mLayer->setOffset( spinOffset->value() );
2327void QgsTemplatedLineSymbolLayerWidget::setPlacement()
2329 const bool interval = mCheckInterval->isChecked();
2330 spinInterval->setEnabled( interval );
2331 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2332 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2333 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2334 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2335 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2338 if ( mCheckInterval->isChecked() )
2340 if ( mCheckVertex->isChecked() )
2342 if ( mCheckVertexLast->isChecked() )
2344 if ( mCheckVertexFirst->isChecked() )
2346 if ( mCheckCurvePoint->isChecked() )
2348 if ( mCheckSegmentCentralPoint->isChecked() )
2350 if ( mCheckCentralPoint->isChecked() )
2352 mLayer->setPlacements( placements );
2357void QgsTemplatedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2361 mLayer->setIntervalUnit( mIntervalUnitWidget->unit() );
2362 mLayer->setIntervalMapUnitScale( mIntervalUnitWidget->getMapUnitScale() );
2367void QgsTemplatedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2371 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2372 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2377void QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2381 mLayer->setOffsetAlongLineUnit( mOffsetAlongLineUnitWidget->unit() );
2382 mLayer->setOffsetAlongLineMapUnitScale( mOffsetAlongLineUnitWidget->getMapUnitScale() );
2387void QgsTemplatedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2392 switch ( mSymbolType )
2396 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2408void QgsTemplatedLineSymbolLayerWidget::averageAngleUnitChanged()
2412 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
2413 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
2418void QgsTemplatedLineSymbolLayerWidget::blankSegmentsUnitChanged()
2422 mLayer->setBlankSegmentsUnit( mBlankSegmentsUnitWidget->unit() );
2427void QgsTemplatedLineSymbolLayerWidget::setAverageAngle(
double val )
2431 mLayer->setAverageAngleLength( val );
2436void QgsTemplatedLineSymbolLayerWidget::toggleMapToolEditBlankSegments(
bool toggled )
2438 if ( !toggled || ( mMapToolEditBlankSegments.get() &&
context().mapCanvas()->mapTool() == mMapToolEditBlankSegments.get() ) )
2441 switch ( mSymbolType )
2452 mMapToolEditBlankSegments->setAction( mEditBlankSegmentsAction );
2456void QgsTemplatedLineSymbolLayerWidget::toggleMapToolAddExtraItem(
bool toggled )
2458 if ( !toggled || ( mMapToolAddExtraItem.get() &&
context().mapCanvas()->mapTool() == mMapToolAddExtraItem.get() ) )
2461 mMapToolAddExtraItem.reset(
new QgsMapToolAddExtraItem(
context().mapCanvas(),
vectorLayer(), mLayer, mExtraItemsDDBtn ) );
2462 mMapToolAddExtraItem->setAction( mAddExtraItemAction );
2466void QgsTemplatedLineSymbolLayerWidget::toggleMapToolModifyExtraItem(
bool toggled )
2468 if ( !toggled || ( mMapToolModifyExtraItem.get() &&
context().mapCanvas()->mapTool() == mMapToolModifyExtraItem.get() ) )
2471 mMapToolModifyExtraItem.reset(
new QgsMapToolModifyExtraItems(
context().mapCanvas(),
vectorLayer(), mLayer, mExtraItemsDDBtn ) );
2472 mMapToolModifyExtraItem->setAction( mModifyExtraItemAction );
2476void QgsTemplatedLineSymbolLayerWidget::updatePerFeatureCustomizationWidget()
2478 QString tooltipEditBlankSegment = u
"<b>"_s;
2479 QString tooltipAddExtraItem = u
"<b>"_s;
2480 QString tooltipModifyExtraItem = u
"<b>"_s;
2481 switch ( mSymbolType )
2484 tooltipEditBlankSegment += tr(
"Create blank segments where hashed lines won't be displayed" );
2485 tooltipAddExtraItem += tr(
"Add extra hash being displayed with the hashed line" );
2486 tooltipModifyExtraItem += tr(
"Select and modify (move, rotate, delete) extra hashes being displayed with the hashed line" );
2490 tooltipEditBlankSegment += tr(
"Create blank segments where marker lines won't be displayed" );
2491 tooltipAddExtraItem += tr(
"Add extra marker being displayed with the marker line" );
2492 tooltipModifyExtraItem += tr(
"Select and modify (move, rotate, delete) extra markers being displayed with the marker line" );
2496 const QString info = u
"</b><br/>"_s
2498 "First click to select the line you want to operate on. "
2499 "<br/>Press %1 to deselect the line and select another one."
2501 .arg( QKeySequence( QKeySequence::StandardKey::Cancel ).toString( QKeySequence::NativeText ) );
2502 tooltipEditBlankSegment += info;
2503 tooltipAddExtraItem += info;
2504 tooltipModifyExtraItem += info;
2506 bool enabled =
true;
2510 const QString accessFromDialog = 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." );
2511 tooltipEditBlankSegment += u
"<br/><br/>"_s + accessFromDialog;
2512 tooltipAddExtraItem += u
"<br/><br/>"_s + accessFromDialog;
2513 tooltipModifyExtraItem += u
"<br/><br/>"_s + accessFromDialog;
2518 mEditBlankSegmentsAction->setEnabled( enabled );
2519 mAddExtraItemAction->setEnabled( enabled );
2520 mModifyExtraItemAction->setEnabled( enabled );
2522 mEditBlankSegmentsAction->setToolTip( tooltipEditBlankSegment );
2523 mAddExtraItemAction->setToolTip( tooltipAddExtraItem );
2524 mModifyExtraItemAction->setToolTip( tooltipModifyExtraItem );
2557 mSvgSelectorWidget->setAllowParameters(
true );
2558 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2559 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( u
"/UI/lastSVGMarkerDir"_s );
2560 mSvgSelectorWidget->initParametersModel(
this, vl );
2564 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2565 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2569 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2570 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2571 mSizeUnitWidget->setUnits(
2574 mStrokeWidthUnitWidget->setUnits(
2577 mOffsetUnitWidget->setUnits(
2580 mChangeColorButton->setAllowOpacity(
true );
2581 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2582 mChangeColorButton->setContext( u
"symbology"_s );
2583 mChangeStrokeColorButton->setAllowOpacity(
true );
2584 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2585 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2587 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2588 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2590 spinOffsetX->setClearValue( 0.0 );
2591 spinOffsetY->setClearValue( 0.0 );
2592 spinAngle->setClearValue( 0.0 );
2594 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2595 connect( spinHeight,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2597 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2598 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2599 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2606 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
2610 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2611 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2618#include <QAbstractListModel>
2619#include <QPixmapCache>
2632 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2633 QColor defaultFill, defaultStroke;
2634 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2635 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2639 hasDefaultFillColor,
2641 hasFillOpacityParam,
2642 hasDefaultFillOpacity,
2645 hasDefaultStrokeColor,
2647 hasStrokeWidthParam,
2648 hasDefaultStrokeWidth,
2650 hasStrokeOpacityParam,
2651 hasDefaultStrokeOpacity,
2652 defaultStrokeOpacity
2654 mChangeColorButton->setEnabled( hasFillParam );
2655 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2656 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2657 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2658 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2663 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2664 if ( hasDefaultFillColor && !skipDefaultColors )
2668 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2669 mChangeColorButton->setColor( fill );
2671 if ( hasStrokeParam )
2674 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2675 if ( hasDefaultStrokeColor && !skipDefaultColors )
2677 stroke = defaultStroke;
2679 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2680 mChangeStrokeColorButton->setColor( stroke );
2683 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2685 mStrokeWidthSpinBox->blockSignals(
true );
2686 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2687 mStrokeWidthSpinBox->blockSignals(
false );
2690 spinHeight->blockSignals(
true );
2691 if ( preservedAspectRatio )
2700 spinHeight->blockSignals(
false );
2701 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2704void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2706 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
2708 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2710 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
2713 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2724 if ( layer->
layerType() !=
"SvgMarker"_L1 )
2731 mSvgSelectorWidget->setSvgPath(
mLayer->path() );
2732 mSvgSelectorWidget->setSvgParameters(
mLayer->parameters() );
2734 spinWidth->blockSignals(
true );
2735 spinWidth->setValue(
mLayer->size() );
2736 spinWidth->blockSignals(
false );
2737 spinAngle->blockSignals(
true );
2738 spinAngle->setValue(
mLayer->angle() );
2739 spinAngle->blockSignals(
false );
2742 spinOffsetX->blockSignals(
true );
2743 spinOffsetX->setValue(
mLayer->offset().x() );
2744 spinOffsetX->blockSignals(
false );
2745 spinOffsetY->blockSignals(
true );
2746 spinOffsetY->setValue(
mLayer->offset().y() );
2747 spinOffsetY->blockSignals(
false );
2749 mSizeUnitWidget->blockSignals(
true );
2750 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
2752 mSizeUnitWidget->blockSignals(
false );
2753 mStrokeWidthUnitWidget->blockSignals(
true );
2754 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
2755 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
2756 mStrokeWidthUnitWidget->blockSignals(
false );
2757 mOffsetUnitWidget->blockSignals(
true );
2758 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
2759 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
2760 mOffsetUnitWidget->blockSignals(
false );
2763 mHorizontalAnchorComboBox->blockSignals(
true );
2764 mVerticalAnchorComboBox->blockSignals(
true );
2765 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
2766 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
2767 mHorizontalAnchorComboBox->blockSignals(
false );
2768 mVerticalAnchorComboBox->blockSignals(
false );
2784 updateAssistantSymbol();
2795 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2801 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2809 mLayer->setParameters( parameters );
2810 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2816void QgsSvgMarkerSymbolLayerWidget::setWidth()
2819 double fixedAspectRatio = 0.0;
2820 spinHeight->blockSignals(
true );
2821 if ( defaultAspectRatio <= 0.0 )
2823 spinHeight->setValue( spinWidth->value() );
2825 else if ( mLockAspectRatio->locked() )
2827 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2831 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2833 spinHeight->blockSignals(
false );
2834 mLayer->setSize( spinWidth->value() );
2835 mLayer->setFixedAspectRatio( fixedAspectRatio );
2839void QgsSvgMarkerSymbolLayerWidget::setHeight()
2841 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2842 double fixedAspectRatio = 0.0;
2843 spinWidth->blockSignals(
true );
2844 if ( defaultAspectRatio <= 0.0 )
2846 spinWidth->setValue( spinHeight->value() );
2848 else if ( mLockAspectRatio->locked() )
2850 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2854 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2856 spinWidth->blockSignals(
false );
2857 mLayer->setSize( spinWidth->value() );
2858 mLayer->setFixedAspectRatio( fixedAspectRatio );
2862void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2865 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2866 if ( defaultAspectRatio <= 0.0 )
2872 mLayer->setFixedAspectRatio( 0.0 );
2877 mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
2882void QgsSvgMarkerSymbolLayerWidget::setAngle()
2884 mLayer->setAngle( spinAngle->value() );
2888void QgsSvgMarkerSymbolLayerWidget::setOffset()
2890 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2894void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2901void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2908 mLayer->setFillColor( color );
2912void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2919 mLayer->setStrokeColor( color );
2923void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2927 mLayer->setStrokeWidth( d );
2932void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2936 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
2937 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
2942void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2946 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
2947 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
2952void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2956 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2957 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2962void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
2971void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
2988 mSvgSelectorWidget->setAllowParameters(
true );
2989 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2991 connect( mTextureWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2993 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2995 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2996 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2999 mTextureWidthUnitWidget->setUnits(
3002 mSvgStrokeWidthUnitWidget->setUnits(
3006 mRotationSpinBox->setClearValue( 0.0 );
3008 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
3009 mChangeColorButton->setContext( u
"symbology"_s );
3010 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
3011 mChangeStrokeColorButton->setContext( u
"symbology"_s );
3013 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
3014 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
3027 if ( layer->
layerType() !=
"SVGFill"_L1 )
3035 const double width =
mLayer->patternWidth();
3036 mTextureWidthSpinBox->blockSignals(
true );
3037 mTextureWidthSpinBox->setValue( width );
3038 mTextureWidthSpinBox->blockSignals(
false );
3039 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource(
mLayer->svgFilePath() );
3040 mRotationSpinBox->blockSignals(
true );
3041 mRotationSpinBox->setValue(
mLayer->angle() );
3042 mRotationSpinBox->blockSignals(
false );
3043 mTextureWidthUnitWidget->blockSignals(
true );
3044 mTextureWidthUnitWidget->setUnit(
mLayer->patternWidthUnit() );
3045 mTextureWidthUnitWidget->setMapUnitScale(
mLayer->patternWidthMapUnitScale() );
3046 mTextureWidthUnitWidget->blockSignals(
false );
3047 mSvgStrokeWidthUnitWidget->blockSignals(
true );
3048 mSvgStrokeWidthUnitWidget->setUnit(
mLayer->svgStrokeWidthUnit() );
3049 mSvgStrokeWidthUnitWidget->setMapUnitScale(
mLayer->svgStrokeWidthMapUnitScale() );
3050 mSvgStrokeWidthUnitWidget->blockSignals(
false );
3051 mChangeColorButton->blockSignals(
true );
3052 mChangeColorButton->setColor(
mLayer->svgFillColor() );
3053 mChangeColorButton->blockSignals(
false );
3054 mChangeStrokeColorButton->blockSignals(
true );
3055 mChangeStrokeColorButton->setColor(
mLayer->svgStrokeColor() );
3056 mChangeStrokeColorButton->blockSignals(
false );
3057 mStrokeWidthSpinBox->blockSignals(
true );
3058 mStrokeWidthSpinBox->setValue(
mLayer->svgStrokeWidth() );
3059 mStrokeWidthSpinBox->blockSignals(
false );
3080 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
3083void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
3092void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
3099 mLayer->setSvgFilePath( text );
3104void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
3106 mLayer->setSvgFilePath( name );
3107 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
3113void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
3115 mLayer->setParameters( parameters );
3116 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
3123void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
3135 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
3136 QColor defaultFill, defaultStroke;
3137 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
3138 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
3140 mSvgSelectorWidget->sourceLineEdit()->source(),
3142 hasDefaultFillColor,
3144 hasFillOpacityParam,
3145 hasDefaultFillOpacity,
3148 hasDefaultStrokeColor,
3150 hasStrokeWidthParam,
3151 hasDefaultStrokeWidth,
3153 hasStrokeOpacityParam,
3154 hasDefaultStrokeOpacity,
3155 defaultStrokeOpacity
3159 QColor fill = mChangeColorButton->color();
3160 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
3161 if ( hasDefaultFillColor )
3165 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
3166 mChangeColorButton->setColor( fill );
3168 mChangeColorButton->setEnabled( hasFillParam );
3169 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
3172 QColor stroke = mChangeStrokeColorButton->color();
3173 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
3174 if ( hasDefaultStrokeColor )
3176 stroke = defaultStroke;
3178 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
3179 mChangeStrokeColorButton->setColor( stroke );
3181 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
3182 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
3183 if ( hasDefaultStrokeWidth && resetValues )
3185 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
3187 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
3190void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
3197 mLayer->setSvgFillColor( color );
3201void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
3208 mLayer->setSvgStrokeColor( color );
3212void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3216 mLayer->setSvgStrokeWidth( d );
3221void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
3225 mLayer->setPatternWidthUnit( mTextureWidthUnitWidget->unit() );
3226 mLayer->setPatternWidthMapUnitScale( mTextureWidthUnitWidget->getMapUnitScale() );
3231void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3235 mLayer->setSvgStrokeWidthUnit( mSvgStrokeWidthUnitWidget->unit() );
3236 mLayer->setSvgStrokeWidthMapUnitScale( mSvgStrokeWidthUnitWidget->getMapUnitScale() );
3247 connect( mAngleSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3248 connect( mDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3249 connect( mOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3252 mDistanceUnitWidget->setUnits(
3255 mOffsetUnitWidget->setUnits(
3265 mOffsetSpinBox->setClearValue( 0 );
3266 mAngleSpinBox->setClearValue( 0 );
3270 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3281 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3292 if ( layer->
layerType() !=
"LinePatternFill"_L1 )
3306 mDistanceUnitWidget->blockSignals(
true );
3307 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
3309 mDistanceUnitWidget->blockSignals(
false );
3310 mOffsetUnitWidget->blockSignals(
true );
3311 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3312 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3313 mOffsetUnitWidget->blockSignals(
false );
3315 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3317 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3331void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3340void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3344 mLayer->setDistance( d );
3349void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3358void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3362 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
3363 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
3368void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3372 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3373 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3384 connect( mHorizontalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3385 connect( mVerticalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3386 connect( mHorizontalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3387 connect( mVerticalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3388 connect( mHorizontalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3389 connect( mVerticalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3390 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3391 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3392 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3393 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3394 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3395 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3396 mHorizontalDistanceUnitWidget->setUnits(
3399 mVerticalDistanceUnitWidget->setUnits(
3402 mHorizontalDisplacementUnitWidget->setUnits(
3412 mVerticalDisplacementUnitWidget->setUnits(
3422 mHorizontalOffsetUnitWidget->setUnits(
3432 mVerticalOffsetUnitWidget->setUnits(
3447 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3457 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3465 mSeedSpinBox->setShowClearButton(
true );
3466 mSeedSpinBox->setClearValue( 0 );
3467 mRandomXSpinBox->setClearValue( 0 );
3468 mRandomYSpinBox->setClearValue( 0 );
3470 mRandomXOffsetUnitWidget->setUnits(
3480 mRandomYOffsetUnitWidget->setUnits(
3490 connect( mRandomXSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3493 mLayer->setMaximumRandomDeviationX( d );
3497 connect( mRandomYSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3500 mLayer->setMaximumRandomDeviationY( d );
3507 mLayer->setRandomDeviationXUnit( mRandomXOffsetUnitWidget->unit() );
3508 mLayer->setRandomDeviationXMapUnitScale( mRandomXOffsetUnitWidget->getMapUnitScale() );
3515 mLayer->setRandomDeviationYUnit( mRandomYOffsetUnitWidget->unit() );
3516 mLayer->setRandomDeviationYMapUnitScale( mRandomYOffsetUnitWidget->getMapUnitScale() );
3520 connect( mSeedSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [
this](
int v ) {
3528 mAngleSpinBox->setShowClearButton(
true );
3529 mAngleSpinBox->setClearValue( 0 );
3530 connect( mAngleSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3541 if ( !layer || layer->
layerType() !=
"PointPatternFill"_L1 )
3555 mHorizontalDistanceUnitWidget->blockSignals(
true );
3556 mHorizontalDistanceUnitWidget->setUnit(
mLayer->distanceXUnit() );
3558 mHorizontalDistanceUnitWidget->blockSignals(
false );
3559 mVerticalDistanceUnitWidget->blockSignals(
true );
3560 mVerticalDistanceUnitWidget->setUnit(
mLayer->distanceYUnit() );
3561 mVerticalDistanceUnitWidget->setMapUnitScale(
mLayer->distanceYMapUnitScale() );
3562 mVerticalDistanceUnitWidget->blockSignals(
false );
3563 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3564 mHorizontalDisplacementUnitWidget->setUnit(
mLayer->displacementXUnit() );
3565 mHorizontalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementXMapUnitScale() );
3566 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3567 mVerticalDisplacementUnitWidget->blockSignals(
true );
3568 mVerticalDisplacementUnitWidget->setUnit(
mLayer->displacementYUnit() );
3569 mVerticalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementYMapUnitScale() );
3570 mVerticalDisplacementUnitWidget->blockSignals(
false );
3571 mHorizontalOffsetUnitWidget->blockSignals(
true );
3572 mHorizontalOffsetUnitWidget->setUnit(
mLayer->offsetXUnit() );
3573 mHorizontalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetXMapUnitScale() );
3574 mHorizontalOffsetUnitWidget->blockSignals(
false );
3575 mVerticalOffsetUnitWidget->blockSignals(
true );
3576 mVerticalOffsetUnitWidget->setUnit(
mLayer->offsetYUnit() );
3577 mVerticalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetYMapUnitScale() );
3578 mVerticalOffsetUnitWidget->blockSignals(
false );
3580 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3581 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3586 whileBlocking( mRandomXOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationXMapUnitScale() );
3588 whileBlocking( mRandomYOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationYMapUnitScale() );
3610void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3619void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3623 mLayer->setDistanceY( d );
3628void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3632 mLayer->setDisplacementX( d );
3637void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3641 mLayer->setDisplacementY( d );
3646void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3655void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3664void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3668 mLayer->setDistanceXUnit( mHorizontalDistanceUnitWidget->unit() );
3669 mLayer->setDistanceXMapUnitScale( mHorizontalDistanceUnitWidget->getMapUnitScale() );
3674void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3678 mLayer->setDistanceYUnit( mVerticalDistanceUnitWidget->unit() );
3679 mLayer->setDistanceYMapUnitScale( mVerticalDistanceUnitWidget->getMapUnitScale() );
3684void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3688 mLayer->setDisplacementXUnit( mHorizontalDisplacementUnitWidget->unit() );
3689 mLayer->setDisplacementXMapUnitScale( mHorizontalDisplacementUnitWidget->getMapUnitScale() );
3694void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3698 mLayer->setDisplacementYUnit( mVerticalDisplacementUnitWidget->unit() );
3699 mLayer->setDisplacementYMapUnitScale( mVerticalDisplacementUnitWidget->getMapUnitScale() );
3704void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3708 mLayer->setOffsetXUnit( mHorizontalOffsetUnitWidget->unit() );
3709 mLayer->setOffsetXMapUnitScale( mHorizontalOffsetUnitWidget->getMapUnitScale() );
3714void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3718 mLayer->setOffsetYUnit( mVerticalOffsetUnitWidget->unit() );
3719 mLayer->setOffsetYMapUnitScale( mVerticalOffsetUnitWidget->getMapUnitScale() );
3745 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3746 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3747 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3748 mSizeUnitWidget->setUnits(
3751 mStrokeWidthUnitWidget->setUnits(
3754 mOffsetUnitWidget->setUnits(
3760 scrollArea->setVerticalOnly(
true );
3762 btnColor->setAllowOpacity(
true );
3763 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3764 btnColor->setContext( u
"symbology"_s );
3765 btnStrokeColor->setAllowOpacity(
true );
3766 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3767 btnStrokeColor->setContext( u
"symbology"_s );
3769 mColorDDBtn->registerLinkedWidget( btnColor );
3770 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3772 spinOffsetX->setClearValue( 0.0 );
3773 spinOffsetY->setClearValue( 0.0 );
3774 spinAngle->setClearValue( 0.0 );
3777 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
3780 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3783 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3785 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3788 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3790 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3791 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3802 if ( layer->
layerType() !=
"FontMarker"_L1 )
3811 mFontStyleComboBox->blockSignals(
true );
3812 populateFontStyleComboBox();
3813 mFontStyleComboBox->blockSignals(
false );
3825 if (
mLayer->character().length() == 1 )
3831 mCharPreview->setFont( mRefFont );
3837 mSizeUnitWidget->blockSignals(
true );
3838 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3839 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3840 mSizeUnitWidget->blockSignals(
false );
3842 mStrokeWidthUnitWidget->blockSignals(
true );
3843 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
3844 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
3845 mStrokeWidthUnitWidget->blockSignals(
false );
3847 mOffsetUnitWidget->blockSignals(
true );
3848 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3849 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3850 mOffsetUnitWidget->blockSignals(
false );
3855 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3856 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3871 updateAssistantSymbol();
3883 mLayer->setFontFamily( font.family() );
3886 mCharPreview->setFont( mRefFont );
3887 populateFontStyleComboBox();
3892void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3899 mCharPreview->setFont( mRefFont );
3906 mLayer->setColor( color );
3912 mLayer->setStrokeColor( color );
3925 mLayer->setAngle( angle );
3931 mCharPreview->setText( text );
3933 if ( text.isEmpty() )
3937 QString character = text;
3938 if ( text.contains( QRegularExpression( u
"^0x[0-9a-fA-F]{1,4}$"_s ) ) )
3941 const unsigned int value = text.toUInt( &ok, 0 );
3944 character = QChar( value );
3945 mCharPreview->setText( character );
3949 if ( character !=
mLayer->character() )
3951 mLayer->setCharacter( character );
3952 if (
mLayer->character().length() == 1 )
3966 if (
mLayer->character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3968 mCharLineEdit->insert( chr );
3972 mLayer->setCharacter( chr );
3974 mCharPreview->setText( chr );
3978void QgsFontMarkerSymbolLayerWidget::setOffset()
3980 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3984void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3986 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
3990void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3994 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
3995 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4000void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4004 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4005 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4010void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
4014 mLayer->setStrokeWidthUnit( mSizeUnitWidget->unit() );
4015 mLayer->setStrokeWidthMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4020void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
4022 mFontStyleComboBox->clear();
4023 const QStringList styles = mFontDB.styles( mRefFont.family() );
4024 const auto constStyles = styles;
4025 for (
const QString &style : constStyles )
4027 mFontStyleComboBox->addItem( style );
4030 QString targetStyle = mFontDB.styleString( mRefFont );
4031 if ( !styles.contains( targetStyle ) )
4034 targetStyle = QFontInfo( f ).styleName();
4035 mRefFont.setStyleName( targetStyle );
4038 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
4039 if ( stylIndx > -1 )
4044 mFontStyleComboBox->setCurrentIndex( curIndx );
4047void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
4050 setFontStyle( mFontStyleComboBox->currentText() );
4053void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4062void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4071void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
4075 mLayer->setStrokeWidth( d );
4080void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
4082 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
4084 mAssistantPreviewSymbol->deleteSymbolLayer( i );
4086 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
4089 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
4101 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
4102 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
4103 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
4104 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
4109 if ( layer->
layerType() !=
"CentroidFill"_L1 )
4119 whileBlocking( mClipOnCurrentPartOnlyCheckBox )->setChecked(
mLayer->clipOnCurrentPartOnly() );
4127void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
4133void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
4135 mLayer->setPointOnAllParts( state == Qt::Checked );
4139void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
4141 mLayer->setClipPoints( state == Qt::Checked );
4145void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
4147 mLayer->setClipOnCurrentPartOnly( state == Qt::Checked );
4168 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4172 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
4174 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
4175 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
4178 mSizeUnitWidget->setUnits(
4188 mOffsetUnitWidget->setUnits(
4192 mSpinOffsetX->setClearValue( 0.0 );
4193 mSpinOffsetY->setClearValue( 0.0 );
4194 mRotationSpinBox->setClearValue( 0.0 );
4196 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4197 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4200 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4201 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4211 if ( layer->
layerType() !=
"RasterMarker"_L1 )
4221 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4222 mHeightSpinBox->blockSignals(
true );
4223 if ( preservedAspectRatio )
4225 mHeightSpinBox->setValue(
mLayer->size() );
4229 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4231 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4232 mHeightSpinBox->blockSignals(
false );
4233 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4241 mSizeUnitWidget->blockSignals(
true );
4242 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4243 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4244 mSizeUnitWidget->blockSignals(
false );
4245 mOffsetUnitWidget->blockSignals(
true );
4246 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4247 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4248 mOffsetUnitWidget->blockSignals(
false );
4251 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4252 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4263 updatePreviewImage();
4274 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4277void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4280 updatePreviewImage();
4284void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
4286 bool fitsInCache =
false;
4288 if ( image.isNull() )
4290 mLabelImagePreview->setPixmap( QPixmap() );
4294 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4295 previewImage.fill( Qt::transparent );
4296 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4298 p.begin( &previewImage );
4300 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4301 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4302 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4303 QBrush checkerBrush;
4304 checkerBrush.setTexture( pix );
4305 p.fillRect( imageRect, checkerBrush );
4307 if (
mLayer->opacity() < 1.0 )
4309 p.setOpacity(
mLayer->opacity() );
4312 p.drawImage( imageRect.left(), imageRect.top(), image );
4314 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4317void QgsRasterMarkerSymbolLayerWidget::setWidth()
4319 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4320 double fixedAspectRatio = 0.0;
4321 mHeightSpinBox->blockSignals(
true );
4322 if ( defaultAspectRatio <= 0.0 )
4324 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4326 else if ( mLockAspectRatio->locked() )
4328 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4332 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4334 mHeightSpinBox->blockSignals(
false );
4335 mLayer->setSize( mWidthSpinBox->value() );
4336 mLayer->setFixedAspectRatio( fixedAspectRatio );
4340void QgsRasterMarkerSymbolLayerWidget::setHeight()
4342 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4343 double fixedAspectRatio = 0.0;
4344 mWidthSpinBox->blockSignals(
true );
4345 if ( defaultAspectRatio <= 0.0 )
4347 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4349 else if ( mLockAspectRatio->locked() )
4351 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4355 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4357 mWidthSpinBox->blockSignals(
false );
4358 mLayer->setSize( mWidthSpinBox->value() );
4359 mLayer->setFixedAspectRatio( fixedAspectRatio );
4363void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4365 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4366 if ( defaultAspectRatio <= 0.0 )
4372 mLayer->setFixedAspectRatio( 0.0 );
4377 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4381void QgsRasterMarkerSymbolLayerWidget::setAngle()
4383 mLayer->setAngle( mRotationSpinBox->value() );
4387void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4389 mLayer->setOpacity( value );
4391 updatePreviewImage();
4394void QgsRasterMarkerSymbolLayerWidget::setOffset()
4396 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4400void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4404 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4405 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4410void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4414 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4415 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4420void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4429void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4456 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastAnimatedMarkerImageDir"_s );
4460 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4462 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4463 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4466 mFrameRateSpin->setClearValue( 10 );
4467 mFrameRateSpin->setShowClearButton(
true );
4468 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
4469 mLayer->setFrameRate( value );
4473 mSizeUnitWidget->setUnits(
4483 mOffsetUnitWidget->setUnits(
4487 mSpinOffsetX->setClearValue( 0.0 );
4488 mSpinOffsetY->setClearValue( 0.0 );
4489 mRotationSpinBox->setClearValue( 0.0 );
4491 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4492 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4495 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4496 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4506 if ( layer->
layerType() !=
"AnimatedMarker"_L1 )
4516 if ( firstFrameTime > 0 )
4518 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4522 mFrameRateSpin->setClearValue( 10 );
4526 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4527 mHeightSpinBox->blockSignals(
true );
4528 if ( preservedAspectRatio )
4530 mHeightSpinBox->setValue(
mLayer->size() );
4534 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4536 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4537 mHeightSpinBox->blockSignals(
false );
4538 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4548 mSizeUnitWidget->blockSignals(
true );
4549 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4550 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4551 mSizeUnitWidget->blockSignals(
false );
4552 mOffsetUnitWidget->blockSignals(
true );
4553 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4554 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4555 mOffsetUnitWidget->blockSignals(
false );
4558 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4559 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4570 updatePreviewImage();
4581 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4584void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4589 if ( firstFrameTime > 0 )
4591 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4595 mFrameRateSpin->setClearValue( 10 );
4597 updatePreviewImage();
4601void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4603 if ( mPreviewMovie )
4605 mLabelImagePreview->setMovie(
nullptr );
4606 mPreviewMovie->deleteLater();
4607 mPreviewMovie =
nullptr;
4610 mPreviewMovie =
new QMovie(
mLayer->path(), QByteArray(),
this );
4611 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4612 mLabelImagePreview->setMovie( mPreviewMovie );
4613 mPreviewMovie->start();
4616void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4618 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4619 double fixedAspectRatio = 0.0;
4620 mHeightSpinBox->blockSignals(
true );
4621 if ( defaultAspectRatio <= 0.0 )
4623 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4625 else if ( mLockAspectRatio->locked() )
4627 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4631 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4633 mHeightSpinBox->blockSignals(
false );
4634 mLayer->setSize( mWidthSpinBox->value() );
4635 mLayer->setFixedAspectRatio( fixedAspectRatio );
4639void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4641 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4642 double fixedAspectRatio = 0.0;
4643 mWidthSpinBox->blockSignals(
true );
4644 if ( defaultAspectRatio <= 0.0 )
4646 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4648 else if ( mLockAspectRatio->locked() )
4650 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4654 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4656 mWidthSpinBox->blockSignals(
false );
4657 mLayer->setSize( mWidthSpinBox->value() );
4658 mLayer->setFixedAspectRatio( fixedAspectRatio );
4662void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4664 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4665 if ( defaultAspectRatio <= 0.0 )
4671 mLayer->setFixedAspectRatio( 0.0 );
4676 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4680void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4682 mLayer->setAngle( mRotationSpinBox->value() );
4686void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4688 mLayer->setOpacity( value );
4690 updatePreviewImage();
4693void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4695 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4699void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4703 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4704 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4709void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4713 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4714 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4719void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4728void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4745 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4749 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4756 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4757 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4760 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4769 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4778 mSizeUnitWidget->setUnits(
4788 mOffsetUnitWidget->setUnits(
4792 mSpinOffsetX->setClearValue( 0.0 );
4793 mSpinOffsetY->setClearValue( 0.0 );
4794 mRotationSpinBox->setClearValue( 0.0 );
4796 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4797 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4798 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4810 if ( layer->
layerType() !=
"RasterFill"_L1 )
4823 cboCoordinateMode->blockSignals(
true );
4824 switch (
mLayer->coordinateMode() )
4827 cboCoordinateMode->setCurrentIndex( 1 );
4831 cboCoordinateMode->setCurrentIndex( 0 );
4834 cboCoordinateMode->blockSignals(
false );
4840 mOffsetUnitWidget->blockSignals(
true );
4841 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4842 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4843 mOffsetUnitWidget->blockSignals(
false );
4846 mSizeUnitWidget->blockSignals(
true );
4847 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4848 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4849 mSizeUnitWidget->blockSignals(
false );
4853 updatePreviewImage();
4868void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4871 updatePreviewImage();
4875void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4892void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4899 mLayer->setOpacity( value );
4901 updatePreviewImage();
4904void QgsRasterFillSymbolLayerWidget::offsetChanged()
4906 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4910void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4916 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4917 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4921void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4930void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4932 bool fitsInCache =
false;
4934 if ( image.isNull() )
4936 mLabelImagePreview->setPixmap( QPixmap() );
4940 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4941 previewImage.fill( Qt::transparent );
4942 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4944 p.begin( &previewImage );
4946 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4947 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4948 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4949 QBrush checkerBrush;
4950 checkerBrush.setTexture( pix );
4951 p.fillRect( imageRect, checkerBrush );
4953 if (
mLayer->opacity() < 1.0 )
4955 p.setOpacity(
mLayer->opacity() );
4958 p.drawImage( imageRect.left(), imageRect.top(), image );
4960 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4974 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4976 mPenWidthUnitWidget->setUnits(
4979 mOffsetUnitWidget->setUnits(
4986 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
4987 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
4992 connect( spinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
4995 mLayer->setWidth( spinWidth->value() );
5003 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5004 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5010 spinOffset->setClearValue( 0.0 );
5011 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5014 mLayer->setOffset( val );
5019 connect( cboCapStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5022 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5026 connect( cboJoinStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5029 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5038 mLayer->setOpacity( opacity );
5039 updatePreviewImage();
5052 if ( layer->
layerType() !=
"RasterLine"_L1 )
5076 updatePreviewImage();
5091void QgsRasterLineSymbolLayerWidget::imageSourceChanged(
const QString &text )
5094 updatePreviewImage();
5098void QgsRasterLineSymbolLayerWidget::updatePreviewImage()
5100 bool fitsInCache =
false;
5102 if ( image.isNull() )
5104 mLabelImagePreview->setPixmap( QPixmap() );
5108 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
5109 previewImage.fill( Qt::transparent );
5110 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
5112 p.begin( &previewImage );
5114 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
5115 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
5116 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
5117 QBrush checkerBrush;
5118 checkerBrush.setTexture( pix );
5119 p.fillRect( imageRect, checkerBrush );
5121 if (
mLayer->opacity() < 1.0 )
5123 p.setOpacity(
mLayer->opacity() );
5126 p.drawImage( imageRect.left(), imageRect.top(), image );
5128 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
5141 modificationExpressionSelector->setMultiLine(
true );
5142 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
5143 modificationExpressionSelector->registerExpressionContextGenerator(
this );
5149 mUnitWidget->setShowMapScaleButton(
false );
5152 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
5154 if ( !mBlockSignals )
5156 mLayer->setUnits( mUnitWidget->unit() );
5166 modificationExpressionSelector->setExpression( mLayer->geometryExpression() );
5167 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData(
static_cast<int>( mLayer->symbolType() ) ) );
5168 mUnitWidget->setUnit( mLayer->units() );
5177void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
5184void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
5187 std::unique_ptr<QgsSymbol> subSymbol( mLayer->subSymbol()->clone() );
5189 mLayer->setSymbolType(
static_cast<Qgis::SymbolType>( cbxGeometryType->currentData().toInt() ) );
5191 switch ( mLayer->symbolType() )
5202 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5204 if (
dynamic_cast<const QgsLineSymbolLayer *
>( subSymbol->symbolLayer( i ) ) )
5205 layers << subSymbol->symbolLayer( i )->clone();
5208 if ( !layers.empty() )
5209 mLayer->setSubSymbol(
new QgsLineSymbol( layers ) );
5218 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5219 layers << subSymbol->symbolLayer( i )->clone();
5220 mLayer->setSubSymbol(
new QgsFillSymbol( layers ) );
5241 mPointCountSpinBox->setShowClearButton(
true );
5242 mPointCountSpinBox->setClearValue( 100 );
5243 mSeedSpinBox->setShowClearButton(
true );
5244 mSeedSpinBox->setClearValue( 0 );
5246 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
5247 connect( mPointCountSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
5248 connect( mDensityAreaSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
5249 connect( mSeedSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
5250 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5253 mLayer->setClipPoints( checked );
5258 mDensityAreaUnitWidget->setUnits(
5267 if ( !layer || layer->
layerType() !=
"RandomMarkerFill"_L1 )
5273 whileBlocking( mPointCountSpinBox )->setValue( mLayer->pointCount() );
5275 whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
5277 bool showDensityBasedCountWidgets =
false;
5278 switch ( mLayer->countMethod() )
5281 showDensityBasedCountWidgets =
true;
5286 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5287 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5288 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5289 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5291 whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData(
static_cast<int>( mLayer->countMethod() ) ) );
5292 whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
5293 mDensityAreaUnitWidget->blockSignals(
true );
5294 mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
5295 mDensityAreaUnitWidget->
setMapUnitScale( mLayer->densityAreaUnitScale() );
5296 mDensityAreaUnitWidget->blockSignals(
false );
5309void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
5311 bool showDensityBasedCountWidgets =
false;
5315 showDensityBasedCountWidgets =
true;
5320 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5321 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5322 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5323 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5327 mLayer->setCountMethod(
static_cast<Qgis::PointCountMethod>( mCountMethodComboBox->currentData().toInt() ) );
5332void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
5336 mLayer->setPointCount( d );
5341void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
5345 mLayer->setDensityArea( d );
5350void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
5354 mLayer->setDensityAreaUnit( mDensityAreaUnitWidget->unit() );
5355 mLayer->setDensityAreaUnitScale( mDensityAreaUnitWidget->getMapUnitScale() );
5360void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
5364 mLayer->setSeed( d );
5379 btnColorRamp->setShowGradientOnly(
true );
5381 btnChangeColor->setAllowOpacity(
true );
5382 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5383 btnChangeColor->setContext( u
"symbology"_s );
5384 btnChangeColor->setShowNoColor(
true );
5385 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
5386 btnChangeColor2->setAllowOpacity(
true );
5387 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5388 btnChangeColor2->setContext( u
"symbology"_s );
5389 btnChangeColor2->setShowNoColor(
true );
5390 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
5392 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
5393 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
5398 mLayer->setColor( color );
5405 mLayer->setColor2( color );
5410 if ( btnColorRamp->isNull() )
5415 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
5420 connect( radioTwoColor, &QAbstractButton::toggled,
this, [
this] {
5423 if ( radioTwoColor->isChecked() )
5426 btnChangeColor->setEnabled(
true );
5427 btnChangeColor2->setEnabled(
true );
5428 btnColorRamp->setEnabled(
false );
5433 btnColorRamp->setEnabled(
true );
5434 btnChangeColor->setEnabled(
false );
5435 btnChangeColor2->setEnabled(
false );
5441 mPenWidthUnitWidget->setUnits(
5444 mOffsetUnitWidget->setUnits(
5451 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5452 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5457 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5460 mLayer->setWidth( spinWidth->value() );
5468 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5469 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5474 spinOffset->setClearValue( 0.0 );
5475 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5478 mLayer->setOffset( val );
5483 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5486 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5490 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5493 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5506 if ( layer->
layerType() !=
"Lineburst"_L1 )
5517 btnChangeColor->blockSignals(
true );
5519 btnChangeColor->blockSignals(
false );
5520 btnChangeColor2->blockSignals(
true );
5521 btnChangeColor2->setColor(
mLayer->color2() );
5522 btnChangeColor2->blockSignals(
false );
5526 radioTwoColor->setChecked(
true );
5527 btnColorRamp->setEnabled(
false );
5531 radioColorRamp->setChecked(
true );
5532 btnChangeColor->setEnabled(
false );
5533 btnChangeColor2->setEnabled(
false );
5537 if (
mLayer->colorRamp() )
5539 btnColorRamp->blockSignals(
true );
5540 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
5541 btnColorRamp->blockSignals(
false );
5578 mPenWidthUnitWidget->setUnits(
5581 mOffsetUnitWidget->setUnits(
5588 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5589 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5594 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5597 mLayer->setWidth( spinWidth->value() );
5605 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5606 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5611 spinOffset->setClearValue( 0.0 );
5612 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5615 mLayer->setOffset( val );
5620 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5623 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5627 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5630 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5645 if ( layer->
layerType() !=
"FilledLine"_L1 )
5657 whileBlocking( mPenWidthUnitWidget )->setUnit( mLayer->widthUnit() );
5660 whileBlocking( mOffsetUnitWidget )->setUnit( mLayer->offsetUnit() );
5661 whileBlocking( mOffsetUnitWidget )->setMapUnitScale( mLayer->offsetMapUnitScale() );
5664 whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
5665 whileBlocking( cboCapStyle )->setPenCapStyle( mLayer->penCapStyle() );
5698 mSpinSkipMultiples->setClearValue( 0, tr(
"Not set" ) );
5699 mSpinLabelOffsetX->setClearValue( 0 );
5700 mSpinLabelOffsetY->setClearValue( 0 );
5701 mSpinAverageAngleLength->setClearValue( 4.0 );
5702 mLabelOffsetUnitWidget->setUnits(
5705 mAverageAngleUnit->setUnits(
5709 connect( mComboQuantity, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5710 if ( mLayer && !mBlockChangesSignal )
5717 if ( mLayer && !mBlockChangesSignal )
5719 mLayer->setTextFormat( mTextFormatButton->textFormat() );
5723 connect( spinInterval, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5724 if ( mLayer && !mBlockChangesSignal )
5726 mLayer->setInterval( spinInterval->value() );
5730 connect( mSpinSkipMultiples, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5731 if ( mLayer && !mBlockChangesSignal )
5733 mLayer->setSkipMultiplesOf( mSpinSkipMultiples->value() );
5737 connect( mCheckRotate, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5738 if ( mLayer && !mBlockChangesSignal )
5740 mLayer->setRotateLabels( checked );
5743 mSpinAverageAngleLength->setEnabled( checked );
5744 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5746 connect( mCheckShowMarker, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5747 if ( mLayer && !mBlockChangesSignal )
5749 mLayer->setShowMarker( checked );
5754 connect( mSpinLabelOffsetX, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5755 if ( mLayer && !mBlockChangesSignal )
5757 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5761 connect( mSpinLabelOffsetY, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5762 if ( mLayer && !mBlockChangesSignal )
5764 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5769 if ( mLayer && !mBlockChangesSignal )
5771 mLayer->setLabelOffsetUnit( mLabelOffsetUnitWidget->unit() );
5772 mLayer->setLabelOffsetMapUnitScale( mLabelOffsetUnitWidget->getMapUnitScale() );
5777 connect( mComboPlacement, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5778 if ( mLayer && !mBlockChangesSignal )
5781 mLayer->setPlacement( placement );
5782 switch ( placement )
5787 mIntervalWidget->show();
5790 mIntervalWidget->hide();
5797 connect( mSpinAverageAngleLength, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5798 if ( mLayer && !mBlockChangesSignal )
5800 mLayer->setAverageAngleLength( mSpinAverageAngleLength->value() );
5805 if ( mLayer && !mBlockChangesSignal )
5807 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
5808 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
5813 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsLinearReferencingSymbolLayerWidget::changeNumberFormat );
5815 mTextFormatButton->registerExpressionContextGenerator(
this );
5823 if ( !layer || layer->
layerType() !=
"LinearReferencing"_L1 )
5827 mLayer = qgis::down_cast<QgsLinearReferencingSymbolLayer *>( layer );
5829 mBlockChangesSignal =
true;
5831 mComboPlacement->setCurrentIndex( mComboPlacement->findData( QVariant::fromValue( mLayer->placement() ) ) );
5832 switch ( mLayer->placement() )
5837 mIntervalWidget->show();
5840 mIntervalWidget->hide();
5844 mComboQuantity->setCurrentIndex( mComboQuantity->findData( QVariant::fromValue( mLayer->labelSource() ) ) );
5846 mTextFormatButton->setTextFormat( mLayer->textFormat() );
5847 spinInterval->setValue( mLayer->interval() );
5848 mSpinSkipMultiples->setValue( mLayer->skipMultiplesOf() );
5849 mCheckRotate->setChecked( mLayer->rotateLabels() );
5850 mCheckShowMarker->setChecked( mLayer->showMarker() );
5851 mSpinLabelOffsetX->setValue( mLayer->labelOffset().x() );
5852 mSpinLabelOffsetY->setValue( mLayer->labelOffset().y() );
5853 mLabelOffsetUnitWidget->setUnit( mLayer->labelOffsetUnit() );
5854 mLabelOffsetUnitWidget->setMapUnitScale( mLayer->labelOffsetMapUnitScale() );
5856 mAverageAngleUnit->setUnit( mLayer->averageAngleUnit() );
5857 mAverageAngleUnit->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
5858 mSpinAverageAngleLength->setValue( mLayer->averageAngleLength() );
5860 mSpinAverageAngleLength->setEnabled( mCheckRotate->isChecked() );
5861 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5868 mBlockChangesSignal =
false;
5879 mTextFormatButton->setMapCanvas(
context.mapCanvas() );
5880 mTextFormatButton->setMessageBar(
context.messageBar() );
5883void QgsLinearReferencingSymbolLayerWidget::changeNumberFormat()
5893 if ( !mBlockChangesSignal )
5903 QgsNumericFormatSelectorDialog dialog(
this );
5904 dialog.setFormat( mLayer->numericFormat() );
5905 dialog.registerExpressionContextGenerator(
this );
5906 if ( dialog.exec() )
5908 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.
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.
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 mapToolSet(QgsMapTool *newTool, QgsMapTool *oldTool)
Emit map tool changed with the old 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.
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.
@ ExtraItems
String list of tuple (x, y and rotation angle) to define extra items to be rendered for templated lin...
@ TrimEnd
Trim distance from end of line.
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Base class for templated line symbols, e.g.
void setMapUnitScale(const QgsMapUnitScale &scale) final
QList< Qgis::RenderUnit > RenderUnitList
List of render units.
Represents a vector layer which manages a vector based dataset.
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.