52 #include <QAbstractButton>
53 #include <QButtonGroup>
54 #include <QColorDialog>
57 #include <QFileDialog>
59 #include <QStandardItemModel>
60 #include <QSvgRenderer>
61 #include <QMessageBox>
64 #include <QInputDialog>
66 #include <QRegularExpression>
72 return *lExpressionContext;
83 expContext << symbolScope;
105 QStringList highlights;
111 << QStringLiteral(
"symbol_layer_count" ) << QStringLiteral(
"symbol_layer_index" ) << QStringLiteral(
"symbol_frame" );
114 if ( expContext.
hasVariable( QStringLiteral(
"zoom_level" ) ) )
116 highlights << QStringLiteral(
"zoom_level" );
118 if ( expContext.
hasVariable( QStringLiteral(
"vector_tile_zoom" ) ) )
120 highlights << QStringLiteral(
"vector_tile_zoom" );
131 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
132 for ( QgsUnitSelectionWidget *unitWidget : unitSelectionWidgets )
134 unitWidget->setMapCanvas( mContext.
mapCanvas() );
152 void QgsSymbolLayerWidget::createAuxiliaryField()
173 if ( dlg.exec() == QDialog::Accepted )
174 def = dlg.propertyDefinition();
184 property.setActive(
true );
206 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
207 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
211 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
213 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [ = ]
215 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
216 if ( !mCheckAlignDash->isChecked() )
217 mCheckDashCorners->setChecked(
false );
225 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [ = ]
247 btnChangeColor->setAllowOpacity(
true );
248 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
249 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
251 mColorDDBtn->registerLinkedWidget( btnChangeColor );
256 connect( mRingFilterComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
265 spinOffset->setClearValue( 0.0 );
266 spinPatternOffset->setClearValue( 0.0 );
268 mTrimStartDistanceSpin->setClearValue( 0.0 );
269 mTrimDistanceEndSpin->setClearValue( 0.0 );
275 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
277 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
279 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
280 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
281 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
282 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
283 connect( spinPatternOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
285 connect( mTrimStartDistanceSpin,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double value )
302 connect( mTrimDistanceEndSpin,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double value )
328 void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
330 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
332 mAssistantPreviewSymbol->deleteSymbolLayer( i );
334 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
337 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
343 if ( !layer || layer->
layerType() != QLatin1String(
"SimpleLine" ) )
350 mPenWidthUnitWidget->blockSignals(
true );
353 mPenWidthUnitWidget->blockSignals(
false );
354 mOffsetUnitWidget->blockSignals(
true );
357 mOffsetUnitWidget->blockSignals(
false );
358 mDashPatternUnitWidget->blockSignals(
true );
361 mDashPatternUnitWidget->blockSignals(
false );
371 spinWidth->blockSignals(
true );
373 spinWidth->blockSignals(
false );
374 btnChangeColor->blockSignals(
true );
376 btnChangeColor->blockSignals(
false );
377 spinOffset->blockSignals(
true );
379 spinOffset->blockSignals(
false );
380 cboPenStyle->blockSignals(
true );
381 cboJoinStyle->blockSignals(
true );
382 cboCapStyle->blockSignals(
true );
386 cboPenStyle->blockSignals(
false );
387 cboJoinStyle->blockSignals(
false );
388 cboCapStyle->blockSignals(
false );
395 mChangePatternButton->setEnabled( useCustomDashPattern );
396 label_3->setEnabled( !useCustomDashPattern );
397 cboPenStyle->setEnabled( !useCustomDashPattern );
398 mCustomCheckBox->blockSignals(
true );
399 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
400 mCustomCheckBox->blockSignals(
false );
403 const QSize size = mChangePatternButton->minimumSizeHint();
405 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
409 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
430 updateAssistantSymbol();
447 mDrawInsideCheckBox->hide();
448 mRingFilterComboBox->hide();
458 void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
465 void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
471 void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
480 void QgsSimpleLineSymbolLayerWidget::offsetChanged()
487 void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
494 void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
496 const bool checked = ( state == Qt::Checked );
497 mChangePatternButton->setEnabled( checked );
498 label_3->setEnabled( !checked );
499 cboPenStyle->setEnabled( !checked );
505 void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
512 widget->
setUnit( mDashPatternUnitWidget->unit() );
524 d.setUnit( mDashPatternUnitWidget->unit() );
525 if ( d.exec() == QDialog::Accepted )
533 void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
544 void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
554 void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
565 void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
567 const bool checked = ( state == Qt::Checked );
572 void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
589 std::unique_ptr< QgsSimpleLineSymbolLayer > layerCopy(
mLayer->
clone() );
594 const QColor color = qApp->palette().color( QPalette::WindowText );
595 layerCopy->setColor( color );
597 layerCopy->setOffset( 0 );
598 layerCopy->setUseCustomDashPattern(
true );
600 QSize currentIconSize;
603 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
605 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
608 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
614 const std::unique_ptr< QgsLineSymbol > previewSymbol = std::make_unique< QgsLineSymbol >(
QgsSymbolLayerList() << layerCopy.release() );
616 mChangePatternButton->setIconSize( currentIconSize );
617 mChangePatternButton->setIcon( icon );
621 const int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
622 const int height =
static_cast< int >( width / 1.61803398875 );
626 QBuffer buffer( &data );
627 pm.save( &buffer,
"PNG", 100 );
628 mChangePatternButton->setToolTip( QStringLiteral(
"<img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) ) );
633 QgsSymbolLayerWidget::resizeEvent( event );
651 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
652 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
653 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
654 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
662 btnChangeColorFill->setAllowOpacity(
true );
663 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
664 btnChangeColorFill->setContext( QStringLiteral(
"symbology" ) );
665 btnChangeColorFill->setShowNoColor(
true );
666 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
667 btnChangeColorStroke->setAllowOpacity(
true );
668 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
669 btnChangeColorStroke->setContext( QStringLiteral(
"symbology" ) );
670 btnChangeColorStroke->setShowNoColor(
true );
671 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
673 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
674 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
676 spinOffsetX->setClearValue( 0.0 );
677 spinOffsetY->setClearValue( 0.0 );
678 spinAngle->setClearValue( 0.0 );
684 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
686 int size = lstNames->iconSize().width();
688 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
690 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
691 lstNames->setIconSize( QSize( size, size ) );
693 const double markerSize = size * 0.8;
699 lyr->
setColor( QColor( 200, 200, 200 ) );
702 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
703 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
708 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
710 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
713 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
714 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
715 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
716 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
717 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
718 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
726 if ( layer->
layerType() != QLatin1String(
"SimpleMarker" ) )
734 for (
int i = 0; i < lstNames->count(); ++i )
736 if (
static_cast< Qgis::MarkerShape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
738 lstNames->setCurrentRow( i );
742 btnChangeColorStroke->blockSignals(
true );
744 btnChangeColorStroke->blockSignals(
false );
745 btnChangeColorFill->blockSignals(
true );
748 btnChangeColorFill->blockSignals(
false );
749 spinSize->blockSignals(
true );
751 spinSize->blockSignals(
false );
752 spinAngle->blockSignals(
true );
754 spinAngle->blockSignals(
false );
755 mStrokeStyleComboBox->blockSignals(
true );
757 mStrokeStyleComboBox->blockSignals(
false );
758 mStrokeWidthSpinBox->blockSignals(
true );
760 mStrokeWidthSpinBox->blockSignals(
false );
761 cboJoinStyle->blockSignals(
true );
763 cboJoinStyle->blockSignals(
false );
764 cboCapStyle->blockSignals(
true );
766 cboCapStyle->blockSignals(
false );
769 spinOffsetX->blockSignals(
true );
771 spinOffsetX->blockSignals(
false );
772 spinOffsetY->blockSignals(
true );
774 spinOffsetY->blockSignals(
false );
776 mSizeUnitWidget->blockSignals(
true );
779 mSizeUnitWidget->blockSignals(
false );
780 mOffsetUnitWidget->blockSignals(
true );
783 mOffsetUnitWidget->blockSignals(
false );
784 mStrokeWidthUnitWidget->blockSignals(
true );
787 mStrokeWidthUnitWidget->blockSignals(
false );
790 mHorizontalAnchorComboBox->blockSignals(
true );
791 mVerticalAnchorComboBox->blockSignals(
true );
794 mHorizontalAnchorComboBox->blockSignals(
false );
795 mVerticalAnchorComboBox->blockSignals(
false );
810 updateAssistantSymbol();
818 void QgsSimpleMarkerSymbolLayerWidget::setShape()
837 void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
843 void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
849 void QgsSimpleMarkerSymbolLayerWidget::setSize()
855 void QgsSimpleMarkerSymbolLayerWidget::setAngle()
861 void QgsSimpleMarkerSymbolLayerWidget::setOffset()
863 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
867 void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
878 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
887 void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
897 void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
907 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
917 void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
926 void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
935 void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
937 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
939 mAssistantPreviewSymbol->deleteSymbolLayer( i );
941 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
944 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
963 btnChangeColor->setAllowOpacity(
true );
964 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
965 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
966 btnChangeColor->setShowNoColor(
true );
967 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
968 btnChangeStrokeColor->setAllowOpacity(
true );
969 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
970 btnChangeStrokeColor->setContext( QStringLiteral(
"symbology" ) );
971 btnChangeStrokeColor->setShowNoColor(
true );
972 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
974 spinOffsetX->setClearValue( 0.0 );
975 spinOffsetY->setClearValue( 0.0 );
978 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
980 connect( spinStrokeWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
981 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
982 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
983 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
984 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
986 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
987 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
992 if ( layer->
layerType() != QLatin1String(
"SimpleFill" ) )
999 btnChangeColor->blockSignals(
true );
1001 btnChangeColor->blockSignals(
false );
1002 cboFillStyle->blockSignals(
true );
1004 cboFillStyle->blockSignals(
false );
1005 btnChangeStrokeColor->blockSignals(
true );
1007 btnChangeStrokeColor->blockSignals(
false );
1008 cboStrokeStyle->blockSignals(
true );
1010 cboStrokeStyle->blockSignals(
false );
1011 spinStrokeWidth->blockSignals(
true );
1013 spinStrokeWidth->blockSignals(
false );
1014 cboJoinStyle->blockSignals(
true );
1016 cboJoinStyle->blockSignals(
false );
1017 spinOffsetX->blockSignals(
true );
1019 spinOffsetX->blockSignals(
false );
1020 spinOffsetY->blockSignals(
true );
1022 spinOffsetY->blockSignals(
false );
1024 mStrokeWidthUnitWidget->blockSignals(
true );
1027 mStrokeWidthUnitWidget->blockSignals(
false );
1028 mOffsetUnitWidget->blockSignals(
true );
1031 mOffsetUnitWidget->blockSignals(
false );
1059 void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1065 void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1071 void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1078 void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1080 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1084 void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1094 void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1114 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1115 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1121 spinOffsetX->setClearValue( 0.0 );
1122 spinOffsetY->setClearValue( 0.0 );
1123 spinAngle->setClearValue( 0.0 );
1129 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1131 int size = lstNames->iconSize().width();
1132 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1133 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1134 lstNames->setIconSize( QSize( size, size ) );
1136 const double markerSize = size * 0.8;
1142 lyr->
setColor( QColor( 200, 200, 200 ) );
1145 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1146 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
1151 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1153 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1154 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1155 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1156 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1157 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1165 if ( layer->
layerType() != QLatin1String(
"FilledMarker" ) )
1173 for (
int i = 0; i < lstNames->count(); ++i )
1175 if (
static_cast< Qgis::MarkerShape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1177 lstNames->setCurrentRow( i );
1186 mSizeUnitWidget->blockSignals(
true );
1189 mSizeUnitWidget->blockSignals(
false );
1190 mOffsetUnitWidget->blockSignals(
true );
1193 mOffsetUnitWidget->blockSignals(
false );
1206 updateAssistantSymbol();
1214 void QgsFilledMarkerSymbolLayerWidget::setShape()
1220 void QgsFilledMarkerSymbolLayerWidget::setSize()
1226 void QgsFilledMarkerSymbolLayerWidget::setAngle()
1232 void QgsFilledMarkerSymbolLayerWidget::setOffset()
1234 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1238 void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1248 void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1258 void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
1267 void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
1276 void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1278 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1280 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1282 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1285 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1298 connect( mSpinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1302 btnColorRamp->setShowGradientOnly(
true );
1304 btnChangeColor->setAllowOpacity(
true );
1305 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1306 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1307 btnChangeColor->setShowNoColor(
true );
1308 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1309 btnChangeColor2->setAllowOpacity(
true );
1310 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1311 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1312 btnChangeColor2->setShowNoColor(
true );
1313 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1315 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1316 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1318 spinOffsetX->setClearValue( 0.0 );
1319 spinOffsetY->setClearValue( 0.0 );
1320 mSpinAngle->setClearValue( 0.0 );
1328 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1329 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1330 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1331 connect( spinRefPoint1X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1332 connect( spinRefPoint1Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1333 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1334 connect( spinRefPoint2X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1335 connect( spinRefPoint2Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1336 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1341 if ( layer->
layerType() != QLatin1String(
"GradientFill" ) )
1348 btnChangeColor->blockSignals(
true );
1350 btnChangeColor->blockSignals(
false );
1351 btnChangeColor2->blockSignals(
true );
1353 btnChangeColor2->blockSignals(
false );
1357 radioTwoColor->setChecked(
true );
1358 btnColorRamp->setEnabled(
false );
1362 radioColorRamp->setChecked(
true );
1363 btnChangeColor->setEnabled(
false );
1364 btnChangeColor2->setEnabled(
false );
1370 btnColorRamp->blockSignals(
true );
1372 btnColorRamp->blockSignals(
false );
1375 cboGradientType->blockSignals(
true );
1379 cboGradientType->setCurrentIndex( 0 );
1382 cboGradientType->setCurrentIndex( 1 );
1385 cboGradientType->setCurrentIndex( 2 );
1388 cboGradientType->blockSignals(
false );
1390 cboCoordinateMode->blockSignals(
true );
1394 cboCoordinateMode->setCurrentIndex( 1 );
1395 checkRefPoint1Centroid->setEnabled(
false );
1396 checkRefPoint2Centroid->setEnabled(
false );
1400 cboCoordinateMode->setCurrentIndex( 0 );
1403 cboCoordinateMode->blockSignals(
false );
1405 cboGradientSpread->blockSignals(
true );
1409 cboGradientSpread->setCurrentIndex( 0 );
1412 cboGradientSpread->setCurrentIndex( 1 );
1415 cboGradientSpread->setCurrentIndex( 2 );
1418 cboGradientSpread->blockSignals(
false );
1420 spinRefPoint1X->blockSignals(
true );
1422 spinRefPoint1X->blockSignals(
false );
1423 spinRefPoint1Y->blockSignals(
true );
1425 spinRefPoint1Y->blockSignals(
false );
1426 checkRefPoint1Centroid->blockSignals(
true );
1430 spinRefPoint1X->setEnabled(
false );
1431 spinRefPoint1Y->setEnabled(
false );
1433 checkRefPoint1Centroid->blockSignals(
false );
1434 spinRefPoint2X->blockSignals(
true );
1436 spinRefPoint2X->blockSignals(
false );
1437 spinRefPoint2Y->blockSignals(
true );
1439 spinRefPoint2Y->blockSignals(
false );
1440 checkRefPoint2Centroid->blockSignals(
true );
1444 spinRefPoint2X->setEnabled(
false );
1445 spinRefPoint2Y->setEnabled(
false );
1447 checkRefPoint2Centroid->blockSignals(
false );
1449 spinOffsetX->blockSignals(
true );
1451 spinOffsetX->blockSignals(
false );
1452 spinOffsetY->blockSignals(
true );
1454 spinOffsetY->blockSignals(
false );
1455 mSpinAngle->blockSignals(
true );
1457 mSpinAngle->blockSignals(
false );
1459 mOffsetUnitWidget->blockSignals(
true );
1462 mOffsetUnitWidget->blockSignals(
false );
1496 void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1498 if ( radioTwoColor->isChecked() )
1511 if ( btnColorRamp->isNull() )
1525 spinRefPoint1X->setValue( 0.5 );
1526 spinRefPoint1Y->setValue( 0 );
1527 spinRefPoint2X->setValue( 0.5 );
1528 spinRefPoint2Y->setValue( 1 );
1533 spinRefPoint1X->setValue( 0 );
1534 spinRefPoint1Y->setValue( 0 );
1535 spinRefPoint2X->setValue( 1 );
1536 spinRefPoint2Y->setValue( 1 );
1540 spinRefPoint1X->setValue( 0.5 );
1541 spinRefPoint1Y->setValue( 0.5 );
1542 spinRefPoint2X->setValue( 1 );
1543 spinRefPoint2Y->setValue( 1 );
1558 checkRefPoint1Centroid->setEnabled(
true );
1559 checkRefPoint2Centroid->setEnabled(
true );
1565 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1566 checkRefPoint1Centroid->setEnabled(
false );
1567 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1568 checkRefPoint2Centroid->setEnabled(
false );
1593 void QgsGradientFillSymbolLayerWidget::offsetChanged()
1595 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1599 void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1608 void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1614 void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1632 connect( mSpinBlurRadius, qOverload< int >( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1633 connect( mSpinMaxDistance, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1635 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1637 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1643 QButtonGroup *group1 =
new QButtonGroup(
this );
1644 group1->addButton( radioColorRamp );
1645 group1->addButton( radioTwoColor );
1646 QButtonGroup *group2 =
new QButtonGroup(
this );
1647 group2->addButton( mRadioUseMaxDistance );
1648 group2->addButton( mRadioUseWholeShape );
1649 btnChangeColor->setAllowOpacity(
true );
1650 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1651 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1652 btnChangeColor->setShowNoColor(
true );
1653 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1654 btnChangeColor2->setAllowOpacity(
true );
1655 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1656 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1657 btnChangeColor2->setShowNoColor(
true );
1658 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1660 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1661 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1663 spinOffsetX->setClearValue( 0.0 );
1664 spinOffsetY->setClearValue( 0.0 );
1665 mSpinMaxDistance->setClearValue( 5.0 );
1667 btnColorRamp->setShowGradientOnly(
true );
1673 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1674 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1675 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1677 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1678 connect( mSpinBlurRadius,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1683 if ( layer->
layerType() != QLatin1String(
"ShapeburstFill" ) )
1690 btnChangeColor->blockSignals(
true );
1692 btnChangeColor->blockSignals(
false );
1693 btnChangeColor2->blockSignals(
true );
1695 btnChangeColor2->blockSignals(
false );
1699 radioTwoColor->setChecked(
true );
1700 btnColorRamp->setEnabled(
false );
1704 radioColorRamp->setChecked(
true );
1705 btnChangeColor->setEnabled(
false );
1706 btnChangeColor2->setEnabled(
false );
1709 mSpinBlurRadius->blockSignals(
true );
1710 mBlurSlider->blockSignals(
true );
1713 mSpinBlurRadius->blockSignals(
false );
1714 mBlurSlider->blockSignals(
false );
1716 mSpinMaxDistance->blockSignals(
true );
1718 mSpinMaxDistance->blockSignals(
false );
1720 mRadioUseWholeShape->blockSignals(
true );
1721 mRadioUseMaxDistance->blockSignals(
true );
1724 mRadioUseWholeShape->setChecked(
true );
1725 mSpinMaxDistance->setEnabled(
false );
1726 mDistanceUnitWidget->setEnabled(
false );
1730 mRadioUseMaxDistance->setChecked(
true );
1731 mSpinMaxDistance->setEnabled(
true );
1732 mDistanceUnitWidget->setEnabled(
true );
1734 mRadioUseWholeShape->blockSignals(
false );
1735 mRadioUseMaxDistance->blockSignals(
false );
1737 mDistanceUnitWidget->blockSignals(
true );
1740 mDistanceUnitWidget->blockSignals(
false );
1742 mIgnoreRingsCheckBox->blockSignals(
true );
1743 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1744 mIgnoreRingsCheckBox->blockSignals(
false );
1749 btnColorRamp->blockSignals(
true );
1751 btnColorRamp->blockSignals(
false );
1754 spinOffsetX->blockSignals(
true );
1756 spinOffsetX->blockSignals(
false );
1757 spinOffsetY->blockSignals(
true );
1759 spinOffsetY->blockSignals(
false );
1760 mOffsetUnitWidget->blockSignals(
true );
1763 mOffsetUnitWidget->blockSignals(
false );
1797 void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1804 if ( radioTwoColor->isChecked() )
1815 void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1824 void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1833 void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1843 void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1848 mDistanceUnitWidget->setEnabled( !value );
1853 void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1863 void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1867 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1872 void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1883 void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1885 const bool checked = ( state == Qt::Checked );
1914 connect( mRingFilterComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
1923 spinOffset->setClearValue( 0.0 );
1924 mSpinOffsetAlongLine->setClearValue( 0.0 );
1925 mSpinAverageAngleLength->setClearValue( 4.0 );
1929 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1930 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1931 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setAverageAngle );
1932 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1933 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1934 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1935 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1936 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1937 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1938 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1939 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [ = ]
1951 if ( layer->
layerType() != QLatin1String(
"MarkerLine" ) )
1958 spinInterval->blockSignals(
true );
1960 spinInterval->blockSignals(
false );
1961 mSpinOffsetAlongLine->blockSignals(
true );
1963 mSpinOffsetAlongLine->blockSignals(
false );
1964 chkRotateMarker->blockSignals(
true );
1966 chkRotateMarker->blockSignals(
false );
1967 spinOffset->blockSignals(
true );
1969 spinOffset->blockSignals(
false );
1984 mIntervalUnitWidget->blockSignals(
true );
1987 mIntervalUnitWidget->blockSignals(
false );
1988 mOffsetUnitWidget->blockSignals(
true );
1991 mOffsetUnitWidget->blockSignals(
false );
1992 mOffsetAlongLineUnitWidget->blockSignals(
true );
1995 mOffsetAlongLineUnitWidget->blockSignals(
false );
2026 mRingFilterComboBox->hide();
2027 mRingsLabel->hide();
2048 void QgsMarkerLineSymbolLayerWidget::setRotate()
2050 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2051 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2057 void QgsMarkerLineSymbolLayerWidget::setOffset()
2063 void QgsMarkerLineSymbolLayerWidget::setPlacement()
2065 const bool interval = mCheckInterval->isChecked();
2066 spinInterval->setEnabled( interval );
2067 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2068 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2069 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2070 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2071 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2073 Qgis::MarkerLinePlacements placements;
2074 if ( mCheckInterval->isChecked() )
2076 if ( mCheckVertex->isChecked() )
2078 if ( mCheckVertexLast->isChecked() )
2080 if ( mCheckVertexFirst->isChecked() )
2082 if ( mCheckCurvePoint->isChecked() )
2084 if ( mCheckSegmentCentralPoint->isChecked() )
2086 if ( mCheckCentralPoint->isChecked() )
2093 void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2103 void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2113 void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2123 void QgsMarkerLineSymbolLayerWidget::averageAngleUnitChanged()
2133 void QgsMarkerLineSymbolLayerWidget::setAverageAngle(
double val )
2170 connect( mRingFilterComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
2179 spinOffset->setClearValue( 0.0 );
2180 mSpinOffsetAlongLine->setClearValue( 0.0 );
2181 mHashRotationSpinBox->setClearValue( 0 );
2182 mSpinAverageAngleLength->setClearValue( 4.0 );
2184 connect( spinInterval,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setInterval );
2185 connect( mSpinOffsetAlongLine,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffsetAlongLine );
2186 connect( mSpinHashLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashLength );
2187 connect( mHashRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashAngle );
2188 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setRotate );
2189 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffset );
2190 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setAverageAngle );
2192 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2193 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2194 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2195 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2196 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2197 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2198 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2200 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [ = ]
2212 if ( layer->
layerType() != QLatin1String(
"HashLine" ) )
2219 spinInterval->blockSignals(
true );
2220 spinInterval->setValue( mLayer->
interval() );
2221 spinInterval->blockSignals(
false );
2222 mSpinOffsetAlongLine->blockSignals(
true );
2224 mSpinOffsetAlongLine->blockSignals(
false );
2227 chkRotateMarker->blockSignals(
true );
2229 chkRotateMarker->blockSignals(
false );
2230 spinOffset->blockSignals(
true );
2231 spinOffset->setValue( mLayer->
offset() );
2232 spinOffset->blockSignals(
false );
2247 mIntervalUnitWidget->blockSignals(
true );
2248 mIntervalUnitWidget->setUnit( mLayer->
intervalUnit() );
2250 mIntervalUnitWidget->blockSignals(
false );
2251 mOffsetUnitWidget->blockSignals(
true );
2252 mOffsetUnitWidget->setUnit( mLayer->
offsetUnit() );
2254 mOffsetUnitWidget->blockSignals(
false );
2255 mOffsetAlongLineUnitWidget->blockSignals(
true );
2258 mOffsetAlongLineUnitWidget->blockSignals(
false );
2265 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->
ringFilter() ) );
2292 mRingFilterComboBox->hide();
2293 mRingsLabel->hide();
2302 void QgsHashedLineSymbolLayerWidget::setInterval(
double val )
2308 void QgsHashedLineSymbolLayerWidget::setOffsetAlongLine(
double val )
2314 void QgsHashedLineSymbolLayerWidget::setHashLength(
double val )
2320 void QgsHashedLineSymbolLayerWidget::setHashAngle(
double val )
2326 void QgsHashedLineSymbolLayerWidget::setRotate()
2328 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2329 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2335 void QgsHashedLineSymbolLayerWidget::setOffset()
2337 mLayer->
setOffset( spinOffset->value() );
2341 void QgsHashedLineSymbolLayerWidget::setPlacement()
2343 const bool interval = mCheckInterval->isChecked();
2344 spinInterval->setEnabled( interval );
2345 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2346 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2347 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2348 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2349 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2351 Qgis::MarkerLinePlacements placements;
2352 if ( mCheckInterval->isChecked() )
2354 if ( mCheckVertex->isChecked() )
2356 if ( mCheckVertexLast->isChecked() )
2358 if ( mCheckVertexFirst->isChecked() )
2360 if ( mCheckCurvePoint->isChecked() )
2362 if ( mCheckSegmentCentralPoint->isChecked() )
2364 if ( mCheckCentralPoint->isChecked() )
2371 void QgsHashedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2381 void QgsHashedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2391 void QgsHashedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2401 void QgsHashedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2411 void QgsHashedLineSymbolLayerWidget::averageAngleUnitChanged()
2421 void QgsHashedLineSymbolLayerWidget::setAverageAngle(
double val )
2440 mSvgSelectorWidget->setAllowParameters(
true );
2441 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2442 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral(
"/UI/lastSVGMarkerDir" ) );
2443 mSvgSelectorWidget->initParametersModel(
this, vl );
2447 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2448 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2452 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2453 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2460 mChangeColorButton->setAllowOpacity(
true );
2461 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2462 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2463 mChangeStrokeColorButton->setAllowOpacity(
true );
2464 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2465 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2467 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2468 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2470 spinOffsetX->setClearValue( 0.0 );
2471 spinOffsetY->setClearValue( 0.0 );
2472 spinAngle->setClearValue( 0.0 );
2474 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2475 connect( spinHeight,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2477 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2478 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2479 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2490 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2491 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2498 #include <QAbstractListModel>
2499 #include <QPixmapCache>
2513 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2514 QColor defaultFill, defaultStroke;
2515 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2516 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2518 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2519 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2520 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2521 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2522 mChangeColorButton->setEnabled( hasFillParam );
2523 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2524 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2525 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2526 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2531 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2532 if ( hasDefaultFillColor && !skipDefaultColors )
2536 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2537 mChangeColorButton->setColor( fill );
2539 if ( hasStrokeParam )
2542 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2543 if ( hasDefaultStrokeColor && !skipDefaultColors )
2545 stroke = defaultStroke;
2547 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2548 mChangeStrokeColorButton->setColor( stroke );
2551 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2553 mStrokeWidthSpinBox->blockSignals(
true );
2554 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2555 mStrokeWidthSpinBox->blockSignals(
false );
2558 spinHeight->blockSignals(
true );
2559 if ( preservedAspectRatio )
2568 spinHeight->blockSignals(
false );
2569 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2572 void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2574 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
2576 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2578 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
2581 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2592 if ( layer->
layerType() != QLatin1String(
"SvgMarker" ) )
2599 mSvgSelectorWidget->setSvgPath(
mLayer->
path() );
2602 spinWidth->blockSignals(
true );
2604 spinWidth->blockSignals(
false );
2605 spinAngle->blockSignals(
true );
2607 spinAngle->blockSignals(
false );
2610 spinOffsetX->blockSignals(
true );
2612 spinOffsetX->blockSignals(
false );
2613 spinOffsetY->blockSignals(
true );
2615 spinOffsetY->blockSignals(
false );
2617 mSizeUnitWidget->blockSignals(
true );
2620 mSizeUnitWidget->blockSignals(
false );
2621 mStrokeWidthUnitWidget->blockSignals(
true );
2624 mStrokeWidthUnitWidget->blockSignals(
false );
2625 mOffsetUnitWidget->blockSignals(
true );
2628 mOffsetUnitWidget->blockSignals(
false );
2631 mHorizontalAnchorComboBox->blockSignals(
true );
2632 mVerticalAnchorComboBox->blockSignals(
true );
2635 mHorizontalAnchorComboBox->blockSignals(
false );
2636 mVerticalAnchorComboBox->blockSignals(
false );
2652 updateAssistantSymbol();
2669 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2678 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2684 void QgsSvgMarkerSymbolLayerWidget::setWidth()
2687 double fixedAspectRatio = 0.0;
2688 spinHeight->blockSignals(
true );
2689 if ( defaultAspectRatio <= 0.0 )
2691 spinHeight->setValue( spinWidth->value() );
2693 else if ( mLockAspectRatio->locked() )
2695 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2699 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2701 spinHeight->blockSignals(
false );
2707 void QgsSvgMarkerSymbolLayerWidget::setHeight()
2710 double fixedAspectRatio = 0.0;
2711 spinWidth->blockSignals(
true );
2712 if ( defaultAspectRatio <= 0.0 )
2714 spinWidth->setValue( spinHeight->value() );
2716 else if ( mLockAspectRatio->locked() )
2718 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2722 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2724 spinWidth->blockSignals(
false );
2730 void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2734 if ( defaultAspectRatio <= 0.0 )
2750 void QgsSvgMarkerSymbolLayerWidget::setAngle()
2756 void QgsSvgMarkerSymbolLayerWidget::setOffset()
2758 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2762 void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2769 void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2780 void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2791 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2800 void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2810 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2820 void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2830 void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
2839 void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
2855 mSvgSelectorWidget->setAllowParameters(
true );
2856 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2858 connect( mTextureWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2860 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2862 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2863 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2871 mRotationSpinBox->setClearValue( 0.0 );
2873 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2874 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2875 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2876 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2878 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2879 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2892 if ( layer->
layerType() != QLatin1String(
"SVGFill" ) )
2901 mTextureWidthSpinBox->blockSignals(
true );
2902 mTextureWidthSpinBox->setValue( width );
2903 mTextureWidthSpinBox->blockSignals(
false );
2905 mRotationSpinBox->blockSignals(
true );
2907 mRotationSpinBox->blockSignals(
false );
2908 mTextureWidthUnitWidget->blockSignals(
true );
2911 mTextureWidthUnitWidget->blockSignals(
false );
2912 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2915 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2916 mChangeColorButton->blockSignals(
true );
2918 mChangeColorButton->blockSignals(
false );
2919 mChangeStrokeColorButton->blockSignals(
true );
2921 mChangeStrokeColorButton->blockSignals(
false );
2922 mStrokeWidthSpinBox->blockSignals(
true );
2924 mStrokeWidthSpinBox->blockSignals(
false );
2948 void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2957 void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2969 void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2972 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2978 void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
2981 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2988 void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
3000 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
3001 QColor defaultFill, defaultStroke;
3002 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
3003 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
3005 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
3006 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
3007 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
3008 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
3011 QColor fill = mChangeColorButton->color();
3012 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
3013 if ( hasDefaultFillColor )
3017 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
3018 mChangeColorButton->setColor( fill );
3020 mChangeColorButton->setEnabled( hasFillParam );
3021 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
3024 QColor stroke = mChangeStrokeColorButton->color();
3025 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
3026 if ( hasDefaultStrokeColor )
3028 stroke = defaultStroke;
3030 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
3031 mChangeStrokeColorButton->setColor( stroke );
3033 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
3034 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
3035 if ( hasDefaultStrokeWidth && resetValues )
3037 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
3039 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
3042 void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
3053 void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
3064 void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3073 void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
3083 void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3099 connect( mAngleSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3100 connect( mDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3101 connect( mOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3108 mOffsetSpinBox->setClearValue( 0 );
3109 mAngleSpinBox->setClearValue( 0 );
3113 connect( mCoordinateReferenceComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3125 connect( mClipModeComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3138 if ( layer->
layerType() != QLatin1String(
"LinePatternFill" ) )
3152 mDistanceUnitWidget->blockSignals(
true );
3155 mDistanceUnitWidget->blockSignals(
false );
3156 mOffsetUnitWidget->blockSignals(
true );
3159 mOffsetUnitWidget->blockSignals(
false );
3177 void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3186 void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3195 void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3204 void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3214 void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3230 connect( mHorizontalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3231 connect( mVerticalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3232 connect( mHorizontalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3233 connect( mVerticalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3234 connect( mHorizontalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3235 connect( mVerticalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3236 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3237 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3238 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3239 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3240 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3241 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3259 connect( mClipModeComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3270 connect( mCoordinateReferenceComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3279 mSeedSpinBox->setShowClearButton(
true );
3280 mSeedSpinBox->setClearValue( 0 );
3281 mRandomXSpinBox->setClearValue( 0 );
3282 mRandomYSpinBox->setClearValue( 0 );
3288 connect( mRandomXSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double d )
3296 connect( mRandomYSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double d )
3322 connect( mSeedSpinBox, qOverload< int > ( &QSpinBox::valueChanged ),
this, [ = ](
int v )
3331 mAngleSpinBox->setShowClearButton(
true );
3332 mAngleSpinBox->setClearValue( 0 );
3333 connect( mAngleSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double d )
3345 if ( !layer || layer->
layerType() != QLatin1String(
"PointPatternFill" ) )
3359 mHorizontalDistanceUnitWidget->blockSignals(
true );
3362 mHorizontalDistanceUnitWidget->blockSignals(
false );
3363 mVerticalDistanceUnitWidget->blockSignals(
true );
3366 mVerticalDistanceUnitWidget->blockSignals(
false );
3367 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3370 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3371 mVerticalDisplacementUnitWidget->blockSignals(
true );
3374 mVerticalDisplacementUnitWidget->blockSignals(
false );
3375 mHorizontalOffsetUnitWidget->blockSignals(
true );
3378 mHorizontalOffsetUnitWidget->blockSignals(
false );
3379 mVerticalOffsetUnitWidget->blockSignals(
true );
3382 mVerticalOffsetUnitWidget->blockSignals(
false );
3414 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3423 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3432 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3441 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3450 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3459 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3468 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3478 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3488 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3498 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3508 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3518 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3539 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3540 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3541 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3551 scrollArea->setVerticalOnly(
true );
3553 btnColor->setAllowOpacity(
true );
3554 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3555 btnColor->setContext( QStringLiteral(
"symbology" ) );
3556 btnStrokeColor->setAllowOpacity(
true );
3557 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3558 btnStrokeColor->setContext( QStringLiteral(
"symbology" ) );
3560 mColorDDBtn->registerLinkedWidget( btnColor );
3561 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3563 spinOffsetX->setClearValue( 0.0 );
3564 spinOffsetY->setClearValue( 0.0 );
3565 spinAngle->setClearValue( 0.0 );
3571 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3574 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3576 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3579 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3581 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3582 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3593 if ( layer->
layerType() != QLatin1String(
"FontMarker" ) )
3602 mFontStyleComboBox->blockSignals(
true );
3603 populateFontStyleComboBox();
3604 mFontStyleComboBox->blockSignals(
false );
3622 mCharPreview->setFont( mRefFont );
3628 mSizeUnitWidget->blockSignals(
true );
3631 mSizeUnitWidget->blockSignals(
false );
3633 mStrokeWidthUnitWidget->blockSignals(
true );
3636 mStrokeWidthUnitWidget->blockSignals(
false );
3638 mOffsetUnitWidget->blockSignals(
true );
3641 mOffsetUnitWidget->blockSignals(
false );
3662 updateAssistantSymbol();
3675 mRefFont.setFamily( font.family() );
3677 mCharPreview->setFont( mRefFont );
3678 populateFontStyleComboBox();
3683 void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3690 mCharPreview->setFont( mRefFont );
3722 mCharPreview->setText( text );
3724 if ( text.isEmpty() )
3728 QString character = text;
3729 if ( text.contains( QRegularExpression( QStringLiteral(
"^0x[0-9a-fA-F]{1,4}$" ) ) ) )
3732 const unsigned int value = text.toUInt( &ok, 0 );
3735 character = QChar( value );
3736 mCharPreview->setText( character );
3757 if (
mLayer->
character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3759 mCharLineEdit->insert( chr );
3765 mCharPreview->setText( chr );
3769 void QgsFontMarkerSymbolLayerWidget::setOffset()
3771 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3775 void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3781 void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3791 void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3801 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3811 void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3813 mFontStyleComboBox->clear();
3814 const QStringList styles = mFontDB.styles( mRefFont.family() );
3815 const auto constStyles = styles;
3816 for (
const QString &style : constStyles )
3818 mFontStyleComboBox->addItem( style );
3821 QString targetStyle = mFontDB.styleString( mRefFont );
3822 if ( !styles.contains( targetStyle ) )
3824 const QFont f = QFont( mRefFont.family() );
3825 targetStyle = QFontInfo( f ).styleName();
3826 mRefFont.setStyleName( targetStyle );
3829 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
3830 if ( stylIndx > -1 )
3835 mFontStyleComboBox->setCurrentIndex( curIndx );
3838 void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3841 setFontStyle( mFontStyleComboBox->currentText() );
3844 void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3853 void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3862 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3871 void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3873 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
3875 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3877 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
3880 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3892 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3893 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3894 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3895 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3900 if ( layer->
layerType() != QLatin1String(
"CentroidFill" ) )
3918 void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3924 void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3930 void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
3936 void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
3951 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3955 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3957 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3958 connect( mHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3966 mSpinOffsetX->setClearValue( 0.0 );
3967 mSpinOffsetY->setClearValue( 0.0 );
3968 mRotationSpinBox->setClearValue( 0.0 );
3970 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3971 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3974 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3975 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3985 if ( layer->
layerType() != QLatin1String(
"RasterMarker" ) )
3996 mHeightSpinBox->blockSignals(
true );
3997 if ( preservedAspectRatio )
4006 mHeightSpinBox->blockSignals(
false );
4007 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4015 mSizeUnitWidget->blockSignals(
true );
4018 mSizeUnitWidget->blockSignals(
false );
4019 mOffsetUnitWidget->blockSignals(
true );
4022 mOffsetUnitWidget->blockSignals(
false );
4037 updatePreviewImage();
4051 void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4054 updatePreviewImage();
4058 void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
4060 bool fitsInCache =
false;
4062 if ( image.isNull() )
4064 mLabelImagePreview->setPixmap( QPixmap() );
4068 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4069 previewImage.fill( Qt::transparent );
4070 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4072 p.begin( &previewImage );
4074 uchar pixDataRGB[] = { 150, 150, 150, 150,
4079 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4080 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4081 QBrush checkerBrush;
4082 checkerBrush.setTexture( pix );
4083 p.fillRect( imageRect, checkerBrush );
4090 p.drawImage( imageRect.left(), imageRect.top(), image );
4092 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4095 void QgsRasterMarkerSymbolLayerWidget::setWidth()
4098 double fixedAspectRatio = 0.0;
4099 mHeightSpinBox->blockSignals(
true );
4100 if ( defaultAspectRatio <= 0.0 )
4102 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4104 else if ( mLockAspectRatio->locked() )
4106 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4110 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4112 mHeightSpinBox->blockSignals(
false );
4118 void QgsRasterMarkerSymbolLayerWidget::setHeight()
4121 double fixedAspectRatio = 0.0;
4122 mWidthSpinBox->blockSignals(
true );
4123 if ( defaultAspectRatio <= 0.0 )
4125 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4127 else if ( mLockAspectRatio->locked() )
4129 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4133 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4135 mWidthSpinBox->blockSignals(
false );
4141 void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4144 if ( defaultAspectRatio <= 0.0 )
4159 void QgsRasterMarkerSymbolLayerWidget::setAngle()
4165 void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4169 updatePreviewImage();
4172 void QgsRasterMarkerSymbolLayerWidget::setOffset()
4174 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4178 void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4188 void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4198 void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
4207 void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
4226 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastAnimatedMarkerImageDir" ) );
4230 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4232 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4233 connect( mHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4236 mFrameRateSpin->setClearValue( 10 );
4237 mFrameRateSpin->setShowClearButton(
true );
4238 connect( mFrameRateSpin, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double value )
4249 mSpinOffsetX->setClearValue( 0.0 );
4250 mSpinOffsetY->setClearValue( 0.0 );
4251 mRotationSpinBox->setClearValue( 0.0 );
4253 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4254 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4257 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4258 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4268 if ( layer->
layerType() != QLatin1String(
"AnimatedMarker" ) )
4278 if ( firstFrameTime > 0 )
4280 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4284 mFrameRateSpin->setClearValue( 10 );
4289 mHeightSpinBox->blockSignals(
true );
4290 if ( preservedAspectRatio )
4299 mHeightSpinBox->blockSignals(
false );
4300 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4310 mSizeUnitWidget->blockSignals(
true );
4313 mSizeUnitWidget->blockSignals(
false );
4314 mOffsetUnitWidget->blockSignals(
true );
4317 mOffsetUnitWidget->blockSignals(
false );
4332 updatePreviewImage();
4346 void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4351 if ( firstFrameTime > 0 )
4353 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4357 mFrameRateSpin->setClearValue( 10 );
4359 updatePreviewImage();
4363 void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4365 if ( mPreviewMovie )
4367 mLabelImagePreview->setMovie(
nullptr );
4368 mPreviewMovie->deleteLater();
4369 mPreviewMovie =
nullptr;
4372 mPreviewMovie =
new QMovie(
mLayer->
path(), QByteArray(),
this );
4373 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4374 mLabelImagePreview->setMovie( mPreviewMovie );
4375 mPreviewMovie->start();
4378 void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4381 double fixedAspectRatio = 0.0;
4382 mHeightSpinBox->blockSignals(
true );
4383 if ( defaultAspectRatio <= 0.0 )
4385 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4387 else if ( mLockAspectRatio->locked() )
4389 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4393 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4395 mHeightSpinBox->blockSignals(
false );
4401 void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4404 double fixedAspectRatio = 0.0;
4405 mWidthSpinBox->blockSignals(
true );
4406 if ( defaultAspectRatio <= 0.0 )
4408 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4410 else if ( mLockAspectRatio->locked() )
4412 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4416 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4418 mWidthSpinBox->blockSignals(
false );
4424 void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4427 if ( defaultAspectRatio <= 0.0 )
4442 void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4448 void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4452 updatePreviewImage();
4455 void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4457 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4461 void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4471 void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4481 void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
4490 void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
4507 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
4511 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4513 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged );
4520 mSpinOffsetX->setClearValue( 0.0 );
4521 mSpinOffsetY->setClearValue( 0.0 );
4522 mRotationSpinBox->setClearValue( 0.0 );
4524 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4525 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4526 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4538 if ( layer->
layerType() != QLatin1String(
"RasterFill" ) )
4551 cboCoordinateMode->blockSignals(
true );
4555 cboCoordinateMode->setCurrentIndex( 1 );
4559 cboCoordinateMode->setCurrentIndex( 0 );
4562 cboCoordinateMode->blockSignals(
false );
4568 mOffsetUnitWidget->blockSignals(
true );
4571 mOffsetUnitWidget->blockSignals(
false );
4574 mWidthUnitWidget->blockSignals(
true );
4577 mWidthUnitWidget->blockSignals(
false );
4579 updatePreviewImage();
4593 void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4596 updatePreviewImage();
4600 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4617 void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4626 updatePreviewImage();
4629 void QgsRasterFillSymbolLayerWidget::offsetChanged()
4631 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4635 void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4646 void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4655 void QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed()
4666 void QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged(
double d )
4676 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4678 bool fitsInCache =
false;
4680 if ( image.isNull() )
4682 mLabelImagePreview->setPixmap( QPixmap() );
4686 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4687 previewImage.fill( Qt::transparent );
4688 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4690 p.begin( &previewImage );
4692 uchar pixDataRGB[] = { 150, 150, 150, 150,
4697 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4698 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4699 QBrush checkerBrush;
4700 checkerBrush.setTexture( pix );
4701 p.fillRect( imageRect, checkerBrush );
4708 p.drawImage( imageRect.left(), imageRect.top(), image );
4710 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4724 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
4741 connect( spinWidth, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ]
4761 spinOffset->setClearValue( 0.0 );
4762 connect( spinOffset, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double val )
4771 connect( cboCapStyle, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
4779 connect( cboJoinStyle, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
4794 updatePreviewImage();
4807 if ( layer->
layerType() != QLatin1String(
"RasterLine" ) )
4831 updatePreviewImage();
4846 void QgsRasterLineSymbolLayerWidget::imageSourceChanged(
const QString &text )
4849 updatePreviewImage();
4853 void QgsRasterLineSymbolLayerWidget::updatePreviewImage()
4855 bool fitsInCache =
false;
4857 if ( image.isNull() )
4859 mLabelImagePreview->setPixmap( QPixmap() );
4863 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4864 previewImage.fill( Qt::transparent );
4865 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4867 p.begin( &previewImage );
4869 uchar pixDataRGB[] = { 150, 150, 150, 150,
4874 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4875 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4876 QBrush checkerBrush;
4877 checkerBrush.setTexture( pix );
4878 p.fillRect( imageRect, checkerBrush );
4885 p.drawImage( imageRect.left(), imageRect.top(), image );
4887 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4901 modificationExpressionSelector->setMultiLine(
true );
4902 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
4903 modificationExpressionSelector->registerExpressionContextGenerator(
this );
4914 mUnitWidget->setShowMapScaleButton(
false );
4917 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
4920 if ( !mBlockSignals )
4922 mLayer->
setUnits( mUnitWidget->unit() );
4933 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData(
static_cast< int >( mLayer->
symbolType() ) ) );
4934 mUnitWidget->setUnit( mLayer->
units() );
4943 void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
4950 void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
4953 std::unique_ptr< QgsSymbol > subSymbol( mLayer->
subSymbol()->
clone() );
4968 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
4971 layers << subSymbol->symbolLayer( i )->clone();
4974 if ( !layers.empty() )
4984 for (
int i = 0; i < subSymbol->symbolLayerCount(); ++i )
4985 layers << subSymbol->symbolLayer( i )->clone();
5004 mCountMethodComboBox->addItem( tr(
"Absolute Count" ),
static_cast< int >( Qgis::PointCountMethod::Absolute ) );
5005 mCountMethodComboBox->addItem( tr(
"Density-based Count" ),
static_cast< int >( Qgis::PointCountMethod::DensityBased ) );
5007 mPointCountSpinBox->setShowClearButton(
true );
5008 mPointCountSpinBox->setClearValue( 100 );
5009 mSeedSpinBox->setShowClearButton(
true );
5010 mSeedSpinBox->setClearValue( 0 );
5012 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
5013 connect( mPointCountSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
5014 connect( mDensityAreaSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
5015 connect( mSeedSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
5016 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
5033 if ( !layer || layer->
layerType() != QLatin1String(
"RandomMarkerFill" ) )
5043 bool showDensityBasedCountWidgets =
false;
5046 case Qgis::PointCountMethod::DensityBased:
5047 showDensityBasedCountWidgets =
true;
5049 case Qgis::PointCountMethod::Absolute:
5052 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5053 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5054 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5055 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5057 whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData(
static_cast< int >( mLayer->
countMethod() ) ) );
5059 mDensityAreaUnitWidget->blockSignals(
true );
5062 mDensityAreaUnitWidget->blockSignals(
false );
5075 void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
5078 bool showDensityBasedCountWidgets =
false;
5081 case Qgis::PointCountMethod::DensityBased:
5082 showDensityBasedCountWidgets =
true;
5084 case Qgis::PointCountMethod::Absolute:
5087 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
5088 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
5089 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
5090 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
5099 void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
5108 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
5117 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
5127 void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
5146 btnColorRamp->setShowGradientOnly(
true );
5148 btnChangeColor->setAllowOpacity(
true );
5149 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5150 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
5151 btnChangeColor->setShowNoColor(
true );
5152 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
5153 btnChangeColor2->setAllowOpacity(
true );
5154 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
5155 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
5156 btnChangeColor2->setShowNoColor(
true );
5157 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
5159 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
5160 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
5180 if ( btnColorRamp->isNull() )
5190 connect( radioTwoColor, &QAbstractButton::toggled,
this, [ = ]
5194 if ( radioTwoColor->isChecked() )
5196 mLayer->setGradientColorType( Qgis::GradientColorSource::SimpleTwoColor );
5197 btnChangeColor->setEnabled( true );
5198 btnChangeColor2->setEnabled( true );
5199 btnColorRamp->setEnabled( false );
5203 mLayer->setGradientColorType( Qgis::GradientColorSource::ColorRamp );
5204 btnColorRamp->setEnabled( true );
5205 btnChangeColor->setEnabled( false );
5206 btnChangeColor2->setEnabled( false );
5227 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, [ = ]
5246 spinOffset->setClearValue( 0.0 );
5247 connect( spinOffset, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double val )
5256 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [ = ]
5264 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [ = ]
5281 if ( layer->
layerType() != QLatin1String(
"Lineburst" ) )
5292 btnChangeColor->blockSignals(
true );
5294 btnChangeColor->blockSignals(
false );
5295 btnChangeColor2->blockSignals(
true );
5297 btnChangeColor2->blockSignals(
false );
5301 radioTwoColor->setChecked(
true );
5302 btnColorRamp->setEnabled(
false );
5306 radioColorRamp->setChecked(
true );
5307 btnChangeColor->setEnabled(
false );
5308 btnChangeColor2->setEnabled(
false );
5314 btnColorRamp->blockSignals(
true );
5316 btnColorRamp->blockSignals(
false );