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 btnChangeColorFill->setOpaqueColorString( tr(
"Opaque Fill" ) );
706 btnChangeColorStroke->setAllowOpacity(
true );
707 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
708 btnChangeColorStroke->setContext( u
"symbology"_s );
709 btnChangeColorStroke->setShowNoColor(
true );
710 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
711 btnChangeColorStroke->setOpaqueColorString( tr(
"Opaque Stroke" ) );
713 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
714 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
716 spinOffsetX->setClearValue( 0.0 );
717 spinOffsetY->setClearValue( 0.0 );
718 spinAngle->setClearValue( 0.0 );
721 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
724 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
726 int size = lstNames->iconSize().width();
728 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
730 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
731 lstNames->setIconSize( QSize( size, size ) );
733 const double markerSize = size * 0.8;
739 lyr->
setColor( QColor( 200, 200, 200 ) );
743 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
744 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
749 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
751 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
754 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
755 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
756 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
757 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
758 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
759 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
767 if ( layer->
layerType() !=
"SimpleMarker"_L1 )
775 for (
int i = 0; i < lstNames->count(); ++i )
777 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
779 lstNames->setCurrentRow( i );
783 btnChangeColorStroke->blockSignals(
true );
784 btnChangeColorStroke->setColor(
mLayer->strokeColor() );
785 btnChangeColorStroke->blockSignals(
false );
786 btnChangeColorFill->blockSignals(
true );
787 btnChangeColorFill->setColor(
mLayer->fillColor() );
789 btnChangeColorFill->blockSignals(
false );
790 spinSize->blockSignals(
true );
791 spinSize->setValue(
mLayer->size() );
792 spinSize->blockSignals(
false );
793 spinAngle->blockSignals(
true );
794 spinAngle->setValue(
mLayer->angle() );
795 spinAngle->blockSignals(
false );
796 mStrokeStyleComboBox->blockSignals(
true );
797 mStrokeStyleComboBox->setPenStyle(
mLayer->strokeStyle() );
798 mStrokeStyleComboBox->blockSignals(
false );
799 mStrokeWidthSpinBox->blockSignals(
true );
800 mStrokeWidthSpinBox->setValue(
mLayer->strokeWidth() );
801 mStrokeWidthSpinBox->blockSignals(
false );
802 cboJoinStyle->blockSignals(
true );
803 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
804 cboJoinStyle->blockSignals(
false );
805 cboCapStyle->blockSignals(
true );
806 cboCapStyle->setPenCapStyle(
mLayer->penCapStyle() );
807 cboCapStyle->blockSignals(
false );
810 spinOffsetX->blockSignals(
true );
811 spinOffsetX->setValue(
mLayer->offset().x() );
812 spinOffsetX->blockSignals(
false );
813 spinOffsetY->blockSignals(
true );
814 spinOffsetY->setValue(
mLayer->offset().y() );
815 spinOffsetY->blockSignals(
false );
817 mSizeUnitWidget->blockSignals(
true );
818 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
819 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
820 mSizeUnitWidget->blockSignals(
false );
821 mOffsetUnitWidget->blockSignals(
true );
822 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
823 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
824 mOffsetUnitWidget->blockSignals(
false );
825 mStrokeWidthUnitWidget->blockSignals(
true );
826 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
827 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
828 mStrokeWidthUnitWidget->blockSignals(
false );
831 mHorizontalAnchorComboBox->blockSignals(
true );
832 mVerticalAnchorComboBox->blockSignals(
true );
833 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
834 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
835 mHorizontalAnchorComboBox->blockSignals(
false );
836 mVerticalAnchorComboBox->blockSignals(
false );
851 updateAssistantSymbol();
859void QgsSimpleMarkerSymbolLayerWidget::setShape()
868 mLayer->setStrokeColor( color );
874 mLayer->setColor( color );
878void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
884void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
886 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
890void QgsSimpleMarkerSymbolLayerWidget::setSize()
892 mLayer->setSize( spinSize->value() );
896void QgsSimpleMarkerSymbolLayerWidget::setAngle()
898 mLayer->setAngle( spinAngle->value() );
902void QgsSimpleMarkerSymbolLayerWidget::setOffset()
904 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
908void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
914 mLayer->setStrokeStyle( mStrokeStyleComboBox->penStyle() );
919void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
923 mLayer->setStrokeWidth( d );
928void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
932 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
933 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
938void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
942 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
943 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
948void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
952 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
953 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
958void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
967void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
976void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
978 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
980 mAssistantPreviewSymbol->deleteSymbolLayer( i );
982 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
985 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
999 mStrokeWidthUnitWidget->setUnits(
1002 mOffsetUnitWidget->setUnits(
1006 btnChangeColor->setAllowOpacity(
true );
1007 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
1008 btnChangeColor->setContext( u
"symbology"_s );
1009 btnChangeColor->setShowNoColor(
true );
1010 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
1011 btnChangeColor->setOpaqueColorString( tr(
"Opaque Fill" ) );
1012 btnChangeStrokeColor->setAllowOpacity(
true );
1013 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
1014 btnChangeStrokeColor->setContext( u
"symbology"_s );
1015 btnChangeStrokeColor->setShowNoColor(
true );
1016 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
1017 btnChangeStrokeColor->setOpaqueColorString( tr(
"Opaque Stroke" ) );
1019 spinOffsetX->setClearValue( 0.0 );
1020 spinOffsetY->setClearValue( 0.0 );
1023 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
1025 connect( spinStrokeWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
1026 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1027 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
1028 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1029 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
1031 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
1032 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
1037 if ( layer->
layerType() !=
"SimpleFill"_L1 )
1044 btnChangeColor->blockSignals(
true );
1046 btnChangeColor->blockSignals(
false );
1047 cboFillStyle->blockSignals(
true );
1048 cboFillStyle->setBrushStyle(
mLayer->brushStyle() );
1049 cboFillStyle->blockSignals(
false );
1050 btnChangeStrokeColor->blockSignals(
true );
1051 btnChangeStrokeColor->setColor(
mLayer->strokeColor() );
1052 btnChangeStrokeColor->blockSignals(
false );
1053 cboStrokeStyle->blockSignals(
true );
1054 cboStrokeStyle->setPenStyle(
mLayer->strokeStyle() );
1055 cboStrokeStyle->blockSignals(
false );
1056 spinStrokeWidth->blockSignals(
true );
1057 spinStrokeWidth->setValue(
mLayer->strokeWidth() );
1058 spinStrokeWidth->blockSignals(
false );
1059 cboJoinStyle->blockSignals(
true );
1060 cboJoinStyle->setPenJoinStyle(
mLayer->penJoinStyle() );
1061 cboJoinStyle->blockSignals(
false );
1062 spinOffsetX->blockSignals(
true );
1063 spinOffsetX->setValue(
mLayer->offset().x() );
1064 spinOffsetX->blockSignals(
false );
1065 spinOffsetY->blockSignals(
true );
1066 spinOffsetY->setValue(
mLayer->offset().y() );
1067 spinOffsetY->blockSignals(
false );
1069 mStrokeWidthUnitWidget->blockSignals(
true );
1070 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
1071 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
1072 mStrokeWidthUnitWidget->blockSignals(
false );
1073 mOffsetUnitWidget->blockSignals(
true );
1074 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1075 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1076 mOffsetUnitWidget->blockSignals(
false );
1094 mLayer->setColor( color );
1100 mLayer->setStrokeColor( color );
1104void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1110void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1112 mLayer->setStrokeWidth( spinStrokeWidth->value() );
1116void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1118 mLayer->setStrokeStyle( cboStrokeStyle->penStyle() );
1119 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
1123void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1125 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1129void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1133 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
1134 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
1139void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1143 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1144 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1168 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1169 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1170 mSizeUnitWidget->setUnits(
1173 mOffsetUnitWidget->setUnits(
1177 spinOffsetX->setClearValue( 0.0 );
1178 spinOffsetY->setClearValue( 0.0 );
1179 spinAngle->setClearValue( 0.0 );
1182 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
1185 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1187 int size = lstNames->iconSize().width();
1188 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1189 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1190 lstNames->setIconSize( QSize( size, size ) );
1192 const double markerSize = size * 0.8;
1198 lyr->
setColor( QColor( 200, 200, 200 ) );
1202 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1203 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
1208 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1210 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1211 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1212 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1213 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1214 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1222 if ( layer->
layerType() !=
"FilledMarker"_L1 )
1230 for (
int i = 0; i < lstNames->count(); ++i )
1232 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1234 lstNames->setCurrentRow( i );
1243 mSizeUnitWidget->blockSignals(
true );
1244 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
1245 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
1246 mSizeUnitWidget->blockSignals(
false );
1247 mOffsetUnitWidget->blockSignals(
true );
1248 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1249 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1250 mOffsetUnitWidget->blockSignals(
false );
1253 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
1254 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
1263 updateAssistantSymbol();
1271void QgsFilledMarkerSymbolLayerWidget::setShape()
1277void QgsFilledMarkerSymbolLayerWidget::setSize()
1279 mLayer->setSize( spinSize->value() );
1283void QgsFilledMarkerSymbolLayerWidget::setAngle()
1285 mLayer->setAngle( spinAngle->value() );
1289void QgsFilledMarkerSymbolLayerWidget::setOffset()
1291 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1295void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1299 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
1300 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
1305void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1309 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1310 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1315void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
1324void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
1333void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1335 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
1337 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1339 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
1342 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1355 connect( mSpinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1356 mOffsetUnitWidget->setUnits(
1360 btnColorRamp->setShowGradientOnly(
true );
1362 btnChangeColor->setAllowOpacity(
true );
1363 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1364 btnChangeColor->setContext( u
"symbology"_s );
1365 btnChangeColor->setShowNoColor(
true );
1366 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1367 btnChangeColor->setOpaqueColorString( tr(
"Opaque" ) );
1368 btnChangeColor2->setAllowOpacity(
true );
1369 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1370 btnChangeColor2->setContext( u
"symbology"_s );
1371 btnChangeColor2->setShowNoColor(
true );
1372 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1373 btnChangeColor2->setOpaqueColorString( tr(
"Opaque" ) );
1375 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1376 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1378 spinOffsetX->setClearValue( 0.0 );
1379 spinOffsetY->setClearValue( 0.0 );
1380 mSpinAngle->setClearValue( 0.0 );
1388 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1389 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1390 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1391 connect( spinRefPoint1X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1392 connect( spinRefPoint1Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1393 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1394 connect( spinRefPoint2X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1395 connect( spinRefPoint2Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1396 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1401 if ( layer->
layerType() !=
"GradientFill"_L1 )
1408 btnChangeColor->blockSignals(
true );
1410 btnChangeColor->blockSignals(
false );
1411 btnChangeColor2->blockSignals(
true );
1412 btnChangeColor2->setColor(
mLayer->color2() );
1413 btnChangeColor2->blockSignals(
false );
1417 radioTwoColor->setChecked(
true );
1418 btnColorRamp->setEnabled(
false );
1422 radioColorRamp->setChecked(
true );
1423 btnChangeColor->setEnabled(
false );
1424 btnChangeColor2->setEnabled(
false );
1428 if (
mLayer->colorRamp() )
1430 btnColorRamp->blockSignals(
true );
1431 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1432 btnColorRamp->blockSignals(
false );
1435 cboGradientType->blockSignals(
true );
1436 switch (
mLayer->gradientType() )
1439 cboGradientType->setCurrentIndex( 0 );
1442 cboGradientType->setCurrentIndex( 1 );
1445 cboGradientType->setCurrentIndex( 2 );
1448 cboGradientType->blockSignals(
false );
1450 cboCoordinateMode->blockSignals(
true );
1451 switch (
mLayer->coordinateMode() )
1454 cboCoordinateMode->setCurrentIndex( 1 );
1455 checkRefPoint1Centroid->setEnabled(
false );
1456 checkRefPoint2Centroid->setEnabled(
false );
1460 cboCoordinateMode->setCurrentIndex( 0 );
1463 cboCoordinateMode->blockSignals(
false );
1465 cboGradientSpread->blockSignals(
true );
1466 switch (
mLayer->gradientSpread() )
1469 cboGradientSpread->setCurrentIndex( 0 );
1472 cboGradientSpread->setCurrentIndex( 1 );
1475 cboGradientSpread->setCurrentIndex( 2 );
1478 cboGradientSpread->blockSignals(
false );
1480 spinRefPoint1X->blockSignals(
true );
1481 spinRefPoint1X->setValue(
mLayer->referencePoint1().x() );
1482 spinRefPoint1X->blockSignals(
false );
1483 spinRefPoint1Y->blockSignals(
true );
1484 spinRefPoint1Y->setValue(
mLayer->referencePoint1().y() );
1485 spinRefPoint1Y->blockSignals(
false );
1486 checkRefPoint1Centroid->blockSignals(
true );
1487 checkRefPoint1Centroid->setChecked(
mLayer->referencePoint1IsCentroid() );
1488 if (
mLayer->referencePoint1IsCentroid() )
1490 spinRefPoint1X->setEnabled(
false );
1491 spinRefPoint1Y->setEnabled(
false );
1493 checkRefPoint1Centroid->blockSignals(
false );
1494 spinRefPoint2X->blockSignals(
true );
1495 spinRefPoint2X->setValue(
mLayer->referencePoint2().x() );
1496 spinRefPoint2X->blockSignals(
false );
1497 spinRefPoint2Y->blockSignals(
true );
1498 spinRefPoint2Y->setValue(
mLayer->referencePoint2().y() );
1499 spinRefPoint2Y->blockSignals(
false );
1500 checkRefPoint2Centroid->blockSignals(
true );
1501 checkRefPoint2Centroid->setChecked(
mLayer->referencePoint2IsCentroid() );
1502 if (
mLayer->referencePoint2IsCentroid() )
1504 spinRefPoint2X->setEnabled(
false );
1505 spinRefPoint2Y->setEnabled(
false );
1507 checkRefPoint2Centroid->blockSignals(
false );
1509 spinOffsetX->blockSignals(
true );
1510 spinOffsetX->setValue(
mLayer->offset().x() );
1511 spinOffsetX->blockSignals(
false );
1512 spinOffsetY->blockSignals(
true );
1513 spinOffsetY->setValue(
mLayer->offset().y() );
1514 spinOffsetY->blockSignals(
false );
1515 mSpinAngle->blockSignals(
true );
1516 mSpinAngle->setValue(
mLayer->angle() );
1517 mSpinAngle->blockSignals(
false );
1519 mOffsetUnitWidget->blockSignals(
true );
1520 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1521 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1522 mOffsetUnitWidget->blockSignals(
false );
1546 mLayer->setColor( color );
1552 mLayer->setColor2( color );
1556void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1558 if ( radioTwoColor->isChecked() )
1571 if ( btnColorRamp->isNull() )
1574 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
1585 spinRefPoint1X->setValue( 0.5 );
1586 spinRefPoint1Y->setValue( 0 );
1587 spinRefPoint2X->setValue( 0.5 );
1588 spinRefPoint2Y->setValue( 1 );
1593 spinRefPoint1X->setValue( 0 );
1594 spinRefPoint1Y->setValue( 0 );
1595 spinRefPoint2X->setValue( 1 );
1596 spinRefPoint2Y->setValue( 1 );
1600 spinRefPoint1X->setValue( 0.5 );
1601 spinRefPoint1Y->setValue( 0.5 );
1602 spinRefPoint2X->setValue( 1 );
1603 spinRefPoint2Y->setValue( 1 );
1617 checkRefPoint1Centroid->setEnabled(
true );
1618 checkRefPoint2Centroid->setEnabled(
true );
1624 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1625 checkRefPoint1Centroid->setEnabled(
false );
1626 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1627 checkRefPoint2Centroid->setEnabled(
false );
1652void QgsGradientFillSymbolLayerWidget::offsetChanged()
1654 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1658void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1660 mLayer->setReferencePoint1( QPointF( spinRefPoint1X->value(), spinRefPoint1Y->value() ) );
1661 mLayer->setReferencePoint1IsCentroid( checkRefPoint1Centroid->isChecked() );
1662 mLayer->setReferencePoint2( QPointF( spinRefPoint2X->value(), spinRefPoint2Y->value() ) );
1663 mLayer->setReferencePoint2IsCentroid( checkRefPoint2Centroid->isChecked() );
1667void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1669 mLayer->setAngle( value );
1673void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1677 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1678 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1691 connect( mSpinBlurRadius, qOverload<int>( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1692 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1694 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1696 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1697 mDistanceUnitWidget->setUnits(
1700 mOffsetUnitWidget->setUnits(
1704 QButtonGroup *group1 =
new QButtonGroup(
this );
1705 group1->addButton( radioColorRamp );
1706 group1->addButton( radioTwoColor );
1707 QButtonGroup *group2 =
new QButtonGroup(
this );
1708 group2->addButton( mRadioUseMaxDistance );
1709 group2->addButton( mRadioUseWholeShape );
1710 btnChangeColor->setAllowOpacity(
true );
1711 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1712 btnChangeColor->setContext( u
"symbology"_s );
1713 btnChangeColor->setShowNoColor(
true );
1714 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1715 btnChangeColor->setOpaqueColorString( tr(
"Opaque" ) );
1716 btnChangeColor2->setAllowOpacity(
true );
1717 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1718 btnChangeColor2->setContext( u
"symbology"_s );
1719 btnChangeColor2->setShowNoColor(
true );
1720 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1721 btnChangeColor2->setOpaqueColorString( tr(
"Opaque" ) );
1723 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1724 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1726 spinOffsetX->setClearValue( 0.0 );
1727 spinOffsetY->setClearValue( 0.0 );
1728 mSpinMaxDistance->setClearValue( 5.0 );
1730 btnColorRamp->setShowGradientOnly(
true );
1736 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1737 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1738 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1740 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1741 connect( mSpinBlurRadius,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1746 if ( layer->
layerType() !=
"ShapeburstFill"_L1 )
1753 btnChangeColor->blockSignals(
true );
1755 btnChangeColor->blockSignals(
false );
1756 btnChangeColor2->blockSignals(
true );
1757 btnChangeColor2->setColor(
mLayer->color2() );
1758 btnChangeColor2->blockSignals(
false );
1762 radioTwoColor->setChecked(
true );
1763 btnColorRamp->setEnabled(
false );
1767 radioColorRamp->setChecked(
true );
1768 btnChangeColor->setEnabled(
false );
1769 btnChangeColor2->setEnabled(
false );
1772 mSpinBlurRadius->blockSignals(
true );
1773 mBlurSlider->blockSignals(
true );
1774 mSpinBlurRadius->setValue(
mLayer->blurRadius() );
1775 mBlurSlider->setValue(
mLayer->blurRadius() );
1776 mSpinBlurRadius->blockSignals(
false );
1777 mBlurSlider->blockSignals(
false );
1779 mSpinMaxDistance->blockSignals(
true );
1780 mSpinMaxDistance->setValue(
mLayer->maxDistance() );
1781 mSpinMaxDistance->blockSignals(
false );
1783 mRadioUseWholeShape->blockSignals(
true );
1784 mRadioUseMaxDistance->blockSignals(
true );
1785 if (
mLayer->useWholeShape() )
1787 mRadioUseWholeShape->setChecked(
true );
1788 mSpinMaxDistance->setEnabled(
false );
1789 mDistanceUnitWidget->setEnabled(
false );
1793 mRadioUseMaxDistance->setChecked(
true );
1794 mSpinMaxDistance->setEnabled(
true );
1795 mDistanceUnitWidget->setEnabled(
true );
1797 mRadioUseWholeShape->blockSignals(
false );
1798 mRadioUseMaxDistance->blockSignals(
false );
1800 mDistanceUnitWidget->blockSignals(
true );
1801 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
1802 mDistanceUnitWidget->setMapUnitScale(
mLayer->distanceMapUnitScale() );
1803 mDistanceUnitWidget->blockSignals(
false );
1805 mIgnoreRingsCheckBox->blockSignals(
true );
1806 mIgnoreRingsCheckBox->setCheckState(
mLayer->ignoreRings() ? Qt::Checked : Qt::Unchecked );
1807 mIgnoreRingsCheckBox->blockSignals(
false );
1810 if (
mLayer->colorRamp() )
1812 btnColorRamp->blockSignals(
true );
1813 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
1814 btnColorRamp->blockSignals(
false );
1817 spinOffsetX->blockSignals(
true );
1818 spinOffsetX->setValue(
mLayer->offset().x() );
1819 spinOffsetX->blockSignals(
false );
1820 spinOffsetY->blockSignals(
true );
1821 spinOffsetY->setValue(
mLayer->offset().y() );
1822 spinOffsetY->blockSignals(
false );
1823 mOffsetUnitWidget->blockSignals(
true );
1824 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
1825 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
1826 mOffsetUnitWidget->blockSignals(
false );
1846 mLayer->setColor( color );
1855 mLayer->setColor2( color );
1860void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1867 if ( radioTwoColor->isChecked() )
1878void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1882 mLayer->setBlurRadius( value );
1887void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1891 mLayer->setMaxDistance( value );
1896void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1900 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
1901 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
1906void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1910 mLayer->setUseWholeShape( value );
1911 mDistanceUnitWidget->setEnabled( !value );
1916void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1918 QgsColorRamp *ramp = btnColorRamp->colorRamp();
1922 mLayer->setColorRamp( ramp );
1926void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1930 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1935void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1939 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
1940 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
1946void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1948 const bool checked = ( state == Qt::Checked );
1949 mLayer->setIgnoreRings( checked );
1957 , mSymbolType( symbolType )
1964 connect( mOffsetAlongLineUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed );
1970 mIntervalUnitWidget->setUnits( units );
1971 mOffsetUnitWidget->setUnits( units );
1973 mAverageAngleUnit->setUnits( units );
1974 mIntervalUnitWidget->setUnits( units );
1975 mBlankSegmentsUnitWidget->setUnits( units );
1982 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this](
int ) {
1990 spinOffset->setClearValue( 0.0 );
1991 mSpinOffsetAlongLine->setClearValue( 0.0 );
1992 mHashRotationSpinBox->setClearValue( 0 );
1993 mSpinAverageAngleLength->setClearValue( 4.0 );
1994 mTrimStartDistanceSpin->setClearValue( 0.0 );
1995 mTrimDistanceEndSpin->setClearValue( 0.0 );
1999 connect( mSpinHashLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashLength );
2000 connect( mHashRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setHashAngle );
2001 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsTemplatedLineSymbolLayerWidget::setRotate );
2002 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setOffset );
2003 connect( mSpinAverageAngleLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsTemplatedLineSymbolLayerWidget::setAverageAngle );
2005 QActionGroup *actionGroup =
new QActionGroup(
this );
2006 actionGroup->setExclusionPolicy( QActionGroup::ExclusionPolicy::Exclusive );
2007 actionGroup->addAction( mEditBlankSegmentsAction );
2008 actionGroup->addAction( mAddExtraItemAction );
2009 actionGroup->addAction( mModifyExtraItemAction );
2011 mEditBlankSegmentsBtn->setDefaultAction( mEditBlankSegmentsAction );
2012 connect( mEditBlankSegmentsAction, &QAction::triggered,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolEditBlankSegments );
2014 mAddExtraItemBtn->setDefaultAction( mAddExtraItemAction );
2015 connect( mAddExtraItemAction, &QAction::triggered,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolAddExtraItem );
2017 mModifyExtraItemBtn->setDefaultAction( mModifyExtraItemAction );
2018 connect( mModifyExtraItemAction, &QAction::triggered,
this, &QgsMarkerLineSymbolLayerWidget::toggleMapToolModifyExtraItem );
2020 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2021 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2022 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2023 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2024 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2025 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2026 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsTemplatedLineSymbolLayerWidget::setPlacement );
2028 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [
this] {
2031 mLayer->setPlaceOnEveryPart( mCheckPlaceOnEveryPart->isChecked() );
2036 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
2040 mLayer->setTrimDistanceStart( value );
2047 mLayer->setTrimDistanceStartUnit( mTrimDistanceStartUnitWidget->unit() );
2048 mLayer->setTrimDistanceStartMapUnitScale( mTrimDistanceStartUnitWidget->getMapUnitScale() );
2051 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
2055 mLayer->setTrimDistanceEnd( value );
2062 mLayer->setTrimDistanceEndUnit( mTrimDistanceEndUnitWidget->unit() );
2063 mLayer->setTrimDistanceEndMapUnitScale( mTrimDistanceEndUnitWidget->getMapUnitScale() );
2067 switch ( mSymbolType )
2072 mHashLengthUnitWidget->setUnits(
2075 mPlacementLabel->setText( tr(
"Hash placement" ) );
2076 chkRotateMarker->setText( tr(
"Rotate hash to follow line direction" ) );
2077 mSpinOffsetAlongLine->setToolTip( tr(
"Offset hashes in line direction if positive or in opposite line direction if negative" ) );
2078 mHashLengthLabel->setVisible(
true );
2079 mSpinHashLength->setVisible(
true );
2080 mHashLengthUnitWidget->setVisible(
true );
2081 mHashLengthDDBtn->setVisible(
true );
2082 mHashRotationLabel->setVisible(
true );
2083 mHashRotationSpinBox->setVisible(
true );
2084 mHashRotationDDBtn->setVisible(
true );
2089 mPlacementLabel->setText( tr(
"Marker placement" ) );
2090 chkRotateMarker->setText( tr(
"Rotate marker to follow line direction" ) );
2091 mSpinOffsetAlongLine->setToolTip( tr(
"Offset markers in line direction if positive or in opposite line direction if negative" ) );
2092 mHashLengthLabel->setVisible(
false );
2093 mSpinHashLength->setVisible(
false );
2094 mHashLengthUnitWidget->setVisible(
false );
2095 mHashLengthDDBtn->setVisible(
false );
2096 mHashRotationLabel->setVisible(
false );
2097 mHashRotationSpinBox->setVisible(
false );
2098 mHashRotationDDBtn->setVisible(
false );
2113 if (
event->type() == QEvent::Show )
2117 updatePerFeatureCustomizationWidget();
2120 return QgsSymbolLayerWidget::event(
event );
2125 switch ( mSymbolType )
2128 if ( layer->
layerType() !=
"HashLine"_L1 )
2133 if ( layer->
layerType() !=
"MarkerLine"_L1 )
2141 spinInterval->blockSignals(
true );
2142 spinInterval->setValue( mLayer->interval() );
2143 spinInterval->blockSignals(
false );
2144 mSpinOffsetAlongLine->blockSignals(
true );
2145 mSpinOffsetAlongLine->setValue( mLayer->offsetAlongLine() );
2146 mSpinOffsetAlongLine->blockSignals(
false );
2148 chkRotateMarker->blockSignals(
true );
2149 chkRotateMarker->setChecked( mLayer->rotateSymbols() );
2150 chkRotateMarker->blockSignals(
false );
2151 spinOffset->blockSignals(
true );
2152 spinOffset->setValue( mLayer->offset() );
2153 spinOffset->blockSignals(
false );
2155 whileBlocking( mTrimStartDistanceSpin )->setValue( mLayer->trimDistanceStart() );
2156 whileBlocking( mTrimDistanceEndSpin )->setValue( mLayer->trimDistanceEnd() );
2165 whileBlocking( mCheckPlaceOnEveryPart )->setChecked( mLayer->placeOnEveryPart() );
2168 mIntervalUnitWidget->blockSignals(
true );
2169 mIntervalUnitWidget->setUnit( mLayer->intervalUnit() );
2170 mIntervalUnitWidget->
setMapUnitScale( mLayer->intervalMapUnitScale() );
2171 mIntervalUnitWidget->blockSignals(
false );
2172 mOffsetUnitWidget->blockSignals(
true );
2173 mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
2174 mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
2175 mOffsetUnitWidget->blockSignals(
false );
2176 mOffsetAlongLineUnitWidget->blockSignals(
true );
2177 mOffsetAlongLineUnitWidget->setUnit( mLayer->offsetAlongLineUnit() );
2178 mOffsetAlongLineUnitWidget->setMapUnitScale( mLayer->offsetAlongLineMapUnitScale() );
2179 mOffsetAlongLineUnitWidget->blockSignals(
false );
2180 whileBlocking( mAverageAngleUnit )->setUnit( mLayer->averageAngleUnit() );
2181 whileBlocking( mAverageAngleUnit )->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
2182 whileBlocking( mSpinAverageAngleLength )->setValue( mLayer->averageAngleLength() );
2183 whileBlocking( mBlankSegmentsUnitWidget )->setUnit( mLayer->blankSegmentsUnit() );
2184 whileBlocking( mTrimDistanceStartUnitWidget )->setUnit( mLayer->trimDistanceStartUnit() );
2185 whileBlocking( mTrimDistanceStartUnitWidget )->setMapUnitScale( mLayer->trimDistanceStartMapUnitScale() );
2186 whileBlocking( mTrimDistanceEndUnitWidget )->setUnit( mLayer->trimDistanceEndUnit() );
2187 whileBlocking( mTrimDistanceEndUnitWidget )->setMapUnitScale( mLayer->trimDistanceEndMapUnitScale() );
2189 switch ( mSymbolType )
2207 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->ringFilter() ) );
2232 updatePerFeatureCustomizationWidget();
2244 switch (
context.symbolType() )
2249 mRingFilterComboBox->hide();
2250 mRingsLabel->hide();
2261 if ( oldMapTool == mMapToolAddExtraItem.get() )
2262 mMapToolAddExtraItem.reset();
2263 if ( oldMapTool == mMapToolModifyExtraItem.get() )
2264 mMapToolModifyExtraItem.reset();
2265 if ( oldMapTool == mMapToolEditBlankSegments.get() )
2266 mMapToolEditBlankSegments.reset();
2273 mLayer->setInterval( val );
2279 mLayer->setOffsetAlongLine( val );
2283void QgsTemplatedLineSymbolLayerWidget::setHashLength(
double val )
2285 switch ( mSymbolType )
2300void QgsTemplatedLineSymbolLayerWidget::setHashAngle(
double val )
2305 switch ( mSymbolType )
2309 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2320void QgsTemplatedLineSymbolLayerWidget::setRotate()
2322 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2323 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2325 mLayer->setRotateSymbols( chkRotateMarker->isChecked() );
2329void QgsTemplatedLineSymbolLayerWidget::setOffset()
2331 mLayer->setOffset( spinOffset->value() );
2335void QgsTemplatedLineSymbolLayerWidget::setPlacement()
2337 const bool interval = mCheckInterval->isChecked();
2338 spinInterval->setEnabled( interval );
2339 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2340 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2341 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2342 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2343 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2346 if ( mCheckInterval->isChecked() )
2348 if ( mCheckVertex->isChecked() )
2350 if ( mCheckVertexLast->isChecked() )
2352 if ( mCheckVertexFirst->isChecked() )
2354 if ( mCheckCurvePoint->isChecked() )
2356 if ( mCheckSegmentCentralPoint->isChecked() )
2358 if ( mCheckCentralPoint->isChecked() )
2360 mLayer->setPlacements( placements );
2365void QgsTemplatedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2369 mLayer->setIntervalUnit( mIntervalUnitWidget->unit() );
2370 mLayer->setIntervalMapUnitScale( mIntervalUnitWidget->getMapUnitScale() );
2375void QgsTemplatedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2379 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2380 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2385void QgsTemplatedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2389 mLayer->setOffsetAlongLineUnit( mOffsetAlongLineUnitWidget->unit() );
2390 mLayer->setOffsetAlongLineMapUnitScale( mOffsetAlongLineUnitWidget->getMapUnitScale() );
2395void QgsTemplatedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2400 switch ( mSymbolType )
2404 QgsHashedLineSymbolLayer *hashLayer =
static_cast<QgsHashedLineSymbolLayer *
>( mLayer );
2416void QgsTemplatedLineSymbolLayerWidget::averageAngleUnitChanged()
2420 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
2421 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
2426void QgsTemplatedLineSymbolLayerWidget::blankSegmentsUnitChanged()
2430 mLayer->setBlankSegmentsUnit( mBlankSegmentsUnitWidget->unit() );
2435void QgsTemplatedLineSymbolLayerWidget::setAverageAngle(
double val )
2439 mLayer->setAverageAngleLength( val );
2444void QgsTemplatedLineSymbolLayerWidget::toggleMapToolEditBlankSegments(
bool toggled )
2446 if ( !toggled || ( mMapToolEditBlankSegments.get() &&
context().mapCanvas()->mapTool() == mMapToolEditBlankSegments.get() ) )
2449 switch ( mSymbolType )
2460 mMapToolEditBlankSegments->setAction( mEditBlankSegmentsAction );
2464void QgsTemplatedLineSymbolLayerWidget::toggleMapToolAddExtraItem(
bool toggled )
2466 if ( !toggled || ( mMapToolAddExtraItem.get() &&
context().mapCanvas()->mapTool() == mMapToolAddExtraItem.get() ) )
2470 mMapToolAddExtraItem->setAction( mAddExtraItemAction );
2474void QgsTemplatedLineSymbolLayerWidget::toggleMapToolModifyExtraItem(
bool toggled )
2476 if ( !toggled || ( mMapToolModifyExtraItem.get() &&
context().mapCanvas()->mapTool() == mMapToolModifyExtraItem.get() ) )
2480 mMapToolModifyExtraItem->setAction( mModifyExtraItemAction );
2484void QgsTemplatedLineSymbolLayerWidget::updatePerFeatureCustomizationWidget()
2486 QString tooltipEditBlankSegment = u
"<b>"_s;
2487 QString tooltipAddExtraItem = u
"<b>"_s;
2488 QString tooltipModifyExtraItem = u
"<b>"_s;
2489 switch ( mSymbolType )
2492 tooltipEditBlankSegment += tr(
"Create blank segments where hashed lines won't be displayed" );
2493 tooltipAddExtraItem += tr(
"Add extra hash being displayed with the hashed line" );
2494 tooltipModifyExtraItem += tr(
"Select and modify (move, rotate, delete) extra hashes being displayed with the hashed line" );
2498 tooltipEditBlankSegment += tr(
"Create blank segments where marker lines won't be displayed" );
2499 tooltipAddExtraItem += tr(
"Add extra marker being displayed with the marker line" );
2500 tooltipModifyExtraItem += tr(
"Select and modify (move, rotate, delete) extra markers being displayed with the marker line" );
2504 const QString info = u
"</b><br/>"_s
2506 "First click to select the line you want to operate on. "
2507 "<br/>Press %1 to deselect the line and select another one."
2509 .arg( QKeySequence( QKeySequence::StandardKey::Cancel ).toString( QKeySequence::NativeText ) );
2510 tooltipEditBlankSegment += info;
2511 tooltipAddExtraItem += info;
2512 tooltipModifyExtraItem += info;
2514 bool enabled =
true;
2518 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." );
2519 tooltipEditBlankSegment += u
"<br/><br/>"_s + accessFromDialog;
2520 tooltipAddExtraItem += u
"<br/><br/>"_s + accessFromDialog;
2521 tooltipModifyExtraItem += u
"<br/><br/>"_s + accessFromDialog;
2526 mEditBlankSegmentsAction->setEnabled( enabled );
2527 mAddExtraItemAction->setEnabled( enabled );
2528 mModifyExtraItemAction->setEnabled( enabled );
2530 mEditBlankSegmentsAction->setToolTip( tooltipEditBlankSegment );
2531 mAddExtraItemAction->setToolTip( tooltipAddExtraItem );
2532 mModifyExtraItemAction->setToolTip( tooltipModifyExtraItem );
2565 mSvgSelectorWidget->setAllowParameters(
true );
2566 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2567 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( u
"/UI/lastSVGMarkerDir"_s );
2568 mSvgSelectorWidget->initParametersModel(
this, vl );
2572 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2573 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2577 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2578 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2579 mSizeUnitWidget->setUnits(
2582 mStrokeWidthUnitWidget->setUnits(
2585 mOffsetUnitWidget->setUnits(
2588 mChangeColorButton->setAllowOpacity(
true );
2589 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2590 mChangeColorButton->setContext( u
"symbology"_s );
2591 mChangeStrokeColorButton->setAllowOpacity(
true );
2592 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2593 mChangeStrokeColorButton->setContext( u
"symbology"_s );
2595 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2596 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2598 spinOffsetX->setClearValue( 0.0 );
2599 spinOffsetY->setClearValue( 0.0 );
2600 spinAngle->setClearValue( 0.0 );
2602 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2603 connect( spinHeight,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2605 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2606 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2607 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2614 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
2618 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2619 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2626#include <QAbstractListModel>
2627#include <QPixmapCache>
2640 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2641 QColor defaultFill, defaultStroke;
2642 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2643 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2647 hasDefaultFillColor,
2649 hasFillOpacityParam,
2650 hasDefaultFillOpacity,
2653 hasDefaultStrokeColor,
2655 hasStrokeWidthParam,
2656 hasDefaultStrokeWidth,
2658 hasStrokeOpacityParam,
2659 hasDefaultStrokeOpacity,
2660 defaultStrokeOpacity
2662 mChangeColorButton->setEnabled( hasFillParam );
2663 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2664 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2665 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2666 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2671 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2672 if ( hasDefaultFillColor && !skipDefaultColors )
2676 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2677 mChangeColorButton->setColor( fill );
2679 if ( hasStrokeParam )
2682 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2683 if ( hasDefaultStrokeColor && !skipDefaultColors )
2685 stroke = defaultStroke;
2687 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2688 mChangeStrokeColorButton->setColor( stroke );
2691 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2693 mStrokeWidthSpinBox->blockSignals(
true );
2694 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2695 mStrokeWidthSpinBox->blockSignals(
false );
2698 spinHeight->blockSignals(
true );
2699 if ( preservedAspectRatio )
2708 spinHeight->blockSignals(
false );
2709 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2712void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2714 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
2716 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2718 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
2721 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2732 if ( layer->
layerType() !=
"SvgMarker"_L1 )
2739 mSvgSelectorWidget->setSvgPath(
mLayer->path() );
2740 mSvgSelectorWidget->setSvgParameters(
mLayer->parameters() );
2742 spinWidth->blockSignals(
true );
2743 spinWidth->setValue(
mLayer->size() );
2744 spinWidth->blockSignals(
false );
2745 spinAngle->blockSignals(
true );
2746 spinAngle->setValue(
mLayer->angle() );
2747 spinAngle->blockSignals(
false );
2750 spinOffsetX->blockSignals(
true );
2751 spinOffsetX->setValue(
mLayer->offset().x() );
2752 spinOffsetX->blockSignals(
false );
2753 spinOffsetY->blockSignals(
true );
2754 spinOffsetY->setValue(
mLayer->offset().y() );
2755 spinOffsetY->blockSignals(
false );
2757 mSizeUnitWidget->blockSignals(
true );
2758 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
2760 mSizeUnitWidget->blockSignals(
false );
2761 mStrokeWidthUnitWidget->blockSignals(
true );
2762 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
2763 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
2764 mStrokeWidthUnitWidget->blockSignals(
false );
2765 mOffsetUnitWidget->blockSignals(
true );
2766 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
2767 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
2768 mOffsetUnitWidget->blockSignals(
false );
2771 mHorizontalAnchorComboBox->blockSignals(
true );
2772 mVerticalAnchorComboBox->blockSignals(
true );
2773 mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
2774 mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
2775 mHorizontalAnchorComboBox->blockSignals(
false );
2776 mVerticalAnchorComboBox->blockSignals(
false );
2792 updateAssistantSymbol();
2803 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
2809 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2817 mLayer->setParameters( parameters );
2818 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2824void QgsSvgMarkerSymbolLayerWidget::setWidth()
2827 double fixedAspectRatio = 0.0;
2828 spinHeight->blockSignals(
true );
2829 if ( defaultAspectRatio <= 0.0 )
2831 spinHeight->setValue( spinWidth->value() );
2833 else if ( mLockAspectRatio->locked() )
2835 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2839 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2841 spinHeight->blockSignals(
false );
2842 mLayer->setSize( spinWidth->value() );
2843 mLayer->setFixedAspectRatio( fixedAspectRatio );
2847void QgsSvgMarkerSymbolLayerWidget::setHeight()
2849 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2850 double fixedAspectRatio = 0.0;
2851 spinWidth->blockSignals(
true );
2852 if ( defaultAspectRatio <= 0.0 )
2854 spinWidth->setValue( spinHeight->value() );
2856 else if ( mLockAspectRatio->locked() )
2858 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2862 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2864 spinWidth->blockSignals(
false );
2865 mLayer->setSize( spinWidth->value() );
2866 mLayer->setFixedAspectRatio( fixedAspectRatio );
2870void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2873 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
2874 if ( defaultAspectRatio <= 0.0 )
2880 mLayer->setFixedAspectRatio( 0.0 );
2885 mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
2890void QgsSvgMarkerSymbolLayerWidget::setAngle()
2892 mLayer->setAngle( spinAngle->value() );
2896void QgsSvgMarkerSymbolLayerWidget::setOffset()
2898 mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2902void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2909void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2916 mLayer->setFillColor( color );
2920void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2927 mLayer->setStrokeColor( color );
2931void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2935 mLayer->setStrokeWidth( d );
2940void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2944 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
2945 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
2950void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2954 mLayer->setStrokeWidthUnit( mStrokeWidthUnitWidget->unit() );
2955 mLayer->setStrokeWidthMapUnitScale( mStrokeWidthUnitWidget->getMapUnitScale() );
2960void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2964 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
2965 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
2970void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
2979void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
2996 mSvgSelectorWidget->setAllowParameters(
true );
2997 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2999 connect( mTextureWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
3001 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
3003 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
3004 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3007 mTextureWidthUnitWidget->setUnits(
3010 mSvgStrokeWidthUnitWidget->setUnits(
3014 mRotationSpinBox->setClearValue( 0.0 );
3016 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
3017 mChangeColorButton->setContext( u
"symbology"_s );
3018 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
3019 mChangeStrokeColorButton->setContext( u
"symbology"_s );
3021 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
3022 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
3035 if ( layer->
layerType() !=
"SVGFill"_L1 )
3043 const double width =
mLayer->patternWidth();
3044 mTextureWidthSpinBox->blockSignals(
true );
3045 mTextureWidthSpinBox->setValue( width );
3046 mTextureWidthSpinBox->blockSignals(
false );
3047 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource(
mLayer->svgFilePath() );
3048 mRotationSpinBox->blockSignals(
true );
3049 mRotationSpinBox->setValue(
mLayer->angle() );
3050 mRotationSpinBox->blockSignals(
false );
3051 mTextureWidthUnitWidget->blockSignals(
true );
3052 mTextureWidthUnitWidget->setUnit(
mLayer->patternWidthUnit() );
3053 mTextureWidthUnitWidget->setMapUnitScale(
mLayer->patternWidthMapUnitScale() );
3054 mTextureWidthUnitWidget->blockSignals(
false );
3055 mSvgStrokeWidthUnitWidget->blockSignals(
true );
3056 mSvgStrokeWidthUnitWidget->setUnit(
mLayer->svgStrokeWidthUnit() );
3057 mSvgStrokeWidthUnitWidget->setMapUnitScale(
mLayer->svgStrokeWidthMapUnitScale() );
3058 mSvgStrokeWidthUnitWidget->blockSignals(
false );
3059 mChangeColorButton->blockSignals(
true );
3060 mChangeColorButton->setColor(
mLayer->svgFillColor() );
3061 mChangeColorButton->blockSignals(
false );
3062 mChangeStrokeColorButton->blockSignals(
true );
3063 mChangeStrokeColorButton->setColor(
mLayer->svgStrokeColor() );
3064 mChangeStrokeColorButton->blockSignals(
false );
3065 mStrokeWidthSpinBox->blockSignals(
true );
3066 mStrokeWidthSpinBox->setValue(
mLayer->svgStrokeWidth() );
3067 mStrokeWidthSpinBox->blockSignals(
false );
3088 mSvgSelectorWidget->sourceLineEdit()->setMessageBar(
context.messageBar() );
3091void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
3100void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
3107 mLayer->setSvgFilePath( text );
3112void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
3114 mLayer->setSvgFilePath( name );
3115 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
3121void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
3123 mLayer->setParameters( parameters );
3124 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
3131void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
3143 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
3144 QColor defaultFill, defaultStroke;
3145 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
3146 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
3148 mSvgSelectorWidget->sourceLineEdit()->source(),
3150 hasDefaultFillColor,
3152 hasFillOpacityParam,
3153 hasDefaultFillOpacity,
3156 hasDefaultStrokeColor,
3158 hasStrokeWidthParam,
3159 hasDefaultStrokeWidth,
3161 hasStrokeOpacityParam,
3162 hasDefaultStrokeOpacity,
3163 defaultStrokeOpacity
3167 QColor fill = mChangeColorButton->color();
3168 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
3169 if ( hasDefaultFillColor )
3173 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
3174 mChangeColorButton->setColor( fill );
3176 mChangeColorButton->setEnabled( hasFillParam );
3177 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
3180 QColor stroke = mChangeStrokeColorButton->color();
3181 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
3182 if ( hasDefaultStrokeColor )
3184 stroke = defaultStroke;
3186 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
3187 mChangeStrokeColorButton->setColor( stroke );
3189 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
3190 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
3191 if ( hasDefaultStrokeWidth && resetValues )
3193 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
3195 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
3198void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
3205 mLayer->setSvgFillColor( color );
3209void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
3216 mLayer->setSvgStrokeColor( color );
3220void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3224 mLayer->setSvgStrokeWidth( d );
3229void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
3233 mLayer->setPatternWidthUnit( mTextureWidthUnitWidget->unit() );
3234 mLayer->setPatternWidthMapUnitScale( mTextureWidthUnitWidget->getMapUnitScale() );
3239void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3243 mLayer->setSvgStrokeWidthUnit( mSvgStrokeWidthUnitWidget->unit() );
3244 mLayer->setSvgStrokeWidthMapUnitScale( mSvgStrokeWidthUnitWidget->getMapUnitScale() );
3255 connect( mAngleSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3256 connect( mDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3257 connect( mOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3260 mDistanceUnitWidget->setUnits(
3263 mOffsetUnitWidget->setUnits(
3273 mOffsetSpinBox->setClearValue( 0 );
3274 mAngleSpinBox->setClearValue( 0 );
3278 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3289 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3300 if ( layer->
layerType() !=
"LinePatternFill"_L1 )
3314 mDistanceUnitWidget->blockSignals(
true );
3315 mDistanceUnitWidget->setUnit(
mLayer->distanceUnit() );
3317 mDistanceUnitWidget->blockSignals(
false );
3318 mOffsetUnitWidget->blockSignals(
true );
3319 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3320 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3321 mOffsetUnitWidget->blockSignals(
false );
3323 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3325 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3339void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3348void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3352 mLayer->setDistance( d );
3357void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3366void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3370 mLayer->setDistanceUnit( mDistanceUnitWidget->unit() );
3371 mLayer->setDistanceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
3376void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3380 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
3381 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
3392 connect( mHorizontalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3393 connect( mVerticalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3394 connect( mHorizontalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3395 connect( mVerticalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3396 connect( mHorizontalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3397 connect( mVerticalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3398 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3399 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3400 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3401 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3402 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3403 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3404 mHorizontalDistanceUnitWidget->setUnits(
3407 mVerticalDistanceUnitWidget->setUnits(
3410 mHorizontalDisplacementUnitWidget->setUnits(
3420 mVerticalDisplacementUnitWidget->setUnits(
3430 mHorizontalOffsetUnitWidget->setUnits(
3440 mVerticalOffsetUnitWidget->setUnits(
3455 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3465 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
3473 mSeedSpinBox->setShowClearButton(
true );
3474 mSeedSpinBox->setClearValue( 0 );
3475 mRandomXSpinBox->setClearValue( 0 );
3476 mRandomYSpinBox->setClearValue( 0 );
3478 mRandomXOffsetUnitWidget->setUnits(
3488 mRandomYOffsetUnitWidget->setUnits(
3498 connect( mRandomXSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3501 mLayer->setMaximumRandomDeviationX( d );
3505 connect( mRandomYSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3508 mLayer->setMaximumRandomDeviationY( d );
3515 mLayer->setRandomDeviationXUnit( mRandomXOffsetUnitWidget->unit() );
3516 mLayer->setRandomDeviationXMapUnitScale( mRandomXOffsetUnitWidget->getMapUnitScale() );
3523 mLayer->setRandomDeviationYUnit( mRandomYOffsetUnitWidget->unit() );
3524 mLayer->setRandomDeviationYMapUnitScale( mRandomYOffsetUnitWidget->getMapUnitScale() );
3528 connect( mSeedSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [
this](
int v ) {
3536 mAngleSpinBox->setShowClearButton(
true );
3537 mAngleSpinBox->setClearValue( 0 );
3538 connect( mAngleSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
3549 if ( !layer || layer->
layerType() !=
"PointPatternFill"_L1 )
3563 mHorizontalDistanceUnitWidget->blockSignals(
true );
3564 mHorizontalDistanceUnitWidget->setUnit(
mLayer->distanceXUnit() );
3566 mHorizontalDistanceUnitWidget->blockSignals(
false );
3567 mVerticalDistanceUnitWidget->blockSignals(
true );
3568 mVerticalDistanceUnitWidget->setUnit(
mLayer->distanceYUnit() );
3569 mVerticalDistanceUnitWidget->setMapUnitScale(
mLayer->distanceYMapUnitScale() );
3570 mVerticalDistanceUnitWidget->blockSignals(
false );
3571 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3572 mHorizontalDisplacementUnitWidget->setUnit(
mLayer->displacementXUnit() );
3573 mHorizontalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementXMapUnitScale() );
3574 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3575 mVerticalDisplacementUnitWidget->blockSignals(
true );
3576 mVerticalDisplacementUnitWidget->setUnit(
mLayer->displacementYUnit() );
3577 mVerticalDisplacementUnitWidget->setMapUnitScale(
mLayer->displacementYMapUnitScale() );
3578 mVerticalDisplacementUnitWidget->blockSignals(
false );
3579 mHorizontalOffsetUnitWidget->blockSignals(
true );
3580 mHorizontalOffsetUnitWidget->setUnit(
mLayer->offsetXUnit() );
3581 mHorizontalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetXMapUnitScale() );
3582 mHorizontalOffsetUnitWidget->blockSignals(
false );
3583 mVerticalOffsetUnitWidget->blockSignals(
true );
3584 mVerticalOffsetUnitWidget->setUnit(
mLayer->offsetYUnit() );
3585 mVerticalOffsetUnitWidget->setMapUnitScale(
mLayer->offsetYMapUnitScale() );
3586 mVerticalOffsetUnitWidget->blockSignals(
false );
3588 whileBlocking( mClipModeComboBox )->setCurrentIndex( mClipModeComboBox->findData(
static_cast<int>(
mLayer->clipMode() ) ) );
3589 whileBlocking( mCoordinateReferenceComboBox )->setCurrentIndex( mCoordinateReferenceComboBox->findData(
static_cast<int>(
mLayer->coordinateReference() ) ) );
3594 whileBlocking( mRandomXOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationXMapUnitScale() );
3596 whileBlocking( mRandomYOffsetUnitWidget )->setMapUnitScale(
mLayer->randomDeviationYMapUnitScale() );
3618void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3627void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3631 mLayer->setDistanceY( d );
3636void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3640 mLayer->setDisplacementX( d );
3645void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3649 mLayer->setDisplacementY( d );
3654void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3663void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3672void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3676 mLayer->setDistanceXUnit( mHorizontalDistanceUnitWidget->unit() );
3677 mLayer->setDistanceXMapUnitScale( mHorizontalDistanceUnitWidget->getMapUnitScale() );
3682void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3686 mLayer->setDistanceYUnit( mVerticalDistanceUnitWidget->unit() );
3687 mLayer->setDistanceYMapUnitScale( mVerticalDistanceUnitWidget->getMapUnitScale() );
3692void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3696 mLayer->setDisplacementXUnit( mHorizontalDisplacementUnitWidget->unit() );
3697 mLayer->setDisplacementXMapUnitScale( mHorizontalDisplacementUnitWidget->getMapUnitScale() );
3702void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3706 mLayer->setDisplacementYUnit( mVerticalDisplacementUnitWidget->unit() );
3707 mLayer->setDisplacementYMapUnitScale( mVerticalDisplacementUnitWidget->getMapUnitScale() );
3712void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3716 mLayer->setOffsetXUnit( mHorizontalOffsetUnitWidget->unit() );
3717 mLayer->setOffsetXMapUnitScale( mHorizontalOffsetUnitWidget->getMapUnitScale() );
3722void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3726 mLayer->setOffsetYUnit( mVerticalOffsetUnitWidget->unit() );
3727 mLayer->setOffsetYMapUnitScale( mVerticalOffsetUnitWidget->getMapUnitScale() );
3753 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3754 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3755 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3756 mSizeUnitWidget->setUnits(
3759 mStrokeWidthUnitWidget->setUnits(
3762 mOffsetUnitWidget->setUnits(
3768 scrollArea->setVerticalOnly(
true );
3770 btnColor->setAllowOpacity(
true );
3771 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3772 btnColor->setContext( u
"symbology"_s );
3773 btnStrokeColor->setAllowOpacity(
true );
3774 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3775 btnStrokeColor->setContext( u
"symbology"_s );
3777 mColorDDBtn->registerLinkedWidget( btnColor );
3778 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3780 spinOffsetX->setClearValue( 0.0 );
3781 spinOffsetY->setClearValue( 0.0 );
3782 spinAngle->setClearValue( 0.0 );
3785 mAssistantPreviewSymbol = std::make_shared<QgsMarkerSymbol>();
3788 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3791 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3793 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3796 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3798 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3799 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3810 if ( layer->
layerType() !=
"FontMarker"_L1 )
3819 mFontStyleComboBox->blockSignals(
true );
3820 populateFontStyleComboBox();
3821 mFontStyleComboBox->blockSignals(
false );
3833 if (
mLayer->character().length() == 1 )
3839 mCharPreview->setFont( mRefFont );
3845 mSizeUnitWidget->blockSignals(
true );
3846 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
3847 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
3848 mSizeUnitWidget->blockSignals(
false );
3850 mStrokeWidthUnitWidget->blockSignals(
true );
3851 mStrokeWidthUnitWidget->setUnit(
mLayer->strokeWidthUnit() );
3852 mStrokeWidthUnitWidget->setMapUnitScale(
mLayer->strokeWidthMapUnitScale() );
3853 mStrokeWidthUnitWidget->blockSignals(
false );
3855 mOffsetUnitWidget->blockSignals(
true );
3856 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
3857 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
3858 mOffsetUnitWidget->blockSignals(
false );
3863 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
3864 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
3879 updateAssistantSymbol();
3891 mLayer->setFontFamily( font.family() );
3894 mCharPreview->setFont( mRefFont );
3895 populateFontStyleComboBox();
3900void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3907 mCharPreview->setFont( mRefFont );
3914 mLayer->setColor( color );
3920 mLayer->setStrokeColor( color );
3933 mLayer->setAngle( angle );
3939 mCharPreview->setText( text );
3941 if ( text.isEmpty() )
3945 QString character = text;
3946 if ( text.contains( QRegularExpression( u
"^0x[0-9a-fA-F]{1,4}$"_s ) ) )
3949 const unsigned int value = text.toUInt( &ok, 0 );
3952 character = QChar( value );
3953 mCharPreview->setText( character );
3957 if ( character !=
mLayer->character() )
3959 mLayer->setCharacter( character );
3960 if (
mLayer->character().length() == 1 )
3974 if (
mLayer->character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3976 mCharLineEdit->insert( chr );
3980 mLayer->setCharacter( chr );
3982 mCharPreview->setText( chr );
3986void QgsFontMarkerSymbolLayerWidget::setOffset()
3988 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3992void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3994 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
3998void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4002 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4003 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4008void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4012 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4013 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4018void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
4022 mLayer->setStrokeWidthUnit( mSizeUnitWidget->unit() );
4023 mLayer->setStrokeWidthMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4028void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
4030 mFontStyleComboBox->clear();
4031 const QStringList styles = mFontDB.styles( mRefFont.family() );
4032 const auto constStyles = styles;
4033 for (
const QString &style : constStyles )
4035 mFontStyleComboBox->addItem( style );
4038 QString targetStyle = mFontDB.styleString( mRefFont );
4039 if ( !styles.contains( targetStyle ) )
4042 targetStyle = QFontInfo( f ).styleName();
4043 mRefFont.setStyleName( targetStyle );
4046 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
4047 if ( stylIndx > -1 )
4052 mFontStyleComboBox->setCurrentIndex( curIndx );
4055void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
4058 setFontStyle( mFontStyleComboBox->currentText() );
4061void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4070void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4079void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
4083 mLayer->setStrokeWidth( d );
4088void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
4090 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
4092 mAssistantPreviewSymbol->deleteSymbolLayer( i );
4094 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->clone() );
4097 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
4109 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
4110 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
4111 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
4112 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
4117 if ( layer->
layerType() !=
"CentroidFill"_L1 )
4127 whileBlocking( mClipOnCurrentPartOnlyCheckBox )->setChecked(
mLayer->clipOnCurrentPartOnly() );
4135void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
4141void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
4143 mLayer->setPointOnAllParts( state == Qt::Checked );
4147void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
4149 mLayer->setClipPoints( state == Qt::Checked );
4153void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
4155 mLayer->setClipOnCurrentPartOnly( state == Qt::Checked );
4176 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4180 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
4182 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
4183 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
4186 mSizeUnitWidget->setUnits(
4196 mOffsetUnitWidget->setUnits(
4200 mSpinOffsetX->setClearValue( 0.0 );
4201 mSpinOffsetY->setClearValue( 0.0 );
4202 mRotationSpinBox->setClearValue( 0.0 );
4204 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4205 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
4208 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4209 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4219 if ( layer->
layerType() !=
"RasterMarker"_L1 )
4229 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4230 mHeightSpinBox->blockSignals(
true );
4231 if ( preservedAspectRatio )
4233 mHeightSpinBox->setValue(
mLayer->size() );
4237 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4239 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4240 mHeightSpinBox->blockSignals(
false );
4241 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4249 mSizeUnitWidget->blockSignals(
true );
4250 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4251 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4252 mSizeUnitWidget->blockSignals(
false );
4253 mOffsetUnitWidget->blockSignals(
true );
4254 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4255 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4256 mOffsetUnitWidget->blockSignals(
false );
4259 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4260 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4271 updatePreviewImage();
4282 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4285void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4288 updatePreviewImage();
4292void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
4294 bool fitsInCache =
false;
4296 if ( image.isNull() )
4298 mLabelImagePreview->setPixmap( QPixmap() );
4302 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4303 previewImage.fill( Qt::transparent );
4304 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4306 p.begin( &previewImage );
4308 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4309 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4310 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4311 QBrush checkerBrush;
4312 checkerBrush.setTexture( pix );
4313 p.fillRect( imageRect, checkerBrush );
4315 if (
mLayer->opacity() < 1.0 )
4317 p.setOpacity(
mLayer->opacity() );
4320 p.drawImage( imageRect.left(), imageRect.top(), image );
4322 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4325void QgsRasterMarkerSymbolLayerWidget::setWidth()
4327 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4328 double fixedAspectRatio = 0.0;
4329 mHeightSpinBox->blockSignals(
true );
4330 if ( defaultAspectRatio <= 0.0 )
4332 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4334 else if ( mLockAspectRatio->locked() )
4336 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4340 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4342 mHeightSpinBox->blockSignals(
false );
4343 mLayer->setSize( mWidthSpinBox->value() );
4344 mLayer->setFixedAspectRatio( fixedAspectRatio );
4348void QgsRasterMarkerSymbolLayerWidget::setHeight()
4350 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4351 double fixedAspectRatio = 0.0;
4352 mWidthSpinBox->blockSignals(
true );
4353 if ( defaultAspectRatio <= 0.0 )
4355 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4357 else if ( mLockAspectRatio->locked() )
4359 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4363 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4365 mWidthSpinBox->blockSignals(
false );
4366 mLayer->setSize( mWidthSpinBox->value() );
4367 mLayer->setFixedAspectRatio( fixedAspectRatio );
4371void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4373 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4374 if ( defaultAspectRatio <= 0.0 )
4380 mLayer->setFixedAspectRatio( 0.0 );
4385 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4389void QgsRasterMarkerSymbolLayerWidget::setAngle()
4391 mLayer->setAngle( mRotationSpinBox->value() );
4395void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4397 mLayer->setOpacity( value );
4399 updatePreviewImage();
4402void QgsRasterMarkerSymbolLayerWidget::setOffset()
4404 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4408void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4412 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4413 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4418void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4422 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4423 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4428void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4437void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4464 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastAnimatedMarkerImageDir"_s );
4468 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4470 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4471 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4474 mFrameRateSpin->setClearValue( 10 );
4475 mFrameRateSpin->setShowClearButton(
true );
4476 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double value ) {
4477 mLayer->setFrameRate( value );
4481 mSizeUnitWidget->setUnits(
4491 mOffsetUnitWidget->setUnits(
4495 mSpinOffsetX->setClearValue( 0.0 );
4496 mSpinOffsetY->setClearValue( 0.0 );
4497 mRotationSpinBox->setClearValue( 0.0 );
4499 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4500 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4503 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4504 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4514 if ( layer->
layerType() !=
"AnimatedMarker"_L1 )
4524 if ( firstFrameTime > 0 )
4526 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4530 mFrameRateSpin->setClearValue( 10 );
4534 const bool preservedAspectRatio =
mLayer->preservedAspectRatio();
4535 mHeightSpinBox->blockSignals(
true );
4536 if ( preservedAspectRatio )
4538 mHeightSpinBox->setValue(
mLayer->size() );
4542 mHeightSpinBox->setValue(
mLayer->size() *
mLayer->fixedAspectRatio() );
4544 mHeightSpinBox->setEnabled(
mLayer->defaultAspectRatio() > 0.0 );
4545 mHeightSpinBox->blockSignals(
false );
4546 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4556 mSizeUnitWidget->blockSignals(
true );
4557 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4558 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4559 mSizeUnitWidget->blockSignals(
false );
4560 mOffsetUnitWidget->blockSignals(
true );
4561 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4562 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4563 mOffsetUnitWidget->blockSignals(
false );
4566 whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue(
mLayer->horizontalAnchorPoint() ) ) );
4567 whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue(
mLayer->verticalAnchorPoint() ) ) );
4578 updatePreviewImage();
4589 mImageSourceLineEdit->setMessageBar(
context.messageBar() );
4592void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4597 if ( firstFrameTime > 0 )
4599 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4603 mFrameRateSpin->setClearValue( 10 );
4605 updatePreviewImage();
4609void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4611 if ( mPreviewMovie )
4613 mLabelImagePreview->setMovie(
nullptr );
4614 mPreviewMovie->deleteLater();
4615 mPreviewMovie =
nullptr;
4618 mPreviewMovie =
new QMovie(
mLayer->path(), QByteArray(),
this );
4619 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4620 mLabelImagePreview->setMovie( mPreviewMovie );
4621 mPreviewMovie->start();
4624void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4626 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4627 double fixedAspectRatio = 0.0;
4628 mHeightSpinBox->blockSignals(
true );
4629 if ( defaultAspectRatio <= 0.0 )
4631 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4633 else if ( mLockAspectRatio->locked() )
4635 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4639 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4641 mHeightSpinBox->blockSignals(
false );
4642 mLayer->setSize( mWidthSpinBox->value() );
4643 mLayer->setFixedAspectRatio( fixedAspectRatio );
4647void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4649 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4650 double fixedAspectRatio = 0.0;
4651 mWidthSpinBox->blockSignals(
true );
4652 if ( defaultAspectRatio <= 0.0 )
4654 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4656 else if ( mLockAspectRatio->locked() )
4658 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4662 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4664 mWidthSpinBox->blockSignals(
false );
4665 mLayer->setSize( mWidthSpinBox->value() );
4666 mLayer->setFixedAspectRatio( fixedAspectRatio );
4670void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4672 const double defaultAspectRatio =
mLayer->defaultAspectRatio();
4673 if ( defaultAspectRatio <= 0.0 )
4679 mLayer->setFixedAspectRatio( 0.0 );
4684 mLayer->setFixedAspectRatio( mHeightSpinBox->value() / mWidthSpinBox->value() );
4688void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4690 mLayer->setAngle( mRotationSpinBox->value() );
4694void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4696 mLayer->setOpacity( value );
4698 updatePreviewImage();
4701void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4703 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4707void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4711 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4712 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4717void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4721 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4722 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4727void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int )
4736void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int )
4753 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4757 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4764 mLayer->setSizeUnit( mSizeUnitWidget->unit() );
4765 mLayer->setSizeMapUnitScale( mSizeUnitWidget->getMapUnitScale() );
4768 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4777 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double d ) {
4786 mSizeUnitWidget->setUnits(
4796 mOffsetUnitWidget->setUnits(
4800 mSpinOffsetX->setClearValue( 0.0 );
4801 mSpinOffsetY->setClearValue( 0.0 );
4802 mRotationSpinBox->setClearValue( 0.0 );
4804 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4805 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4806 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4818 if ( layer->
layerType() !=
"RasterFill"_L1 )
4831 cboCoordinateMode->blockSignals(
true );
4832 switch (
mLayer->coordinateMode() )
4835 cboCoordinateMode->setCurrentIndex( 1 );
4839 cboCoordinateMode->setCurrentIndex( 0 );
4842 cboCoordinateMode->blockSignals(
false );
4848 mOffsetUnitWidget->blockSignals(
true );
4849 mOffsetUnitWidget->setUnit(
mLayer->offsetUnit() );
4850 mOffsetUnitWidget->setMapUnitScale(
mLayer->offsetMapUnitScale() );
4851 mOffsetUnitWidget->blockSignals(
false );
4854 mSizeUnitWidget->blockSignals(
true );
4855 mSizeUnitWidget->setUnit(
mLayer->sizeUnit() );
4856 mSizeUnitWidget->setMapUnitScale(
mLayer->sizeMapUnitScale() );
4857 mSizeUnitWidget->blockSignals(
false );
4861 updatePreviewImage();
4876void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4879 updatePreviewImage();
4883void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4900void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4907 mLayer->setOpacity( value );
4909 updatePreviewImage();
4912void QgsRasterFillSymbolLayerWidget::offsetChanged()
4914 mLayer->setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4918void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4924 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
4925 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
4929void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4938void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4940 bool fitsInCache =
false;
4942 if ( image.isNull() )
4944 mLabelImagePreview->setPixmap( QPixmap() );
4948 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4949 previewImage.fill( Qt::transparent );
4950 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4952 p.begin( &previewImage );
4954 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4955 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4956 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4957 QBrush checkerBrush;
4958 checkerBrush.setTexture( pix );
4959 p.fillRect( imageRect, checkerBrush );
4961 if (
mLayer->opacity() < 1.0 )
4963 p.setOpacity(
mLayer->opacity() );
4966 p.drawImage( imageRect.left(), imageRect.top(), image );
4968 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4982 mImageSourceLineEdit->setLastPathSettingsKey( u
"/UI/lastRasterMarkerImageDir"_s );
4984 mPenWidthUnitWidget->setUnits(
4987 mOffsetUnitWidget->setUnits(
4994 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
4995 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5000 connect( spinWidth, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5003 mLayer->setWidth( spinWidth->value() );
5011 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5012 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5018 spinOffset->setClearValue( 0.0 );
5019 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5022 mLayer->setOffset( val );
5027 connect( cboCapStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5030 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5034 connect( cboJoinStyle, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5037 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5046 mLayer->setOpacity( opacity );
5047 updatePreviewImage();
5060 if ( layer->
layerType() !=
"RasterLine"_L1 )
5084 updatePreviewImage();
5099void QgsRasterLineSymbolLayerWidget::imageSourceChanged(
const QString &text )
5102 updatePreviewImage();
5106void QgsRasterLineSymbolLayerWidget::updatePreviewImage()
5108 bool fitsInCache =
false;
5110 if ( image.isNull() )
5112 mLabelImagePreview->setPixmap( QPixmap() );
5116 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
5117 previewImage.fill( Qt::transparent );
5118 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
5120 p.begin( &previewImage );
5122 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
5123 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
5124 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
5125 QBrush checkerBrush;
5126 checkerBrush.setTexture( pix );
5127 p.fillRect( imageRect, checkerBrush );
5129 if (
mLayer->opacity() < 1.0 )
5131 p.setOpacity(
mLayer->opacity() );
5134 p.drawImage( imageRect.left(), imageRect.top(), image );
5136 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
5149 modificationExpressionSelector->setMultiLine(
true );
5150 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
5151 modificationExpressionSelector->registerExpressionContextGenerator(
this );
5157 mUnitWidget->setShowMapScaleButton(
false );
5160 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
5162 if ( !mBlockSignals )
5164 mLayer->setUnits( mUnitWidget->unit() );
5174 modificationExpressionSelector->setExpression( mLayer->geometryExpression() );
5175 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData(
static_cast<int>( mLayer->symbolType() ) ) );
5176 mUnitWidget->setUnit( mLayer->units() );
5185void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
5192void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
5195 std::unique_ptr<QgsSymbol> subSymbol( mLayer->subSymbol()->clone() );
5197 mLayer->setSymbolType(
static_cast<Qgis::SymbolType>( cbxGeometryType->currentData().toInt() ) );
5199 switch ( mLayer->symbolType() )
5210 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5212 if (
dynamic_cast<const QgsLineSymbolLayer *
>( subSymbol->symbolLayer( i ) ) )
5213 layers << subSymbol->symbolLayer( i )->clone();
5216 if ( !layers.empty() )
5217 mLayer->setSubSymbol(
new QgsLineSymbol( layers ) );
5226 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
5227 layers << subSymbol->symbolLayer( i )->clone();
5228 mLayer->setSubSymbol(
new QgsFillSymbol( layers ) );
5249 mPointCountSpinBox->setShowClearButton(
true );
5250 mPointCountSpinBox->setClearValue( 100 );
5251 mSeedSpinBox->setShowClearButton(
true );
5252 mSeedSpinBox->setClearValue( 0 );
5254 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
5255 connect( mPointCountSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
5256 connect( mDensityAreaSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
5257 connect( mSeedSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
5258 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5261 mLayer->setClipPoints( checked );
5266 mDensityAreaUnitWidget->setUnits(
5275 if ( !layer || layer->
layerType() !=
"RandomMarkerFill"_L1 )
5281 whileBlocking( mPointCountSpinBox )->setValue( mLayer->pointCount() );
5283 whileBlocking( mClipPointsCheckBox )->setChecked( mLayer->clipPoints() );
5285 bool showDensityBasedCountWidgets =
false;
5286 switch ( mLayer->countMethod() )
5289 showDensityBasedCountWidgets =
true;
5294 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5295 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5296 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5297 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5299 whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData(
static_cast<int>( mLayer->countMethod() ) ) );
5300 whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
5301 mDensityAreaUnitWidget->blockSignals(
true );
5302 mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
5303 mDensityAreaUnitWidget->
setMapUnitScale( mLayer->densityAreaUnitScale() );
5304 mDensityAreaUnitWidget->blockSignals(
false );
5317void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
5319 bool showDensityBasedCountWidgets =
false;
5323 showDensityBasedCountWidgets =
true;
5328 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5329 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5330 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5331 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5335 mLayer->setCountMethod(
static_cast<Qgis::PointCountMethod>( mCountMethodComboBox->currentData().toInt() ) );
5340void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
5344 mLayer->setPointCount( d );
5349void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
5353 mLayer->setDensityArea( d );
5358void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
5362 mLayer->setDensityAreaUnit( mDensityAreaUnitWidget->unit() );
5363 mLayer->setDensityAreaUnitScale( mDensityAreaUnitWidget->getMapUnitScale() );
5368void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
5372 mLayer->setSeed( d );
5387 btnColorRamp->setShowGradientOnly(
true );
5389 btnChangeColor->setAllowOpacity(
true );
5390 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5391 btnChangeColor->setContext( u
"symbology"_s );
5392 btnChangeColor->setShowNoColor(
true );
5393 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
5394 btnChangeColor->setOpaqueColorString( tr(
"Opaque" ) );
5395 btnChangeColor2->setAllowOpacity(
true );
5396 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5397 btnChangeColor2->setContext( u
"symbology"_s );
5398 btnChangeColor2->setShowNoColor(
true );
5399 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
5400 btnChangeColor2->setOpaqueColorString( tr(
"Opaque" ) );
5402 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
5403 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
5408 mLayer->setColor( color );
5415 mLayer->setColor2( color );
5420 if ( btnColorRamp->isNull() )
5425 mLayer->setColorRamp( btnColorRamp->colorRamp()->clone() );
5430 connect( radioTwoColor, &QAbstractButton::toggled,
this, [
this] {
5433 if ( radioTwoColor->isChecked() )
5436 btnChangeColor->setEnabled(
true );
5437 btnChangeColor2->setEnabled(
true );
5438 btnColorRamp->setEnabled(
false );
5443 btnColorRamp->setEnabled(
true );
5444 btnChangeColor->setEnabled(
false );
5445 btnChangeColor2->setEnabled(
false );
5451 mPenWidthUnitWidget->setUnits(
5454 mOffsetUnitWidget->setUnits(
5461 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5462 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5467 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5470 mLayer->setWidth( spinWidth->value() );
5478 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5479 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5484 spinOffset->setClearValue( 0.0 );
5485 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5488 mLayer->setOffset( val );
5493 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5496 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5500 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5503 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5516 if ( layer->
layerType() !=
"Lineburst"_L1 )
5527 btnChangeColor->blockSignals(
true );
5529 btnChangeColor->blockSignals(
false );
5530 btnChangeColor2->blockSignals(
true );
5531 btnChangeColor2->setColor(
mLayer->color2() );
5532 btnChangeColor2->blockSignals(
false );
5536 radioTwoColor->setChecked(
true );
5537 btnColorRamp->setEnabled(
false );
5541 radioColorRamp->setChecked(
true );
5542 btnChangeColor->setEnabled(
false );
5543 btnChangeColor2->setEnabled(
false );
5547 if (
mLayer->colorRamp() )
5549 btnColorRamp->blockSignals(
true );
5550 btnColorRamp->setColorRamp(
mLayer->colorRamp() );
5551 btnColorRamp->blockSignals(
false );
5588 mPenWidthUnitWidget->setUnits(
5591 mOffsetUnitWidget->setUnits(
5598 mLayer->setWidthUnit( mPenWidthUnitWidget->unit() );
5599 mLayer->setWidthMapUnitScale( mPenWidthUnitWidget->getMapUnitScale() );
5604 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [
this] {
5607 mLayer->setWidth( spinWidth->value() );
5615 mLayer->setOffsetUnit( mOffsetUnitWidget->unit() );
5616 mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
5621 spinOffset->setClearValue( 0.0 );
5622 connect( spinOffset, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [
this](
double val ) {
5625 mLayer->setOffset( val );
5630 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5633 mLayer->setPenCapStyle( cboCapStyle->penCapStyle() );
5637 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [
this] {
5640 mLayer->setPenJoinStyle( cboJoinStyle->penJoinStyle() );
5655 if ( layer->
layerType() !=
"FilledLine"_L1 )
5667 whileBlocking( mPenWidthUnitWidget )->setUnit( mLayer->widthUnit() );
5670 whileBlocking( mOffsetUnitWidget )->setUnit( mLayer->offsetUnit() );
5671 whileBlocking( mOffsetUnitWidget )->setMapUnitScale( mLayer->offsetMapUnitScale() );
5674 whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
5675 whileBlocking( cboCapStyle )->setPenCapStyle( mLayer->penCapStyle() );
5708 mSpinSkipMultiples->setClearValue( 0, tr(
"Not set" ) );
5709 mSpinLabelOffsetX->setClearValue( 0 );
5710 mSpinLabelOffsetY->setClearValue( 0 );
5711 mSpinAverageAngleLength->setClearValue( 4.0 );
5712 mLabelOffsetUnitWidget->setUnits(
5715 mAverageAngleUnit->setUnits(
5719 connect( mComboQuantity, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5720 if ( mLayer && !mBlockChangesSignal )
5727 if ( mLayer && !mBlockChangesSignal )
5729 mLayer->setTextFormat( mTextFormatButton->textFormat() );
5733 connect( spinInterval, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5734 if ( mLayer && !mBlockChangesSignal )
5736 mLayer->setInterval( spinInterval->value() );
5740 connect( mSpinSkipMultiples, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5741 if ( mLayer && !mBlockChangesSignal )
5743 mLayer->setSkipMultiplesOf( mSpinSkipMultiples->value() );
5747 connect( mCheckRotate, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5748 if ( mLayer && !mBlockChangesSignal )
5750 mLayer->setRotateLabels( checked );
5753 mSpinAverageAngleLength->setEnabled( checked );
5754 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5756 connect( mCheckShowMarker, &QCheckBox::toggled,
this, [
this](
bool checked ) {
5757 if ( mLayer && !mBlockChangesSignal )
5759 mLayer->setShowMarker( checked );
5764 connect( mSpinLabelOffsetX, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5765 if ( mLayer && !mBlockChangesSignal )
5767 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5771 connect( mSpinLabelOffsetY, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5772 if ( mLayer && !mBlockChangesSignal )
5774 mLayer->setLabelOffset( QPointF( mSpinLabelOffsetX->value(), mSpinLabelOffsetY->value() ) );
5779 if ( mLayer && !mBlockChangesSignal )
5781 mLayer->setLabelOffsetUnit( mLabelOffsetUnitWidget->unit() );
5782 mLayer->setLabelOffsetMapUnitScale( mLabelOffsetUnitWidget->getMapUnitScale() );
5787 connect( mComboPlacement, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this] {
5788 if ( mLayer && !mBlockChangesSignal )
5791 mLayer->setPlacement( placement );
5792 switch ( placement )
5797 mIntervalWidget->show();
5800 mIntervalWidget->hide();
5807 connect( mSpinAverageAngleLength, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this] {
5808 if ( mLayer && !mBlockChangesSignal )
5810 mLayer->setAverageAngleLength( mSpinAverageAngleLength->value() );
5815 if ( mLayer && !mBlockChangesSignal )
5817 mLayer->setAverageAngleUnit( mAverageAngleUnit->unit() );
5818 mLayer->setAverageAngleMapUnitScale( mAverageAngleUnit->getMapUnitScale() );
5823 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsLinearReferencingSymbolLayerWidget::changeNumberFormat );
5825 mTextFormatButton->registerExpressionContextGenerator(
this );
5833 if ( !layer || layer->
layerType() !=
"LinearReferencing"_L1 )
5837 mLayer = qgis::down_cast<QgsLinearReferencingSymbolLayer *>( layer );
5839 mBlockChangesSignal =
true;
5841 mComboPlacement->setCurrentIndex( mComboPlacement->findData( QVariant::fromValue( mLayer->placement() ) ) );
5842 switch ( mLayer->placement() )
5847 mIntervalWidget->show();
5850 mIntervalWidget->hide();
5854 mComboQuantity->setCurrentIndex( mComboQuantity->findData( QVariant::fromValue( mLayer->labelSource() ) ) );
5856 mTextFormatButton->setTextFormat( mLayer->textFormat() );
5857 spinInterval->setValue( mLayer->interval() );
5858 mSpinSkipMultiples->setValue( mLayer->skipMultiplesOf() );
5859 mCheckRotate->setChecked( mLayer->rotateLabels() );
5860 mCheckShowMarker->setChecked( mLayer->showMarker() );
5861 mSpinLabelOffsetX->setValue( mLayer->labelOffset().x() );
5862 mSpinLabelOffsetY->setValue( mLayer->labelOffset().y() );
5863 mLabelOffsetUnitWidget->setUnit( mLayer->labelOffsetUnit() );
5864 mLabelOffsetUnitWidget->setMapUnitScale( mLayer->labelOffsetMapUnitScale() );
5866 mAverageAngleUnit->setUnit( mLayer->averageAngleUnit() );
5867 mAverageAngleUnit->setMapUnitScale( mLayer->averageAngleMapUnitScale() );
5868 mSpinAverageAngleLength->setValue( mLayer->averageAngleLength() );
5870 mSpinAverageAngleLength->setEnabled( mCheckRotate->isChecked() );
5871 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
5878 mBlockChangesSignal =
false;
5889 mTextFormatButton->setMapCanvas(
context.mapCanvas() );
5890 mTextFormatButton->setMessageBar(
context.messageBar() );
5893void QgsLinearReferencingSymbolLayerWidget::changeNumberFormat()
5903 if ( !mBlockChangesSignal )
5913 QgsNumericFormatSelectorDialog dialog(
this );
5914 dialog.setFormat( mLayer->numericFormat() );
5915 dialog.registerExpressionContextGenerator(
this );
5916 if ( dialog.exec() )
5918 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
constexpr QObjectUniquePtr< Tp > make_qobject_unique(Args &&...args)
Create an object owned by a QObjectUniquePtr.
Single variable definition for use within a QgsExpressionContextScope.