48 #include <QAbstractButton>
49 #include <QButtonGroup>
50 #include <QColorDialog>
53 #include <QFileDialog>
55 #include <QStandardItemModel>
56 #include <QSvgRenderer>
57 #include <QMessageBox>
60 #include <QInputDialog>
65 return *lExpressionContext;
76 expContext << symbolScope;
96 QStringList highlights;
101 << QStringLiteral(
"symbol_layer_count" ) << QStringLiteral(
"symbol_layer_index" );
104 if ( expContext.
hasVariable( QStringLiteral(
"zoom_level" ) ) )
106 highlights << QStringLiteral(
"zoom_level" );
108 if ( expContext.
hasVariable( QStringLiteral(
"vector_tile_zoom" ) ) )
110 highlights << QStringLiteral(
"vector_tile_zoom" );
121 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
122 for ( QgsUnitSelectionWidget *unitWidget : unitSelectionWidgets )
124 unitWidget->setMapCanvas( mContext.
mapCanvas() );
142 void QgsSymbolLayerWidget::createAuxiliaryField()
163 if ( dlg.exec() == QDialog::Accepted )
164 def = dlg.propertyDefinition();
174 property.setActive(
true );
196 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
197 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
201 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
203 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [ = ]
205 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
206 if ( !mCheckAlignDash->isChecked() )
207 mCheckDashCorners->setChecked(
false );
215 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [ = ]
233 btnChangeColor->setAllowOpacity(
true );
234 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
235 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
237 mColorDDBtn->registerLinkedWidget( btnChangeColor );
242 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
251 spinOffset->setClearValue( 0.0 );
252 spinPatternOffset->setClearValue( 0.0 );
257 mDrawInsideCheckBox->hide();
258 mRingFilterComboBox->hide();
266 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
268 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
270 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
271 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
272 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
273 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
274 connect( spinPatternOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
281 void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
283 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
285 mAssistantPreviewSymbol->deleteSymbolLayer( i );
287 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
290 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
296 if ( !layer || layer->
layerType() != QLatin1String(
"SimpleLine" ) )
303 mPenWidthUnitWidget->blockSignals(
true );
306 mPenWidthUnitWidget->blockSignals(
false );
307 mOffsetUnitWidget->blockSignals(
true );
310 mOffsetUnitWidget->blockSignals(
false );
311 mDashPatternUnitWidget->blockSignals(
true );
314 mDashPatternUnitWidget->blockSignals(
false );
320 spinWidth->blockSignals(
true );
322 spinWidth->blockSignals(
false );
323 btnChangeColor->blockSignals(
true );
325 btnChangeColor->blockSignals(
false );
326 spinOffset->blockSignals(
true );
328 spinOffset->blockSignals(
false );
329 cboPenStyle->blockSignals(
true );
330 cboJoinStyle->blockSignals(
true );
331 cboCapStyle->blockSignals(
true );
335 cboPenStyle->blockSignals(
false );
336 cboJoinStyle->blockSignals(
false );
337 cboCapStyle->blockSignals(
false );
342 mChangePatternButton->setEnabled( useCustomDashPattern );
343 label_3->setEnabled( !useCustomDashPattern );
344 cboPenStyle->setEnabled( !useCustomDashPattern );
345 mCustomCheckBox->blockSignals(
true );
346 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
347 mCustomCheckBox->blockSignals(
false );
350 QSize size = mChangePatternButton->minimumSizeHint();
352 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
356 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
375 updateAssistantSymbol();
383 void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
390 void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
396 void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
405 void QgsSimpleLineSymbolLayerWidget::offsetChanged()
412 void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
419 void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
421 bool checked = ( state == Qt::Checked );
422 mChangePatternButton->setEnabled( checked );
423 label_3->setEnabled( !checked );
424 cboPenStyle->setEnabled( !checked );
430 void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
437 widget->
setUnit( mDashPatternUnitWidget->unit() );
449 d.setUnit( mDashPatternUnitWidget->unit() );
450 if ( d.exec() == QDialog::Accepted )
458 void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
469 void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
479 void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
490 void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
492 bool checked = ( state == Qt::Checked );
497 void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
514 std::unique_ptr< QgsSimpleLineSymbolLayer > layerCopy(
mLayer->
clone() );
519 QColor color = qApp->palette().color( QPalette::WindowText );
520 layerCopy->setColor( color );
522 layerCopy->setOffset( 0 );
523 layerCopy->setUseCustomDashPattern(
true );
525 QSize currentIconSize;
528 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
530 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
533 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
539 std::unique_ptr< QgsLineSymbol > previewSymbol = qgis::make_unique< QgsLineSymbol >(
QgsSymbolLayerList() << layerCopy.release() );
541 mChangePatternButton->setIconSize( currentIconSize );
542 mChangePatternButton->setIcon( icon );
546 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
549 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
551 int height =
static_cast< int >( width / 1.61803398875 );
555 QBuffer buffer( &data );
556 pm.save( &buffer,
"PNG", 100 );
557 mChangePatternButton->setToolTip( QStringLiteral(
"<img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) ) );
562 QgsSymbolLayerWidget::resizeEvent( event );
580 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
581 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
582 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
583 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
591 btnChangeColorFill->setAllowOpacity(
true );
592 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
593 btnChangeColorFill->setContext( QStringLiteral(
"symbology" ) );
594 btnChangeColorFill->setShowNoColor(
true );
595 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
596 btnChangeColorStroke->setAllowOpacity(
true );
597 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
598 btnChangeColorStroke->setContext( QStringLiteral(
"symbology" ) );
599 btnChangeColorStroke->setShowNoColor(
true );
600 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
602 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
603 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
605 spinOffsetX->setClearValue( 0.0 );
606 spinOffsetY->setClearValue( 0.0 );
607 spinAngle->setClearValue( 0.0 );
613 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
615 int size = lstNames->iconSize().width();
617 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
618 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width(
'X' ) * 3 ) ) );
620 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
623 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
624 lstNames->setIconSize( QSize( size, size ) );
626 double markerSize = size * 0.8;
632 lyr->
setColor( QColor( 200, 200, 200 ) );
635 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
636 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
641 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
643 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
646 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
647 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
648 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
649 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
650 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
656 if ( layer->
layerType() != QLatin1String(
"SimpleMarker" ) )
664 for (
int i = 0; i < lstNames->count(); ++i )
668 lstNames->setCurrentRow( i );
672 btnChangeColorStroke->blockSignals(
true );
674 btnChangeColorStroke->blockSignals(
false );
675 btnChangeColorFill->blockSignals(
true );
678 btnChangeColorFill->blockSignals(
false );
679 spinSize->blockSignals(
true );
681 spinSize->blockSignals(
false );
682 spinAngle->blockSignals(
true );
684 spinAngle->blockSignals(
false );
685 mStrokeStyleComboBox->blockSignals(
true );
687 mStrokeStyleComboBox->blockSignals(
false );
688 mStrokeWidthSpinBox->blockSignals(
true );
690 mStrokeWidthSpinBox->blockSignals(
false );
691 cboJoinStyle->blockSignals(
true );
693 cboJoinStyle->blockSignals(
false );
696 spinOffsetX->blockSignals(
true );
698 spinOffsetX->blockSignals(
false );
699 spinOffsetY->blockSignals(
true );
701 spinOffsetY->blockSignals(
false );
703 mSizeUnitWidget->blockSignals(
true );
706 mSizeUnitWidget->blockSignals(
false );
707 mOffsetUnitWidget->blockSignals(
true );
710 mOffsetUnitWidget->blockSignals(
false );
711 mStrokeWidthUnitWidget->blockSignals(
true );
714 mStrokeWidthUnitWidget->blockSignals(
false );
717 mHorizontalAnchorComboBox->blockSignals(
true );
718 mVerticalAnchorComboBox->blockSignals(
true );
721 mHorizontalAnchorComboBox->blockSignals(
false );
722 mVerticalAnchorComboBox->blockSignals(
false );
736 updateAssistantSymbol();
744 void QgsSimpleMarkerSymbolLayerWidget::setShape()
763 void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
769 void QgsSimpleMarkerSymbolLayerWidget::setSize()
775 void QgsSimpleMarkerSymbolLayerWidget::setAngle()
781 void QgsSimpleMarkerSymbolLayerWidget::setOffset()
783 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
787 void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
798 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
807 void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
817 void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
827 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
837 void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
846 void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
855 void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
857 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
859 mAssistantPreviewSymbol->deleteSymbolLayer( i );
861 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
864 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
883 btnChangeColor->setAllowOpacity(
true );
884 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
885 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
886 btnChangeColor->setShowNoColor(
true );
887 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
888 btnChangeStrokeColor->setAllowOpacity(
true );
889 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
890 btnChangeStrokeColor->setContext( QStringLiteral(
"symbology" ) );
891 btnChangeStrokeColor->setShowNoColor(
true );
892 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
894 spinOffsetX->setClearValue( 0.0 );
895 spinOffsetY->setClearValue( 0.0 );
898 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
900 connect( spinStrokeWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
901 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
902 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
903 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
904 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
906 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
907 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
912 if ( layer->
layerType() != QLatin1String(
"SimpleFill" ) )
919 btnChangeColor->blockSignals(
true );
921 btnChangeColor->blockSignals(
false );
922 cboFillStyle->blockSignals(
true );
924 cboFillStyle->blockSignals(
false );
925 btnChangeStrokeColor->blockSignals(
true );
927 btnChangeStrokeColor->blockSignals(
false );
928 cboStrokeStyle->blockSignals(
true );
930 cboStrokeStyle->blockSignals(
false );
931 spinStrokeWidth->blockSignals(
true );
933 spinStrokeWidth->blockSignals(
false );
934 cboJoinStyle->blockSignals(
true );
936 cboJoinStyle->blockSignals(
false );
937 spinOffsetX->blockSignals(
true );
939 spinOffsetX->blockSignals(
false );
940 spinOffsetY->blockSignals(
true );
942 spinOffsetY->blockSignals(
false );
944 mStrokeWidthUnitWidget->blockSignals(
true );
947 mStrokeWidthUnitWidget->blockSignals(
false );
948 mOffsetUnitWidget->blockSignals(
true );
951 mOffsetUnitWidget->blockSignals(
false );
979 void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
985 void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
991 void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
998 void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1000 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1004 void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1014 void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1034 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1035 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1041 spinOffsetX->setClearValue( 0.0 );
1042 spinOffsetY->setClearValue( 0.0 );
1043 spinAngle->setClearValue( 0.0 );
1049 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1051 int size = lstNames->iconSize().width();
1052 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
1053 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width(
'X' ) * 3 ) ) );
1055 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1057 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1058 lstNames->setIconSize( QSize( size, size ) );
1060 double markerSize = size * 0.8;
1066 lyr->
setColor( QColor( 200, 200, 200 ) );
1069 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1070 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
1075 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1077 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1078 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1079 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1080 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1081 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1087 if ( layer->
layerType() != QLatin1String(
"FilledMarker" ) )
1095 for (
int i = 0; i < lstNames->count(); ++i )
1099 lstNames->setCurrentRow( i );
1108 mSizeUnitWidget->blockSignals(
true );
1111 mSizeUnitWidget->blockSignals(
false );
1112 mOffsetUnitWidget->blockSignals(
true );
1115 mOffsetUnitWidget->blockSignals(
false );
1128 updateAssistantSymbol();
1136 void QgsFilledMarkerSymbolLayerWidget::setShape()
1142 void QgsFilledMarkerSymbolLayerWidget::setSize()
1148 void QgsFilledMarkerSymbolLayerWidget::setAngle()
1154 void QgsFilledMarkerSymbolLayerWidget::setOffset()
1156 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1160 void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1170 void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1180 void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
1189 void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
1198 void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1200 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1202 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1204 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1207 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1220 connect( mSpinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1224 btnColorRamp->setShowGradientOnly(
true );
1226 btnChangeColor->setAllowOpacity(
true );
1227 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1228 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1229 btnChangeColor->setShowNoColor(
true );
1230 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1231 btnChangeColor2->setAllowOpacity(
true );
1232 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1233 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1234 btnChangeColor2->setShowNoColor(
true );
1235 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1237 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1238 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1240 spinOffsetX->setClearValue( 0.0 );
1241 spinOffsetY->setClearValue( 0.0 );
1242 mSpinAngle->setClearValue( 0.0 );
1250 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1251 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1252 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1253 connect( spinRefPoint1X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1254 connect( spinRefPoint1Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1255 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1256 connect( spinRefPoint2X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1257 connect( spinRefPoint2Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1258 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1263 if ( layer->
layerType() != QLatin1String(
"GradientFill" ) )
1270 btnChangeColor->blockSignals(
true );
1272 btnChangeColor->blockSignals(
false );
1273 btnChangeColor2->blockSignals(
true );
1275 btnChangeColor2->blockSignals(
false );
1279 radioTwoColor->setChecked(
true );
1280 btnColorRamp->setEnabled(
false );
1284 radioColorRamp->setChecked(
true );
1285 btnChangeColor->setEnabled(
false );
1286 btnChangeColor2->setEnabled(
false );
1292 btnColorRamp->blockSignals(
true );
1294 btnColorRamp->blockSignals(
false );
1297 cboGradientType->blockSignals(
true );
1301 cboGradientType->setCurrentIndex( 0 );
1304 cboGradientType->setCurrentIndex( 1 );
1307 cboGradientType->setCurrentIndex( 2 );
1310 cboGradientType->blockSignals(
false );
1312 cboCoordinateMode->blockSignals(
true );
1316 cboCoordinateMode->setCurrentIndex( 1 );
1317 checkRefPoint1Centroid->setEnabled(
false );
1318 checkRefPoint2Centroid->setEnabled(
false );
1322 cboCoordinateMode->setCurrentIndex( 0 );
1325 cboCoordinateMode->blockSignals(
false );
1327 cboGradientSpread->blockSignals(
true );
1331 cboGradientSpread->setCurrentIndex( 0 );
1334 cboGradientSpread->setCurrentIndex( 1 );
1337 cboGradientSpread->setCurrentIndex( 2 );
1340 cboGradientSpread->blockSignals(
false );
1342 spinRefPoint1X->blockSignals(
true );
1344 spinRefPoint1X->blockSignals(
false );
1345 spinRefPoint1Y->blockSignals(
true );
1347 spinRefPoint1Y->blockSignals(
false );
1348 checkRefPoint1Centroid->blockSignals(
true );
1352 spinRefPoint1X->setEnabled(
false );
1353 spinRefPoint1Y->setEnabled(
false );
1355 checkRefPoint1Centroid->blockSignals(
false );
1356 spinRefPoint2X->blockSignals(
true );
1358 spinRefPoint2X->blockSignals(
false );
1359 spinRefPoint2Y->blockSignals(
true );
1361 spinRefPoint2Y->blockSignals(
false );
1362 checkRefPoint2Centroid->blockSignals(
true );
1366 spinRefPoint2X->setEnabled(
false );
1367 spinRefPoint2Y->setEnabled(
false );
1369 checkRefPoint2Centroid->blockSignals(
false );
1371 spinOffsetX->blockSignals(
true );
1373 spinOffsetX->blockSignals(
false );
1374 spinOffsetY->blockSignals(
true );
1376 spinOffsetY->blockSignals(
false );
1377 mSpinAngle->blockSignals(
true );
1379 mSpinAngle->blockSignals(
false );
1381 mOffsetUnitWidget->blockSignals(
true );
1384 mOffsetUnitWidget->blockSignals(
false );
1418 void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1420 if ( radioTwoColor->isChecked() )
1433 if ( btnColorRamp->isNull() )
1447 spinRefPoint1X->setValue( 0.5 );
1448 spinRefPoint1Y->setValue( 0 );
1449 spinRefPoint2X->setValue( 0.5 );
1450 spinRefPoint2Y->setValue( 1 );
1455 spinRefPoint1X->setValue( 0 );
1456 spinRefPoint1Y->setValue( 0 );
1457 spinRefPoint2X->setValue( 1 );
1458 spinRefPoint2Y->setValue( 1 );
1462 spinRefPoint1X->setValue( 0.5 );
1463 spinRefPoint1Y->setValue( 0.5 );
1464 spinRefPoint2X->setValue( 1 );
1465 spinRefPoint2Y->setValue( 1 );
1480 checkRefPoint1Centroid->setEnabled(
true );
1481 checkRefPoint2Centroid->setEnabled(
true );
1487 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1488 checkRefPoint1Centroid->setEnabled(
false );
1489 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1490 checkRefPoint2Centroid->setEnabled(
false );
1515 void QgsGradientFillSymbolLayerWidget::offsetChanged()
1517 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1521 void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1530 void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1536 void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1554 connect( mSpinBlurRadius, qgis::overload< int >::of( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1555 connect( mSpinMaxDistance, qgis::overload< double >::of( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1557 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1559 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1565 QButtonGroup *group1 =
new QButtonGroup(
this );
1566 group1->addButton( radioColorRamp );
1567 group1->addButton( radioTwoColor );
1568 QButtonGroup *group2 =
new QButtonGroup(
this );
1569 group2->addButton( mRadioUseMaxDistance );
1570 group2->addButton( mRadioUseWholeShape );
1571 btnChangeColor->setAllowOpacity(
true );
1572 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1573 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1574 btnChangeColor->setShowNoColor(
true );
1575 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1576 btnChangeColor2->setAllowOpacity(
true );
1577 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1578 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1579 btnChangeColor2->setShowNoColor(
true );
1580 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1582 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1583 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1585 spinOffsetX->setClearValue( 0.0 );
1586 spinOffsetY->setClearValue( 0.0 );
1587 mSpinMaxDistance->setClearValue( 5.0 );
1589 btnColorRamp->setShowGradientOnly(
true );
1595 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1596 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1597 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1599 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1600 connect( mSpinBlurRadius,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1605 if ( layer->
layerType() != QLatin1String(
"ShapeburstFill" ) )
1612 btnChangeColor->blockSignals(
true );
1614 btnChangeColor->blockSignals(
false );
1615 btnChangeColor2->blockSignals(
true );
1617 btnChangeColor2->blockSignals(
false );
1621 radioTwoColor->setChecked(
true );
1622 btnColorRamp->setEnabled(
false );
1626 radioColorRamp->setChecked(
true );
1627 btnChangeColor->setEnabled(
false );
1628 btnChangeColor2->setEnabled(
false );
1631 mSpinBlurRadius->blockSignals(
true );
1632 mBlurSlider->blockSignals(
true );
1635 mSpinBlurRadius->blockSignals(
false );
1636 mBlurSlider->blockSignals(
false );
1638 mSpinMaxDistance->blockSignals(
true );
1640 mSpinMaxDistance->blockSignals(
false );
1642 mRadioUseWholeShape->blockSignals(
true );
1643 mRadioUseMaxDistance->blockSignals(
true );
1646 mRadioUseWholeShape->setChecked(
true );
1647 mSpinMaxDistance->setEnabled(
false );
1648 mDistanceUnitWidget->setEnabled(
false );
1652 mRadioUseMaxDistance->setChecked(
true );
1653 mSpinMaxDistance->setEnabled(
true );
1654 mDistanceUnitWidget->setEnabled(
true );
1656 mRadioUseWholeShape->blockSignals(
false );
1657 mRadioUseMaxDistance->blockSignals(
false );
1659 mDistanceUnitWidget->blockSignals(
true );
1662 mDistanceUnitWidget->blockSignals(
false );
1664 mIgnoreRingsCheckBox->blockSignals(
true );
1665 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1666 mIgnoreRingsCheckBox->blockSignals(
false );
1671 btnColorRamp->blockSignals(
true );
1673 btnColorRamp->blockSignals(
false );
1676 spinOffsetX->blockSignals(
true );
1678 spinOffsetX->blockSignals(
false );
1679 spinOffsetY->blockSignals(
true );
1681 spinOffsetY->blockSignals(
false );
1682 mOffsetUnitWidget->blockSignals(
true );
1685 mOffsetUnitWidget->blockSignals(
false );
1719 void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1726 if ( radioTwoColor->isChecked() )
1737 void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1746 void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1755 void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1765 void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1770 mDistanceUnitWidget->setEnabled( !value );
1775 void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1785 void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1789 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1794 void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1805 void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1807 bool checked = ( state == Qt::Checked );
1836 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
1845 spinOffset->setClearValue( 0.0 );
1850 mRingFilterComboBox->hide();
1851 mRingsLabel->hide();
1854 mSpinAverageAngleLength->setClearValue( 4.0 );
1858 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1859 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1860 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setAverageAngle );
1861 connect( radInterval, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1862 connect( radVertex, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1863 connect( radVertexLast, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1864 connect( radVertexFirst, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1865 connect( radCentralPoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1866 connect( radCurvePoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1867 connect( radSegmentCentralPoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1872 if ( layer->
layerType() != QLatin1String(
"MarkerLine" ) )
1879 spinInterval->blockSignals(
true );
1881 spinInterval->blockSignals(
false );
1882 mSpinOffsetAlongLine->blockSignals(
true );
1884 mSpinOffsetAlongLine->blockSignals(
false );
1885 chkRotateMarker->blockSignals(
true );
1887 chkRotateMarker->blockSignals(
false );
1888 spinOffset->blockSignals(
true );
1890 spinOffset->blockSignals(
false );
1892 radInterval->setChecked(
true );
1894 radVertex->setChecked(
true );
1896 radVertexLast->setChecked(
true );
1898 radCentralPoint->setChecked(
true );
1900 radCurvePoint->setChecked(
true );
1902 radSegmentCentralPoint->setChecked(
true );
1904 radVertexFirst->setChecked(
true );
1907 mIntervalUnitWidget->blockSignals(
true );
1910 mIntervalUnitWidget->blockSignals(
false );
1911 mOffsetUnitWidget->blockSignals(
true );
1914 mOffsetUnitWidget->blockSignals(
false );
1915 mOffsetAlongLineUnitWidget->blockSignals(
true );
1918 mOffsetAlongLineUnitWidget->blockSignals(
false );
1952 void QgsMarkerLineSymbolLayerWidget::setRotate()
1954 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
1955 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
1961 void QgsMarkerLineSymbolLayerWidget::setOffset()
1967 void QgsMarkerLineSymbolLayerWidget::setPlacement()
1969 bool interval = radInterval->isChecked();
1970 spinInterval->setEnabled( interval );
1971 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1972 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
1973 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
1974 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
1976 if ( radInterval->isChecked() )
1978 else if ( radVertex->isChecked() )
1980 else if ( radVertexLast->isChecked() )
1982 else if ( radVertexFirst->isChecked() )
1984 else if ( radCurvePoint->isChecked() )
1986 else if ( radSegmentCentralPoint->isChecked() )
1994 void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2004 void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2014 void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2024 void QgsMarkerLineSymbolLayerWidget::averageAngleUnitChanged()
2034 void QgsMarkerLineSymbolLayerWidget::setAverageAngle(
double val )
2071 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
2080 spinOffset->setClearValue( 0.0 );
2085 mRingFilterComboBox->hide();
2086 mRingsLabel->hide();
2089 mHashRotationSpinBox->setClearValue( 0 );
2090 mSpinAverageAngleLength->setClearValue( 4.0 );
2092 connect( spinInterval,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setInterval );
2093 connect( mSpinOffsetAlongLine,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffsetAlongLine );
2094 connect( mSpinHashLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashLength );
2095 connect( mHashRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashAngle );
2096 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setRotate );
2097 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffset );
2098 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setAverageAngle );
2099 connect( radInterval, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2100 connect( radVertex, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2101 connect( radVertexLast, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2102 connect( radVertexFirst, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2103 connect( radCentralPoint, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2104 connect( radCurvePoint, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2105 connect( radSegmentCentralPoint, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2110 if ( layer->
layerType() != QLatin1String(
"HashLine" ) )
2117 spinInterval->blockSignals(
true );
2118 spinInterval->setValue( mLayer->
interval() );
2119 spinInterval->blockSignals(
false );
2120 mSpinOffsetAlongLine->blockSignals(
true );
2122 mSpinOffsetAlongLine->blockSignals(
false );
2125 chkRotateMarker->blockSignals(
true );
2127 chkRotateMarker->blockSignals(
false );
2128 spinOffset->blockSignals(
true );
2129 spinOffset->setValue( mLayer->
offset() );
2130 spinOffset->blockSignals(
false );
2132 radInterval->setChecked(
true );
2134 radVertex->setChecked(
true );
2136 radVertexLast->setChecked(
true );
2138 radCentralPoint->setChecked(
true );
2140 radCurvePoint->setChecked(
true );
2142 radSegmentCentralPoint->setChecked(
true );
2144 radVertexFirst->setChecked(
true );
2147 mIntervalUnitWidget->blockSignals(
true );
2148 mIntervalUnitWidget->setUnit( mLayer->
intervalUnit() );
2150 mIntervalUnitWidget->blockSignals(
false );
2151 mOffsetUnitWidget->blockSignals(
true );
2152 mOffsetUnitWidget->setUnit( mLayer->
offsetUnit() );
2154 mOffsetUnitWidget->blockSignals(
false );
2155 mOffsetAlongLineUnitWidget->blockSignals(
true );
2158 mOffsetAlongLineUnitWidget->blockSignals(
false );
2165 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->
ringFilter() ) );
2183 void QgsHashedLineSymbolLayerWidget::setInterval(
double val )
2189 void QgsHashedLineSymbolLayerWidget::setOffsetAlongLine(
double val )
2195 void QgsHashedLineSymbolLayerWidget::setHashLength(
double val )
2201 void QgsHashedLineSymbolLayerWidget::setHashAngle(
double val )
2207 void QgsHashedLineSymbolLayerWidget::setRotate()
2209 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
2210 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2216 void QgsHashedLineSymbolLayerWidget::setOffset()
2218 mLayer->
setOffset( spinOffset->value() );
2222 void QgsHashedLineSymbolLayerWidget::setPlacement()
2224 bool interval = radInterval->isChecked();
2225 spinInterval->setEnabled( interval );
2226 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
2227 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2228 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
2229 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2231 if ( radInterval->isChecked() )
2233 else if ( radVertex->isChecked() )
2235 else if ( radVertexLast->isChecked() )
2237 else if ( radVertexFirst->isChecked() )
2239 else if ( radCurvePoint->isChecked() )
2241 else if ( radSegmentCentralPoint->isChecked() )
2249 void QgsHashedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2259 void QgsHashedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2269 void QgsHashedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2279 void QgsHashedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2289 void QgsHashedLineSymbolLayerWidget::averageAngleUnitChanged()
2299 void QgsHashedLineSymbolLayerWidget::setAverageAngle(
double val )
2318 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2319 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral(
"/UI/lastSVGMarkerDir" ) );
2323 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2324 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2328 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2329 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2336 mChangeColorButton->setAllowOpacity(
true );
2337 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2338 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2339 mChangeStrokeColorButton->setAllowOpacity(
true );
2340 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2341 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2343 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2344 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2346 spinOffsetX->setClearValue( 0.0 );
2347 spinOffsetY->setClearValue( 0.0 );
2348 spinAngle->setClearValue( 0.0 );
2350 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2351 connect( spinHeight,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2353 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2354 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2355 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2366 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2367 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2372 #include <QAbstractListModel>
2373 #include <QPixmapCache>
2387 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2388 QColor defaultFill, defaultStroke;
2389 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2390 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2392 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2393 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2394 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2395 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2396 mChangeColorButton->setEnabled( hasFillParam );
2397 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2398 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2399 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2400 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2405 double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2406 if ( hasDefaultFillColor && !skipDefaultColors )
2410 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2411 mChangeColorButton->setColor( fill );
2413 if ( hasStrokeParam )
2416 double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2417 if ( hasDefaultStrokeColor && !skipDefaultColors )
2419 stroke = defaultStroke;
2421 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2422 mChangeStrokeColorButton->setColor( stroke );
2425 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2427 mStrokeWidthSpinBox->blockSignals(
true );
2428 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2429 mStrokeWidthSpinBox->blockSignals(
false );
2432 spinHeight->blockSignals(
true );
2433 if ( preservedAspectRatio )
2442 spinHeight->blockSignals(
false );
2443 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2446 void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2448 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
2450 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2452 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
2455 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2466 if ( layer->
layerType() != QLatin1String(
"SvgMarker" ) )
2473 mSvgSelectorWidget->setSvgPath(
mLayer->
path() );
2475 spinWidth->blockSignals(
true );
2477 spinWidth->blockSignals(
false );
2478 spinAngle->blockSignals(
true );
2480 spinAngle->blockSignals(
false );
2483 spinOffsetX->blockSignals(
true );
2485 spinOffsetX->blockSignals(
false );
2486 spinOffsetY->blockSignals(
true );
2488 spinOffsetY->blockSignals(
false );
2490 mSizeUnitWidget->blockSignals(
true );
2493 mSizeUnitWidget->blockSignals(
false );
2494 mStrokeWidthUnitWidget->blockSignals(
true );
2497 mStrokeWidthUnitWidget->blockSignals(
false );
2498 mOffsetUnitWidget->blockSignals(
true );
2501 mOffsetUnitWidget->blockSignals(
false );
2504 mHorizontalAnchorComboBox->blockSignals(
true );
2505 mVerticalAnchorComboBox->blockSignals(
true );
2508 mHorizontalAnchorComboBox->blockSignals(
false );
2509 mVerticalAnchorComboBox->blockSignals(
false );
2525 updateAssistantSymbol();
2542 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2548 void QgsSvgMarkerSymbolLayerWidget::setWidth()
2551 double fixedAspectRatio = 0.0;
2552 spinHeight->blockSignals(
true );
2553 if ( defaultAspectRatio <= 0.0 )
2555 spinHeight->setValue( spinWidth->value() );
2557 else if ( mLockAspectRatio->locked() )
2559 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2563 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2565 spinHeight->blockSignals(
false );
2571 void QgsSvgMarkerSymbolLayerWidget::setHeight()
2574 double fixedAspectRatio = 0.0;
2575 spinWidth->blockSignals(
true );
2576 if ( defaultAspectRatio <= 0.0 )
2578 spinWidth->setValue( spinHeight->value() );
2580 else if ( mLockAspectRatio->locked() )
2582 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2586 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2588 spinWidth->blockSignals(
false );
2594 void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2598 if ( defaultAspectRatio <= 0.0 )
2614 void QgsSvgMarkerSymbolLayerWidget::setAngle()
2620 void QgsSvgMarkerSymbolLayerWidget::setOffset()
2622 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2626 void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2633 void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2644 void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2655 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2664 void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2674 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2684 void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2694 void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
2703 void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
2719 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2721 connect( mTextureWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2723 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2725 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2726 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2734 mRotationSpinBox->setClearValue( 0.0 );
2736 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2737 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2738 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2739 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2741 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2742 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2755 if ( layer->
layerType() != QLatin1String(
"SVGFill" ) )
2764 mTextureWidthSpinBox->blockSignals(
true );
2765 mTextureWidthSpinBox->setValue( width );
2766 mTextureWidthSpinBox->blockSignals(
false );
2768 mRotationSpinBox->blockSignals(
true );
2770 mRotationSpinBox->blockSignals(
false );
2771 mTextureWidthUnitWidget->blockSignals(
true );
2774 mTextureWidthUnitWidget->blockSignals(
false );
2775 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2778 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2779 mChangeColorButton->blockSignals(
true );
2781 mChangeColorButton->blockSignals(
false );
2782 mChangeStrokeColorButton->blockSignals(
true );
2784 mChangeStrokeColorButton->blockSignals(
false );
2785 mStrokeWidthSpinBox->blockSignals(
true );
2787 mStrokeWidthSpinBox->blockSignals(
false );
2811 void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2820 void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2832 void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2835 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2842 void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2854 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2855 QColor defaultFill, defaultStroke;
2856 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2857 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2859 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2860 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2861 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2862 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2865 QColor fill = mChangeColorButton->color();
2866 double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2867 if ( hasDefaultFillColor )
2871 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2872 mChangeColorButton->setColor( fill );
2874 mChangeColorButton->setEnabled( hasFillParam );
2875 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2878 QColor stroke = mChangeStrokeColorButton->color();
2879 double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2880 if ( hasDefaultStrokeColor )
2882 stroke = defaultStroke;
2884 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2885 mChangeStrokeColorButton->setColor( stroke );
2887 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2888 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2889 if ( hasDefaultStrokeWidth && resetValues )
2891 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2893 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2896 void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2907 void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2918 void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2927 void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
2937 void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
2953 connect( mAngleSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
2954 connect( mDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
2955 connect( mOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
2962 mOffsetSpinBox->setClearValue( 0 );
2963 mAngleSpinBox->setClearValue( 0 );
2968 if ( layer->
layerType() != QLatin1String(
"LinePatternFill" ) )
2977 mAngleSpinBox->blockSignals(
true );
2979 mAngleSpinBox->blockSignals(
false );
2980 mDistanceSpinBox->blockSignals(
true );
2982 mDistanceSpinBox->blockSignals(
false );
2983 mOffsetSpinBox->blockSignals(
true );
2985 mOffsetSpinBox->blockSignals(
false );
2988 mDistanceUnitWidget->blockSignals(
true );
2991 mDistanceUnitWidget->blockSignals(
false );
2992 mOffsetUnitWidget->blockSignals(
true );
2995 mOffsetUnitWidget->blockSignals(
false );
3007 void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3016 void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3025 void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3034 void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3044 void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3060 connect( mHorizontalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3061 connect( mVerticalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3062 connect( mHorizontalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3063 connect( mVerticalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3064 connect( mHorizontalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3065 connect( mVerticalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3066 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3067 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3068 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3069 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3070 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3071 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3089 if ( !layer || layer->
layerType() != QLatin1String(
"PointPatternFill" ) )
3102 mHorizontalDistanceUnitWidget->blockSignals(
true );
3105 mHorizontalDistanceUnitWidget->blockSignals(
false );
3106 mVerticalDistanceUnitWidget->blockSignals(
true );
3109 mVerticalDistanceUnitWidget->blockSignals(
false );
3110 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3113 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3114 mVerticalDisplacementUnitWidget->blockSignals(
true );
3117 mVerticalDisplacementUnitWidget->blockSignals(
false );
3118 mHorizontalOffsetUnitWidget->blockSignals(
true );
3121 mHorizontalOffsetUnitWidget->blockSignals(
false );
3122 mVerticalOffsetUnitWidget->blockSignals(
true );
3125 mVerticalOffsetUnitWidget->blockSignals(
false );
3140 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3149 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3158 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3167 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3176 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3185 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3194 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3204 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3214 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3224 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3234 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3244 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3265 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3266 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3267 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3277 scrollArea->setVerticalOnly(
true );
3279 btnColor->setAllowOpacity(
true );
3280 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3281 btnColor->setContext( QStringLiteral(
"symbology" ) );
3282 btnStrokeColor->setAllowOpacity(
true );
3283 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3284 btnStrokeColor->setContext( QStringLiteral(
"symbology" ) );
3286 mColorDDBtn->registerLinkedWidget( btnColor );
3287 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3289 spinOffsetX->setClearValue( 0.0 );
3290 spinOffsetY->setClearValue( 0.0 );
3291 spinAngle->setClearValue( 0.0 );
3297 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3300 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3302 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3305 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3307 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3308 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3317 if ( layer->
layerType() != QLatin1String(
"FontMarker" ) )
3326 mFontStyleComboBox->blockSignals(
true );
3327 populateFontStyleComboBox();
3328 mFontStyleComboBox->blockSignals(
false );
3346 mCharPreview->setFont( mRefFont );
3352 mSizeUnitWidget->blockSignals(
true );
3355 mSizeUnitWidget->blockSignals(
false );
3357 mStrokeWidthUnitWidget->blockSignals(
true );
3360 mStrokeWidthUnitWidget->blockSignals(
false );
3362 mOffsetUnitWidget->blockSignals(
true );
3365 mOffsetUnitWidget->blockSignals(
false );
3386 updateAssistantSymbol();
3399 mRefFont.setFamily( font.family() );
3401 mCharPreview->setFont( mRefFont );
3402 populateFontStyleComboBox();
3407 void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3414 mCharPreview->setFont( mRefFont );
3446 mCharPreview->setText( text );
3448 if ( text.isEmpty() )
3452 QString character = text;
3453 if ( text.contains( QRegularExpression( QStringLiteral(
"^0x[0-9a-fA-F]{1,4}$" ) ) ) )
3456 unsigned int value = text.toUInt( &ok, 0 );
3459 character = QChar( value );
3460 mCharPreview->setText( character );
3481 if (
mLayer->
character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3483 mCharLineEdit->insert( chr );
3489 mCharPreview->setText( chr );
3493 void QgsFontMarkerSymbolLayerWidget::setOffset()
3495 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3499 void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3505 void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3515 void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3525 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3535 void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3537 mFontStyleComboBox->clear();
3538 QStringList styles = mFontDB.styles( mRefFont.family() );
3539 const auto constStyles = styles;
3540 for (
const QString &style : constStyles )
3542 mFontStyleComboBox->addItem( style );
3545 QString targetStyle = mFontDB.styleString( mRefFont );
3546 if ( !styles.contains( targetStyle ) )
3548 QFont f = QFont( mRefFont.family() );
3549 targetStyle = QFontInfo( f ).styleName();
3550 mRefFont.setStyleName( targetStyle );
3553 int stylIndx = mFontStyleComboBox->findText( targetStyle );
3554 if ( stylIndx > -1 )
3559 mFontStyleComboBox->setCurrentIndex( curIndx );
3562 void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3565 setFontStyle( mFontStyleComboBox->currentText() );
3568 void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3577 void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3586 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3595 void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3597 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
3599 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3601 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
3604 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3616 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3617 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3618 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3619 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3624 if ( layer->
layerType() != QLatin1String(
"CentroidFill" ) )
3642 void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3648 void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3654 void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
3660 void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
3675 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3679 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3681 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3682 connect( mHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3690 mSpinOffsetX->setClearValue( 0.0 );
3691 mSpinOffsetY->setClearValue( 0.0 );
3692 mRotationSpinBox->setClearValue( 0.0 );
3694 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3695 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3698 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3699 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3709 if ( layer->
layerType() != QLatin1String(
"RasterMarker" ) )
3720 mHeightSpinBox->blockSignals(
true );
3721 if ( preservedAspectRatio )
3730 mHeightSpinBox->blockSignals(
false );
3731 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
3739 mSizeUnitWidget->blockSignals(
true );
3742 mSizeUnitWidget->blockSignals(
false );
3743 mOffsetUnitWidget->blockSignals(
true );
3746 mOffsetUnitWidget->blockSignals(
false );
3761 updatePreviewImage();
3775 void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
3778 updatePreviewImage();
3782 void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
3784 bool fitsInCache =
false;
3786 if ( image.isNull() )
3788 mLabelImagePreview->setPixmap( QPixmap() );
3792 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3793 previewImage.fill( Qt::transparent );
3794 QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3796 p.begin( &previewImage );
3798 uchar pixDataRGB[] = { 150, 150, 150, 150,
3803 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3804 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3805 QBrush checkerBrush;
3806 checkerBrush.setTexture( pix );
3807 p.fillRect( imageRect, checkerBrush );
3814 p.drawImage( imageRect.left(), imageRect.top(), image );
3816 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3819 void QgsRasterMarkerSymbolLayerWidget::setWidth()
3822 double fixedAspectRatio = 0.0;
3823 mHeightSpinBox->blockSignals(
true );
3824 if ( defaultAspectRatio <= 0.0 )
3826 mHeightSpinBox->setValue( mWidthSpinBox->value() );
3828 else if ( mLockAspectRatio->locked() )
3830 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
3834 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3836 mHeightSpinBox->blockSignals(
false );
3842 void QgsRasterMarkerSymbolLayerWidget::setHeight()
3845 double fixedAspectRatio = 0.0;
3846 mWidthSpinBox->blockSignals(
true );
3847 if ( defaultAspectRatio <= 0.0 )
3849 mWidthSpinBox->setValue( mHeightSpinBox->value() );
3851 else if ( mLockAspectRatio->locked() )
3853 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
3857 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3859 mWidthSpinBox->blockSignals(
false );
3865 void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
3868 if ( defaultAspectRatio <= 0.0 )
3883 void QgsRasterMarkerSymbolLayerWidget::setAngle()
3889 void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
3893 updatePreviewImage();
3896 void QgsRasterMarkerSymbolLayerWidget::setOffset()
3898 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
3902 void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3912 void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3922 void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3931 void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3948 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3952 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
3954 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged );
3961 mSpinOffsetX->setClearValue( 0.0 );
3962 mSpinOffsetY->setClearValue( 0.0 );
3963 mRotationSpinBox->setClearValue( 0.0 );
3965 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
3966 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3967 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3979 if ( layer->
layerType() != QLatin1String(
"RasterFill" ) )
3992 cboCoordinateMode->blockSignals(
true );
3996 cboCoordinateMode->setCurrentIndex( 1 );
4000 cboCoordinateMode->setCurrentIndex( 0 );
4003 cboCoordinateMode->blockSignals(
false );
4009 mOffsetUnitWidget->blockSignals(
true );
4012 mOffsetUnitWidget->blockSignals(
false );
4015 mWidthUnitWidget->blockSignals(
true );
4018 mWidthUnitWidget->blockSignals(
false );
4020 updatePreviewImage();
4034 void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4037 updatePreviewImage();
4041 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4058 void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4067 updatePreviewImage();
4070 void QgsRasterFillSymbolLayerWidget::offsetChanged()
4072 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4076 void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4087 void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4096 void QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed()
4107 void QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged(
double d )
4117 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4119 bool fitsInCache =
false;
4121 if ( image.isNull() )
4123 mLabelImagePreview->setPixmap( QPixmap() );
4127 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4128 previewImage.fill( Qt::transparent );
4129 QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4131 p.begin( &previewImage );
4133 uchar pixDataRGB[] = { 150, 150, 150, 150,
4138 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4139 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4140 QBrush checkerBrush;
4141 checkerBrush.setTexture( pix );
4142 p.fillRect( imageRect, checkerBrush );
4149 p.drawImage( imageRect.left(), imageRect.top(), image );
4151 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4160 modificationExpressionSelector->setMultiLine(
true );
4161 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
4162 modificationExpressionSelector->registerExpressionContextGenerator(
this );
4167 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
4174 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData( mLayer->
symbolType() ) );
4182 void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
4189 void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
4209 mPointCountSpinBox->setShowClearButton(
true );
4210 mPointCountSpinBox->setClearValue( 100 );
4211 mSeedSpinBox->setShowClearButton(
true );
4212 mSeedSpinBox->setClearValue( 0 );
4214 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
4215 connect( mPointCountSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
4216 connect( mDensityAreaSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
4217 connect( mSeedSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
4218 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
4235 if ( !layer || layer->
layerType() != QLatin1String(
"RandomMarkerFill" ) )
4245 bool showDensityBasedCountWidgets =
false;
4249 showDensityBasedCountWidgets =
true;
4254 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4255 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4256 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4257 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4261 mDensityAreaUnitWidget->blockSignals(
true );
4264 mDensityAreaUnitWidget->blockSignals(
false );
4277 void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
4280 bool showDensityBasedCountWidgets =
false;
4284 showDensityBasedCountWidgets =
true;
4289 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4290 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4291 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4292 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4301 void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
4310 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
4319 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
4329 void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )