46#include <QAbstractButton>
47#include <QButtonGroup>
48#include <QColorDialog>
53#include <QStandardItemModel>
54#include <QSvgRenderer>
58#include <QInputDialog>
60#include <QRegularExpression>
66 return *lExpressionContext;
77 expContext << symbolScope;
99 QStringList highlights;
105 << QStringLiteral(
"symbol_layer_count" ) << QStringLiteral(
"symbol_layer_index" ) << QStringLiteral(
"symbol_frame" );
108 if ( expContext.
hasVariable( QStringLiteral(
"zoom_level" ) ) )
110 highlights << QStringLiteral(
"zoom_level" );
112 if ( expContext.
hasVariable( QStringLiteral(
"vector_tile_zoom" ) ) )
114 highlights << QStringLiteral(
"vector_tile_zoom" );
125 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
128 unitWidget->setMapCanvas( mContext.
mapCanvas() );
146void QgsSymbolLayerWidget::createAuxiliaryField()
167 if ( dlg.exec() == QDialog::Accepted )
168 def = dlg.propertyDefinition();
178 property.setActive(
true );
200 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
201 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
205 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
207 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [ = ]
209 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
210 if ( !mCheckAlignDash->isChecked() )
211 mCheckDashCorners->setChecked(
false );
219 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [ = ]
241 btnChangeColor->setAllowOpacity(
true );
242 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
243 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
245 mColorDDBtn->registerLinkedWidget( btnChangeColor );
250 connect( mRingFilterComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
259 spinOffset->setClearValue( 0.0 );
260 spinPatternOffset->setClearValue( 0.0 );
262 mTrimStartDistanceSpin->setClearValue( 0.0 );
263 mTrimDistanceEndSpin->setClearValue( 0.0 );
269 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
271 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
273 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
274 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
275 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
276 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
277 connect( spinPatternOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
279 connect( mTrimStartDistanceSpin,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double value )
296 connect( mTrimDistanceEndSpin,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double value )
322void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
324 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
326 mAssistantPreviewSymbol->deleteSymbolLayer( i );
328 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
331 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
337 if ( !layer || layer->
layerType() != QLatin1String(
"SimpleLine" ) )
344 mPenWidthUnitWidget->blockSignals(
true );
347 mPenWidthUnitWidget->blockSignals(
false );
348 mOffsetUnitWidget->blockSignals(
true );
351 mOffsetUnitWidget->blockSignals(
false );
352 mDashPatternUnitWidget->blockSignals(
true );
355 mDashPatternUnitWidget->blockSignals(
false );
365 spinWidth->blockSignals(
true );
367 spinWidth->blockSignals(
false );
368 btnChangeColor->blockSignals(
true );
370 btnChangeColor->blockSignals(
false );
371 spinOffset->blockSignals(
true );
373 spinOffset->blockSignals(
false );
374 cboPenStyle->blockSignals(
true );
375 cboJoinStyle->blockSignals(
true );
376 cboCapStyle->blockSignals(
true );
380 cboPenStyle->blockSignals(
false );
381 cboJoinStyle->blockSignals(
false );
382 cboCapStyle->blockSignals(
false );
389 mChangePatternButton->setEnabled( useCustomDashPattern );
390 label_3->setEnabled( !useCustomDashPattern );
391 cboPenStyle->setEnabled( !useCustomDashPattern );
392 mCustomCheckBox->blockSignals(
true );
393 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
394 mCustomCheckBox->blockSignals(
false );
397 const QSize size = mChangePatternButton->minimumSizeHint();
399 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
403 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
424 updateAssistantSymbol();
441 mDrawInsideCheckBox->hide();
442 mRingFilterComboBox->hide();
452void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
459void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
465void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
474void QgsSimpleLineSymbolLayerWidget::offsetChanged()
481void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
488void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
490 const bool checked = ( state == Qt::Checked );
491 mChangePatternButton->setEnabled( checked );
492 label_3->setEnabled( !checked );
493 cboPenStyle->setEnabled( !checked );
499void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
506 widget->
setUnit( mDashPatternUnitWidget->unit() );
518 d.setUnit( mDashPatternUnitWidget->unit() );
519 if ( d.exec() == QDialog::Accepted )
527void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
538void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
548void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
559void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
561 const bool checked = ( state == Qt::Checked );
566void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
583 std::unique_ptr< QgsSimpleLineSymbolLayer > layerCopy(
mLayer->
clone() );
588 const QColor color = qApp->palette().color( QPalette::WindowText );
589 layerCopy->setColor( color );
591 layerCopy->setOffset( 0 );
592 layerCopy->setUseCustomDashPattern(
true );
594 QSize currentIconSize;
597 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
599 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
602 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
608 const std::unique_ptr< QgsLineSymbol > previewSymbol = std::make_unique< QgsLineSymbol >(
QgsSymbolLayerList() << layerCopy.release() );
610 mChangePatternButton->setIconSize( currentIconSize );
611 mChangePatternButton->setIcon( icon );
615 const int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
616 const int height =
static_cast< int >( width / 1.61803398875 );
620 QBuffer buffer( &data );
621 pm.save( &buffer,
"PNG", 100 );
622 mChangePatternButton->setToolTip( QStringLiteral(
"<img src='data:image/png;base64, %3' width=\"%4\">" ).arg( QString( data.toBase64() ) ).arg( width ) );
627 QgsSymbolLayerWidget::resizeEvent( event );
645 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
646 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
647 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
648 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
656 btnChangeColorFill->setAllowOpacity(
true );
657 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
658 btnChangeColorFill->setContext( QStringLiteral(
"symbology" ) );
659 btnChangeColorFill->setShowNoColor(
true );
660 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
661 btnChangeColorStroke->setAllowOpacity(
true );
662 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
663 btnChangeColorStroke->setContext( QStringLiteral(
"symbology" ) );
664 btnChangeColorStroke->setShowNoColor(
true );
665 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
667 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
668 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
670 spinOffsetX->setClearValue( 0.0 );
671 spinOffsetY->setClearValue( 0.0 );
672 spinAngle->setClearValue( 0.0 );
678 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
680 int size = lstNames->iconSize().width();
682 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
684 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
685 lstNames->setIconSize( QSize( size, size ) );
687 const double markerSize = size * 0.8;
693 lyr->
setColor( QColor( 200, 200, 200 ) );
696 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
697 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
702 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
704 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
707 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
708 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
709 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
710 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
711 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
712 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
720 if ( layer->
layerType() != QLatin1String(
"SimpleMarker" ) )
728 for (
int i = 0; i < lstNames->count(); ++i )
730 if (
static_cast< Qgis::MarkerShape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
732 lstNames->setCurrentRow( i );
736 btnChangeColorStroke->blockSignals(
true );
738 btnChangeColorStroke->blockSignals(
false );
739 btnChangeColorFill->blockSignals(
true );
742 btnChangeColorFill->blockSignals(
false );
743 spinSize->blockSignals(
true );
745 spinSize->blockSignals(
false );
746 spinAngle->blockSignals(
true );
748 spinAngle->blockSignals(
false );
749 mStrokeStyleComboBox->blockSignals(
true );
751 mStrokeStyleComboBox->blockSignals(
false );
752 mStrokeWidthSpinBox->blockSignals(
true );
754 mStrokeWidthSpinBox->blockSignals(
false );
755 cboJoinStyle->blockSignals(
true );
757 cboJoinStyle->blockSignals(
false );
758 cboCapStyle->blockSignals(
true );
760 cboCapStyle->blockSignals(
false );
763 spinOffsetX->blockSignals(
true );
765 spinOffsetX->blockSignals(
false );
766 spinOffsetY->blockSignals(
true );
768 spinOffsetY->blockSignals(
false );
770 mSizeUnitWidget->blockSignals(
true );
773 mSizeUnitWidget->blockSignals(
false );
774 mOffsetUnitWidget->blockSignals(
true );
777 mOffsetUnitWidget->blockSignals(
false );
778 mStrokeWidthUnitWidget->blockSignals(
true );
781 mStrokeWidthUnitWidget->blockSignals(
false );
784 mHorizontalAnchorComboBox->blockSignals(
true );
785 mVerticalAnchorComboBox->blockSignals(
true );
788 mHorizontalAnchorComboBox->blockSignals(
false );
789 mVerticalAnchorComboBox->blockSignals(
false );
804 updateAssistantSymbol();
812void QgsSimpleMarkerSymbolLayerWidget::setShape()
831void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
837void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
843void QgsSimpleMarkerSymbolLayerWidget::setSize()
849void QgsSimpleMarkerSymbolLayerWidget::setAngle()
855void QgsSimpleMarkerSymbolLayerWidget::setOffset()
857 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
861void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
872void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
881void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
891void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
901void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
911void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
920void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
929void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
931 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
933 mAssistantPreviewSymbol->deleteSymbolLayer( i );
935 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
938 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
957 btnChangeColor->setAllowOpacity(
true );
958 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
959 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
960 btnChangeColor->setShowNoColor(
true );
961 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
962 btnChangeStrokeColor->setAllowOpacity(
true );
963 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
964 btnChangeStrokeColor->setContext( QStringLiteral(
"symbology" ) );
965 btnChangeStrokeColor->setShowNoColor(
true );
966 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
968 spinOffsetX->setClearValue( 0.0 );
969 spinOffsetY->setClearValue( 0.0 );
972 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
974 connect( spinStrokeWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
975 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
976 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
977 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
978 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
980 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
981 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
986 if ( layer->
layerType() != QLatin1String(
"SimpleFill" ) )
993 btnChangeColor->blockSignals(
true );
995 btnChangeColor->blockSignals(
false );
996 cboFillStyle->blockSignals(
true );
998 cboFillStyle->blockSignals(
false );
999 btnChangeStrokeColor->blockSignals(
true );
1001 btnChangeStrokeColor->blockSignals(
false );
1002 cboStrokeStyle->blockSignals(
true );
1004 cboStrokeStyle->blockSignals(
false );
1005 spinStrokeWidth->blockSignals(
true );
1007 spinStrokeWidth->blockSignals(
false );
1008 cboJoinStyle->blockSignals(
true );
1010 cboJoinStyle->blockSignals(
false );
1011 spinOffsetX->blockSignals(
true );
1013 spinOffsetX->blockSignals(
false );
1014 spinOffsetY->blockSignals(
true );
1016 spinOffsetY->blockSignals(
false );
1018 mStrokeWidthUnitWidget->blockSignals(
true );
1021 mStrokeWidthUnitWidget->blockSignals(
false );
1022 mOffsetUnitWidget->blockSignals(
true );
1025 mOffsetUnitWidget->blockSignals(
false );
1053void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1059void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1065void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1072void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1074 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1078void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1088void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1108 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1109 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1115 spinOffsetX->setClearValue( 0.0 );
1116 spinOffsetY->setClearValue( 0.0 );
1117 spinAngle->setClearValue( 0.0 );
1123 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1125 int size = lstNames->iconSize().width();
1126 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1127 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1128 lstNames->setIconSize( QSize( size, size ) );
1130 const double markerSize = size * 0.8;
1136 lyr->
setColor( QColor( 200, 200, 200 ) );
1139 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1140 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
1145 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1147 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1148 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1149 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1150 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1151 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1159 if ( layer->
layerType() != QLatin1String(
"FilledMarker" ) )
1167 for (
int i = 0; i < lstNames->count(); ++i )
1169 if (
static_cast< Qgis::MarkerShape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1171 lstNames->setCurrentRow( i );
1180 mSizeUnitWidget->blockSignals(
true );
1183 mSizeUnitWidget->blockSignals(
false );
1184 mOffsetUnitWidget->blockSignals(
true );
1187 mOffsetUnitWidget->blockSignals(
false );
1200 updateAssistantSymbol();
1208void QgsFilledMarkerSymbolLayerWidget::setShape()
1214void QgsFilledMarkerSymbolLayerWidget::setSize()
1220void QgsFilledMarkerSymbolLayerWidget::setAngle()
1226void QgsFilledMarkerSymbolLayerWidget::setOffset()
1228 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1232void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1242void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1252void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
1261void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
1270void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1272 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1274 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1276 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1279 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1292 connect( mSpinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1296 btnColorRamp->setShowGradientOnly(
true );
1298 btnChangeColor->setAllowOpacity(
true );
1299 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1300 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1301 btnChangeColor->setShowNoColor(
true );
1302 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1303 btnChangeColor2->setAllowOpacity(
true );
1304 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1305 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1306 btnChangeColor2->setShowNoColor(
true );
1307 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1309 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1310 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1312 spinOffsetX->setClearValue( 0.0 );
1313 spinOffsetY->setClearValue( 0.0 );
1314 mSpinAngle->setClearValue( 0.0 );
1322 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1323 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1324 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1325 connect( spinRefPoint1X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1326 connect( spinRefPoint1Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1327 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1328 connect( spinRefPoint2X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1329 connect( spinRefPoint2Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1330 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1335 if ( layer->
layerType() != QLatin1String(
"GradientFill" ) )
1342 btnChangeColor->blockSignals(
true );
1344 btnChangeColor->blockSignals(
false );
1345 btnChangeColor2->blockSignals(
true );
1347 btnChangeColor2->blockSignals(
false );
1351 radioTwoColor->setChecked(
true );
1352 btnColorRamp->setEnabled(
false );
1356 radioColorRamp->setChecked(
true );
1357 btnChangeColor->setEnabled(
false );
1358 btnChangeColor2->setEnabled(
false );
1364 btnColorRamp->blockSignals(
true );
1366 btnColorRamp->blockSignals(
false );
1369 cboGradientType->blockSignals(
true );
1373 cboGradientType->setCurrentIndex( 0 );
1376 cboGradientType->setCurrentIndex( 1 );
1379 cboGradientType->setCurrentIndex( 2 );
1382 cboGradientType->blockSignals(
false );
1384 cboCoordinateMode->blockSignals(
true );
1388 cboCoordinateMode->setCurrentIndex( 1 );
1389 checkRefPoint1Centroid->setEnabled(
false );
1390 checkRefPoint2Centroid->setEnabled(
false );
1394 cboCoordinateMode->setCurrentIndex( 0 );
1397 cboCoordinateMode->blockSignals(
false );
1399 cboGradientSpread->blockSignals(
true );
1403 cboGradientSpread->setCurrentIndex( 0 );
1406 cboGradientSpread->setCurrentIndex( 1 );
1409 cboGradientSpread->setCurrentIndex( 2 );
1412 cboGradientSpread->blockSignals(
false );
1414 spinRefPoint1X->blockSignals(
true );
1416 spinRefPoint1X->blockSignals(
false );
1417 spinRefPoint1Y->blockSignals(
true );
1419 spinRefPoint1Y->blockSignals(
false );
1420 checkRefPoint1Centroid->blockSignals(
true );
1424 spinRefPoint1X->setEnabled(
false );
1425 spinRefPoint1Y->setEnabled(
false );
1427 checkRefPoint1Centroid->blockSignals(
false );
1428 spinRefPoint2X->blockSignals(
true );
1430 spinRefPoint2X->blockSignals(
false );
1431 spinRefPoint2Y->blockSignals(
true );
1433 spinRefPoint2Y->blockSignals(
false );
1434 checkRefPoint2Centroid->blockSignals(
true );
1438 spinRefPoint2X->setEnabled(
false );
1439 spinRefPoint2Y->setEnabled(
false );
1441 checkRefPoint2Centroid->blockSignals(
false );
1443 spinOffsetX->blockSignals(
true );
1445 spinOffsetX->blockSignals(
false );
1446 spinOffsetY->blockSignals(
true );
1448 spinOffsetY->blockSignals(
false );
1449 mSpinAngle->blockSignals(
true );
1451 mSpinAngle->blockSignals(
false );
1453 mOffsetUnitWidget->blockSignals(
true );
1456 mOffsetUnitWidget->blockSignals(
false );
1490void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1492 if ( radioTwoColor->isChecked() )
1505 if ( btnColorRamp->isNull() )
1519 spinRefPoint1X->setValue( 0.5 );
1520 spinRefPoint1Y->setValue( 0 );
1521 spinRefPoint2X->setValue( 0.5 );
1522 spinRefPoint2Y->setValue( 1 );
1527 spinRefPoint1X->setValue( 0 );
1528 spinRefPoint1Y->setValue( 0 );
1529 spinRefPoint2X->setValue( 1 );
1530 spinRefPoint2Y->setValue( 1 );
1534 spinRefPoint1X->setValue( 0.5 );
1535 spinRefPoint1Y->setValue( 0.5 );
1536 spinRefPoint2X->setValue( 1 );
1537 spinRefPoint2Y->setValue( 1 );
1552 checkRefPoint1Centroid->setEnabled(
true );
1553 checkRefPoint2Centroid->setEnabled(
true );
1559 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1560 checkRefPoint1Centroid->setEnabled(
false );
1561 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1562 checkRefPoint2Centroid->setEnabled(
false );
1587void QgsGradientFillSymbolLayerWidget::offsetChanged()
1589 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1593void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1602void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1608void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1626 connect( mSpinBlurRadius, qOverload< int >( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1627 connect( mSpinMaxDistance, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1629 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1631 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1637 QButtonGroup *group1 =
new QButtonGroup(
this );
1638 group1->addButton( radioColorRamp );
1639 group1->addButton( radioTwoColor );
1640 QButtonGroup *group2 =
new QButtonGroup(
this );
1641 group2->addButton( mRadioUseMaxDistance );
1642 group2->addButton( mRadioUseWholeShape );
1643 btnChangeColor->setAllowOpacity(
true );
1644 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1645 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1646 btnChangeColor->setShowNoColor(
true );
1647 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1648 btnChangeColor2->setAllowOpacity(
true );
1649 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1650 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1651 btnChangeColor2->setShowNoColor(
true );
1652 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1654 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1655 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1657 spinOffsetX->setClearValue( 0.0 );
1658 spinOffsetY->setClearValue( 0.0 );
1659 mSpinMaxDistance->setClearValue( 5.0 );
1661 btnColorRamp->setShowGradientOnly(
true );
1667 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1668 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1669 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1671 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1672 connect( mSpinBlurRadius,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1677 if ( layer->
layerType() != QLatin1String(
"ShapeburstFill" ) )
1684 btnChangeColor->blockSignals(
true );
1686 btnChangeColor->blockSignals(
false );
1687 btnChangeColor2->blockSignals(
true );
1689 btnChangeColor2->blockSignals(
false );
1693 radioTwoColor->setChecked(
true );
1694 btnColorRamp->setEnabled(
false );
1698 radioColorRamp->setChecked(
true );
1699 btnChangeColor->setEnabled(
false );
1700 btnChangeColor2->setEnabled(
false );
1703 mSpinBlurRadius->blockSignals(
true );
1704 mBlurSlider->blockSignals(
true );
1707 mSpinBlurRadius->blockSignals(
false );
1708 mBlurSlider->blockSignals(
false );
1710 mSpinMaxDistance->blockSignals(
true );
1712 mSpinMaxDistance->blockSignals(
false );
1714 mRadioUseWholeShape->blockSignals(
true );
1715 mRadioUseMaxDistance->blockSignals(
true );
1718 mRadioUseWholeShape->setChecked(
true );
1719 mSpinMaxDistance->setEnabled(
false );
1720 mDistanceUnitWidget->setEnabled(
false );
1724 mRadioUseMaxDistance->setChecked(
true );
1725 mSpinMaxDistance->setEnabled(
true );
1726 mDistanceUnitWidget->setEnabled(
true );
1728 mRadioUseWholeShape->blockSignals(
false );
1729 mRadioUseMaxDistance->blockSignals(
false );
1731 mDistanceUnitWidget->blockSignals(
true );
1734 mDistanceUnitWidget->blockSignals(
false );
1736 mIgnoreRingsCheckBox->blockSignals(
true );
1737 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1738 mIgnoreRingsCheckBox->blockSignals(
false );
1743 btnColorRamp->blockSignals(
true );
1745 btnColorRamp->blockSignals(
false );
1748 spinOffsetX->blockSignals(
true );
1750 spinOffsetX->blockSignals(
false );
1751 spinOffsetY->blockSignals(
true );
1753 spinOffsetY->blockSignals(
false );
1754 mOffsetUnitWidget->blockSignals(
true );
1757 mOffsetUnitWidget->blockSignals(
false );
1791void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1798 if ( radioTwoColor->isChecked() )
1809void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1818void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1827void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1837void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1842 mDistanceUnitWidget->setEnabled( !value );
1847void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1857void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1861 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1866void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1877void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1879 const bool checked = ( state == Qt::Checked );
1908 connect( mRingFilterComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
1917 spinOffset->setClearValue( 0.0 );
1918 mSpinOffsetAlongLine->setClearValue( 0.0 );
1919 mSpinAverageAngleLength->setClearValue( 4.0 );
1923 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1924 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1925 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setAverageAngle );
1926 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1927 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1928 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1929 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1930 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1931 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1932 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1933 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [ = ]
1945 if ( layer->
layerType() != QLatin1String(
"MarkerLine" ) )
1952 spinInterval->blockSignals(
true );
1954 spinInterval->blockSignals(
false );
1955 mSpinOffsetAlongLine->blockSignals(
true );
1957 mSpinOffsetAlongLine->blockSignals(
false );
1958 chkRotateMarker->blockSignals(
true );
1960 chkRotateMarker->blockSignals(
false );
1961 spinOffset->blockSignals(
true );
1963 spinOffset->blockSignals(
false );
1978 mIntervalUnitWidget->blockSignals(
true );
1981 mIntervalUnitWidget->blockSignals(
false );
1982 mOffsetUnitWidget->blockSignals(
true );
1985 mOffsetUnitWidget->blockSignals(
false );
1986 mOffsetAlongLineUnitWidget->blockSignals(
true );
1989 mOffsetAlongLineUnitWidget->blockSignals(
false );
2020 mRingFilterComboBox->hide();
2021 mRingsLabel->hide();
2042void QgsMarkerLineSymbolLayerWidget::setRotate()
2044 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2045 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2051void QgsMarkerLineSymbolLayerWidget::setOffset()
2057void QgsMarkerLineSymbolLayerWidget::setPlacement()
2059 const bool interval = mCheckInterval->isChecked();
2060 spinInterval->setEnabled( interval );
2061 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2062 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2063 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2064 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2065 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2067 Qgis::MarkerLinePlacements placements;
2068 if ( mCheckInterval->isChecked() )
2070 if ( mCheckVertex->isChecked() )
2072 if ( mCheckVertexLast->isChecked() )
2074 if ( mCheckVertexFirst->isChecked() )
2076 if ( mCheckCurvePoint->isChecked() )
2078 if ( mCheckSegmentCentralPoint->isChecked() )
2080 if ( mCheckCentralPoint->isChecked() )
2087void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2097void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2107void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2117void QgsMarkerLineSymbolLayerWidget::averageAngleUnitChanged()
2127void QgsMarkerLineSymbolLayerWidget::setAverageAngle(
double val )
2164 connect( mRingFilterComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
2173 spinOffset->setClearValue( 0.0 );
2174 mSpinOffsetAlongLine->setClearValue( 0.0 );
2175 mHashRotationSpinBox->setClearValue( 0 );
2176 mSpinAverageAngleLength->setClearValue( 4.0 );
2178 connect( spinInterval,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setInterval );
2179 connect( mSpinOffsetAlongLine,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffsetAlongLine );
2180 connect( mSpinHashLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashLength );
2181 connect( mHashRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashAngle );
2182 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setRotate );
2183 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffset );
2184 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setAverageAngle );
2186 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2187 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2188 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2189 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2190 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2191 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2192 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2194 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [ = ]
2206 if ( layer->
layerType() != QLatin1String(
"HashLine" ) )
2213 spinInterval->blockSignals(
true );
2214 spinInterval->setValue( mLayer->
interval() );
2215 spinInterval->blockSignals(
false );
2216 mSpinOffsetAlongLine->blockSignals(
true );
2218 mSpinOffsetAlongLine->blockSignals(
false );
2221 chkRotateMarker->blockSignals(
true );
2223 chkRotateMarker->blockSignals(
false );
2224 spinOffset->blockSignals(
true );
2225 spinOffset->setValue( mLayer->
offset() );
2226 spinOffset->blockSignals(
false );
2241 mIntervalUnitWidget->blockSignals(
true );
2242 mIntervalUnitWidget->setUnit( mLayer->
intervalUnit() );
2244 mIntervalUnitWidget->blockSignals(
false );
2245 mOffsetUnitWidget->blockSignals(
true );
2246 mOffsetUnitWidget->setUnit( mLayer->
offsetUnit() );
2248 mOffsetUnitWidget->blockSignals(
false );
2249 mOffsetAlongLineUnitWidget->blockSignals(
true );
2252 mOffsetAlongLineUnitWidget->blockSignals(
false );
2259 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->
ringFilter() ) );
2286 mRingFilterComboBox->hide();
2287 mRingsLabel->hide();
2296void QgsHashedLineSymbolLayerWidget::setInterval(
double val )
2302void QgsHashedLineSymbolLayerWidget::setOffsetAlongLine(
double val )
2308void QgsHashedLineSymbolLayerWidget::setHashLength(
double val )
2314void QgsHashedLineSymbolLayerWidget::setHashAngle(
double val )
2320void QgsHashedLineSymbolLayerWidget::setRotate()
2322 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2323 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2329void QgsHashedLineSymbolLayerWidget::setOffset()
2331 mLayer->
setOffset( spinOffset->value() );
2335void QgsHashedLineSymbolLayerWidget::setPlacement()
2337 const bool interval = mCheckInterval->isChecked();
2338 spinInterval->setEnabled( interval );
2339 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2340 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2341 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2342 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2343 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2345 Qgis::MarkerLinePlacements placements;
2346 if ( mCheckInterval->isChecked() )
2348 if ( mCheckVertex->isChecked() )
2350 if ( mCheckVertexLast->isChecked() )
2352 if ( mCheckVertexFirst->isChecked() )
2354 if ( mCheckCurvePoint->isChecked() )
2356 if ( mCheckSegmentCentralPoint->isChecked() )
2358 if ( mCheckCentralPoint->isChecked() )
2365void QgsHashedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2375void QgsHashedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2385void QgsHashedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2395void QgsHashedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2405void QgsHashedLineSymbolLayerWidget::averageAngleUnitChanged()
2415void QgsHashedLineSymbolLayerWidget::setAverageAngle(
double val )
2434 mSvgSelectorWidget->setAllowParameters(
true );
2435 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2436 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral(
"/UI/lastSVGMarkerDir" ) );
2437 mSvgSelectorWidget->initParametersModel(
this, vl );
2441 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2442 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2446 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2447 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2454 mChangeColorButton->setAllowOpacity(
true );
2455 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2456 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2457 mChangeStrokeColorButton->setAllowOpacity(
true );
2458 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2459 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2461 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2462 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2464 spinOffsetX->setClearValue( 0.0 );
2465 spinOffsetY->setClearValue( 0.0 );
2466 spinAngle->setClearValue( 0.0 );
2468 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2469 connect( spinHeight,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2471 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2472 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2473 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2484 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2485 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2492#include <QAbstractListModel>
2493#include <QPixmapCache>
2507 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2508 QColor defaultFill, defaultStroke;
2509 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2510 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2512 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2513 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2514 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2515 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2516 mChangeColorButton->setEnabled( hasFillParam );
2517 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2518 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2519 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2520 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2525 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2526 if ( hasDefaultFillColor && !skipDefaultColors )
2530 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2531 mChangeColorButton->setColor( fill );
2533 if ( hasStrokeParam )
2536 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2537 if ( hasDefaultStrokeColor && !skipDefaultColors )
2539 stroke = defaultStroke;
2541 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2542 mChangeStrokeColorButton->setColor( stroke );
2545 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2547 mStrokeWidthSpinBox->blockSignals(
true );
2548 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2549 mStrokeWidthSpinBox->blockSignals(
false );
2552 spinHeight->blockSignals(
true );
2553 if ( preservedAspectRatio )
2562 spinHeight->blockSignals(
false );
2563 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2566void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2568 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
2570 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2572 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
2575 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2586 if ( layer->
layerType() != QLatin1String(
"SvgMarker" ) )
2593 mSvgSelectorWidget->setSvgPath(
mLayer->
path() );
2596 spinWidth->blockSignals(
true );
2598 spinWidth->blockSignals(
false );
2599 spinAngle->blockSignals(
true );
2601 spinAngle->blockSignals(
false );
2604 spinOffsetX->blockSignals(
true );
2606 spinOffsetX->blockSignals(
false );
2607 spinOffsetY->blockSignals(
true );
2609 spinOffsetY->blockSignals(
false );
2611 mSizeUnitWidget->blockSignals(
true );
2614 mSizeUnitWidget->blockSignals(
false );
2615 mStrokeWidthUnitWidget->blockSignals(
true );
2618 mStrokeWidthUnitWidget->blockSignals(
false );
2619 mOffsetUnitWidget->blockSignals(
true );
2622 mOffsetUnitWidget->blockSignals(
false );
2625 mHorizontalAnchorComboBox->blockSignals(
true );
2626 mVerticalAnchorComboBox->blockSignals(
true );
2629 mHorizontalAnchorComboBox->blockSignals(
false );
2630 mVerticalAnchorComboBox->blockSignals(
false );
2646 updateAssistantSymbol();
2663 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2672 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2678void QgsSvgMarkerSymbolLayerWidget::setWidth()
2681 double fixedAspectRatio = 0.0;
2682 spinHeight->blockSignals(
true );
2683 if ( defaultAspectRatio <= 0.0 )
2685 spinHeight->setValue( spinWidth->value() );
2687 else if ( mLockAspectRatio->locked() )
2689 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2693 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2695 spinHeight->blockSignals(
false );
2701void QgsSvgMarkerSymbolLayerWidget::setHeight()
2704 double fixedAspectRatio = 0.0;
2705 spinWidth->blockSignals(
true );
2706 if ( defaultAspectRatio <= 0.0 )
2708 spinWidth->setValue( spinHeight->value() );
2710 else if ( mLockAspectRatio->locked() )
2712 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2716 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2718 spinWidth->blockSignals(
false );
2724void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2728 if ( defaultAspectRatio <= 0.0 )
2744void QgsSvgMarkerSymbolLayerWidget::setAngle()
2750void QgsSvgMarkerSymbolLayerWidget::setOffset()
2752 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2756void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2763void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2774void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2785void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2794void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2804void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2814void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2824void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
2833void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
2849 mSvgSelectorWidget->setAllowParameters(
true );
2850 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2852 connect( mTextureWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2854 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2856 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2857 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2865 mRotationSpinBox->setClearValue( 0.0 );
2867 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2868 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2869 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2870 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2872 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2873 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2886 if ( layer->
layerType() != QLatin1String(
"SVGFill" ) )
2895 mTextureWidthSpinBox->blockSignals(
true );
2896 mTextureWidthSpinBox->setValue( width );
2897 mTextureWidthSpinBox->blockSignals(
false );
2899 mRotationSpinBox->blockSignals(
true );
2901 mRotationSpinBox->blockSignals(
false );
2902 mTextureWidthUnitWidget->blockSignals(
true );
2905 mTextureWidthUnitWidget->blockSignals(
false );
2906 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2909 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2910 mChangeColorButton->blockSignals(
true );
2912 mChangeColorButton->blockSignals(
false );
2913 mChangeStrokeColorButton->blockSignals(
true );
2915 mChangeStrokeColorButton->blockSignals(
false );
2916 mStrokeWidthSpinBox->blockSignals(
true );
2918 mStrokeWidthSpinBox->blockSignals(
false );
2942void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2951void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2963void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2966 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2972void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
2975 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2982void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2994 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2995 QColor defaultFill, defaultStroke;
2996 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2997 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2999 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
3000 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
3001 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
3002 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
3005 QColor fill = mChangeColorButton->color();
3006 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
3007 if ( hasDefaultFillColor )
3011 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
3012 mChangeColorButton->setColor( fill );
3014 mChangeColorButton->setEnabled( hasFillParam );
3015 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
3018 QColor stroke = mChangeStrokeColorButton->color();
3019 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
3020 if ( hasDefaultStrokeColor )
3022 stroke = defaultStroke;
3024 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
3025 mChangeStrokeColorButton->setColor( stroke );
3027 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
3028 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
3029 if ( hasDefaultStrokeWidth && resetValues )
3031 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
3033 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
3036void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
3047void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
3058void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3067void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
3077void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3093 connect( mAngleSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3094 connect( mDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3095 connect( mOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3102 mOffsetSpinBox->setClearValue( 0 );
3103 mAngleSpinBox->setClearValue( 0 );
3107 connect( mCoordinateReferenceComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3119 connect( mClipModeComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3132 if ( layer->
layerType() != QLatin1String(
"LinePatternFill" ) )
3146 mDistanceUnitWidget->blockSignals(
true );
3149 mDistanceUnitWidget->blockSignals(
false );
3150 mOffsetUnitWidget->blockSignals(
true );
3153 mOffsetUnitWidget->blockSignals(
false );
3171void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3180void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3189void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3198void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3208void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3224 connect( mHorizontalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3225 connect( mVerticalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3226 connect( mHorizontalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3227 connect( mVerticalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3228 connect( mHorizontalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3229 connect( mVerticalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3230 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3231 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3232 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3233 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3234 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3235 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3253 connect( mClipModeComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3264 connect( mCoordinateReferenceComboBox, qOverload< int >( &QComboBox::currentIndexChanged ),
this, [ = ]
3273 mSeedSpinBox->setShowClearButton(
true );
3274 mSeedSpinBox->setClearValue( 0 );
3275 mRandomXSpinBox->setClearValue( 0 );
3276 mRandomYSpinBox->setClearValue( 0 );
3282 connect( mRandomXSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double d )
3290 connect( mRandomYSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double d )
3316 connect( mSeedSpinBox, qOverload< int > ( &QSpinBox::valueChanged ),
this, [ = ](
int v )
3325 mAngleSpinBox->setShowClearButton(
true );
3326 mAngleSpinBox->setClearValue( 0 );
3327 connect( mAngleSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double d )
3339 if ( !layer || layer->
layerType() != QLatin1String(
"PointPatternFill" ) )
3353 mHorizontalDistanceUnitWidget->blockSignals(
true );
3356 mHorizontalDistanceUnitWidget->blockSignals(
false );
3357 mVerticalDistanceUnitWidget->blockSignals(
true );
3360 mVerticalDistanceUnitWidget->blockSignals(
false );
3361 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3364 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3365 mVerticalDisplacementUnitWidget->blockSignals(
true );
3368 mVerticalDisplacementUnitWidget->blockSignals(
false );
3369 mHorizontalOffsetUnitWidget->blockSignals(
true );
3372 mHorizontalOffsetUnitWidget->blockSignals(
false );
3373 mVerticalOffsetUnitWidget->blockSignals(
true );
3376 mVerticalOffsetUnitWidget->blockSignals(
false );
3408void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3417void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3426void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3435void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3444void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3453void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3462void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3472void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3482void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3492void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3502void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3512void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3533 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3534 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3535 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3545 scrollArea->setVerticalOnly(
true );
3547 btnColor->setAllowOpacity(
true );
3548 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3549 btnColor->setContext( QStringLiteral(
"symbology" ) );
3550 btnStrokeColor->setAllowOpacity(
true );
3551 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3552 btnStrokeColor->setContext( QStringLiteral(
"symbology" ) );
3554 mColorDDBtn->registerLinkedWidget( btnColor );
3555 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3557 spinOffsetX->setClearValue( 0.0 );
3558 spinOffsetY->setClearValue( 0.0 );
3559 spinAngle->setClearValue( 0.0 );
3565 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3568 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3570 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3573 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3575 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3576 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3587 if ( layer->
layerType() != QLatin1String(
"FontMarker" ) )
3596 mFontStyleComboBox->blockSignals(
true );
3597 populateFontStyleComboBox();
3598 mFontStyleComboBox->blockSignals(
false );
3616 mCharPreview->
setFont( mRefFont );
3622 mSizeUnitWidget->blockSignals(
true );
3625 mSizeUnitWidget->blockSignals(
false );
3627 mStrokeWidthUnitWidget->blockSignals(
true );
3630 mStrokeWidthUnitWidget->blockSignals(
false );
3632 mOffsetUnitWidget->blockSignals(
true );
3635 mOffsetUnitWidget->blockSignals(
false );
3656 updateAssistantSymbol();
3669 mRefFont.setFamily( font.family() );
3671 mCharPreview->setFont( mRefFont );
3672 populateFontStyleComboBox();
3677void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3684 mCharPreview->setFont( mRefFont );
3716 mCharPreview->setText( text );
3718 if ( text.isEmpty() )
3722 QString character = text;
3723 if ( text.contains( QRegularExpression( QStringLiteral(
"^0x[0-9a-fA-F]{1,4}$" ) ) ) )
3726 const unsigned int value = text.toUInt( &ok, 0 );
3729 character = QChar( value );
3730 mCharPreview->setText( character );
3751 if (
mLayer->
character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3753 mCharLineEdit->insert( chr );
3759 mCharPreview->setText( chr );
3763void QgsFontMarkerSymbolLayerWidget::setOffset()
3765 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3769void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3775void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3785void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3795void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3805void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3807 mFontStyleComboBox->clear();
3808 const QStringList styles = mFontDB.styles( mRefFont.family() );
3809 const auto constStyles = styles;
3810 for (
const QString &style : constStyles )
3812 mFontStyleComboBox->addItem( style );
3815 QString targetStyle = mFontDB.styleString( mRefFont );
3816 if ( !styles.contains( targetStyle ) )
3818 const QFont f = QFont( mRefFont.family() );
3819 targetStyle = QFontInfo( f ).styleName();
3820 mRefFont.setStyleName( targetStyle );
3823 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
3824 if ( stylIndx > -1 )
3829 mFontStyleComboBox->setCurrentIndex( curIndx );
3832void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3835 setFontStyle( mFontStyleComboBox->currentText() );
3838void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3847void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3856void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3865void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3867 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
3869 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3871 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
3874 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3886 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3887 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3888 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3889 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3894 if ( layer->
layerType() != QLatin1String(
"CentroidFill" ) )
3912void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3918void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3924void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
3930void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
3945 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3949 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3951 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3952 connect( mHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3960 mSpinOffsetX->setClearValue( 0.0 );
3961 mSpinOffsetY->setClearValue( 0.0 );
3962 mRotationSpinBox->setClearValue( 0.0 );
3964 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3965 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3968 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3969 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3979 if ( layer->
layerType() != QLatin1String(
"RasterMarker" ) )
3990 mHeightSpinBox->blockSignals(
true );
3991 if ( preservedAspectRatio )
4000 mHeightSpinBox->blockSignals(
false );
4001 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4009 mSizeUnitWidget->blockSignals(
true );
4012 mSizeUnitWidget->blockSignals(
false );
4013 mOffsetUnitWidget->blockSignals(
true );
4016 mOffsetUnitWidget->blockSignals(
false );
4031 updatePreviewImage();
4045void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4048 updatePreviewImage();
4052void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
4054 bool fitsInCache =
false;
4056 if ( image.isNull() )
4058 mLabelImagePreview->setPixmap( QPixmap() );
4062 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4063 previewImage.fill( Qt::transparent );
4064 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4066 p.begin( &previewImage );
4068 uchar pixDataRGB[] = { 150, 150, 150, 150,
4073 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4074 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4075 QBrush checkerBrush;
4076 checkerBrush.setTexture( pix );
4077 p.fillRect( imageRect, checkerBrush );
4084 p.drawImage( imageRect.left(), imageRect.top(), image );
4086 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4089void QgsRasterMarkerSymbolLayerWidget::setWidth()
4092 double fixedAspectRatio = 0.0;
4093 mHeightSpinBox->blockSignals(
true );
4094 if ( defaultAspectRatio <= 0.0 )
4096 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4098 else if ( mLockAspectRatio->locked() )
4100 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4104 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4106 mHeightSpinBox->blockSignals(
false );
4112void QgsRasterMarkerSymbolLayerWidget::setHeight()
4115 double fixedAspectRatio = 0.0;
4116 mWidthSpinBox->blockSignals(
true );
4117 if ( defaultAspectRatio <= 0.0 )
4119 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4121 else if ( mLockAspectRatio->locked() )
4123 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4127 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4129 mWidthSpinBox->blockSignals(
false );
4135void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4138 if ( defaultAspectRatio <= 0.0 )
4153void QgsRasterMarkerSymbolLayerWidget::setAngle()
4159void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4163 updatePreviewImage();
4166void QgsRasterMarkerSymbolLayerWidget::setOffset()
4168 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4172void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4182void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4192void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
4201void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
4220 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastAnimatedMarkerImageDir" ) );
4224 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4226 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4227 connect( mHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4230 mFrameRateSpin->setClearValue( 10 );
4231 mFrameRateSpin->setShowClearButton(
true );
4232 connect( mFrameRateSpin, qOverload< double >( &QDoubleSpinBox::valueChanged ),
this, [ = ](
double value )
4243 mSpinOffsetX->setClearValue( 0.0 );
4244 mSpinOffsetY->setClearValue( 0.0 );
4245 mRotationSpinBox->setClearValue( 0.0 );
4247 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4248 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4251 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4252 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4262 if ( layer->
layerType() != QLatin1String(
"AnimatedMarker" ) )
4272 if ( firstFrameTime > 0 )
4274 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4278 mFrameRateSpin->setClearValue( 10 );
4283 mHeightSpinBox->blockSignals(
true );
4284 if ( preservedAspectRatio )
4293 mHeightSpinBox->blockSignals(
false );
4294 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4304 mSizeUnitWidget->blockSignals(
true );
4307 mSizeUnitWidget->blockSignals(
false );
4308 mOffsetUnitWidget->blockSignals(
true );
4311 mOffsetUnitWidget->blockSignals(
false );
4326 updatePreviewImage();
4340void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4345 if ( firstFrameTime > 0 )
4347 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4351 mFrameRateSpin->setClearValue( 10 );
4353 updatePreviewImage();
4357void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4359 if ( mPreviewMovie )
4361 mLabelImagePreview->setMovie(
nullptr );
4362 mPreviewMovie->deleteLater();
4363 mPreviewMovie =
nullptr;
4366 mPreviewMovie =
new QMovie(
mLayer->
path(), QByteArray(),
this );
4367 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4368 mLabelImagePreview->setMovie( mPreviewMovie );
4369 mPreviewMovie->start();
4372void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4375 double fixedAspectRatio = 0.0;
4376 mHeightSpinBox->blockSignals(
true );
4377 if ( defaultAspectRatio <= 0.0 )
4379 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4381 else if ( mLockAspectRatio->locked() )
4383 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4387 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4389 mHeightSpinBox->blockSignals(
false );
4395void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4398 double fixedAspectRatio = 0.0;
4399 mWidthSpinBox->blockSignals(
true );
4400 if ( defaultAspectRatio <= 0.0 )
4402 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4404 else if ( mLockAspectRatio->locked() )
4406 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4410 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4412 mWidthSpinBox->blockSignals(
false );
4418void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4421 if ( defaultAspectRatio <= 0.0 )
4436void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4442void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4446 updatePreviewImage();
4449void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4451 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4455void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4465void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4475void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
4484void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
4501 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
4505 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4507 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged );
4514 mSpinOffsetX->setClearValue( 0.0 );
4515 mSpinOffsetY->setClearValue( 0.0 );
4516 mRotationSpinBox->setClearValue( 0.0 );
4518 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4519 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4520 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4532 if ( layer->
layerType() != QLatin1String(
"RasterFill" ) )
4545 cboCoordinateMode->blockSignals(
true );
4549 cboCoordinateMode->setCurrentIndex( 1 );
4553 cboCoordinateMode->setCurrentIndex( 0 );
4556 cboCoordinateMode->blockSignals(
false );
4562 mOffsetUnitWidget->blockSignals(
true );
4565 mOffsetUnitWidget->blockSignals(
false );
4568 mWidthUnitWidget->blockSignals(
true );
4571 mWidthUnitWidget->blockSignals(
false );
4573 updatePreviewImage();
4587void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4590 updatePreviewImage();
4594void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4611void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4620 updatePreviewImage();
4623void QgsRasterFillSymbolLayerWidget::offsetChanged()
4625 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4629void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4640void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4649void QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed()
4660void QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged(
double d )
4670void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4672 bool fitsInCache =
false;
4674 if ( image.isNull() )
4676 mLabelImagePreview->setPixmap( QPixmap() );
4680 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4681 previewImage.fill( Qt::transparent );
4682 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4684 p.begin( &previewImage );
4686 uchar pixDataRGB[] = { 150, 150, 150, 150,