18#include "moc_qgssymbollayerwidget.cpp"
49#include <QAbstractButton>
50#include <QButtonGroup>
51#include <QColorDialog>
56#include <QStandardItemModel>
57#include <QSvgRenderer>
61#include <QInputDialog>
63#include <QRegularExpression>
69 return *lExpressionContext;
80 expContext << symbolScope;
102 QStringList highlights;
108 << QStringLiteral(
"symbol_layer_count" ) << QStringLiteral(
"symbol_layer_index" ) << QStringLiteral(
"symbol_frame" );
111 if ( expContext.
hasVariable( QStringLiteral(
"zoom_level" ) ) )
113 highlights << QStringLiteral(
"zoom_level" );
115 if ( expContext.
hasVariable( QStringLiteral(
"vector_tile_zoom" ) ) )
117 highlights << QStringLiteral(
"vector_tile_zoom" );
128 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
131 unitWidget->setMapCanvas( mContext.
mapCanvas() );
149void QgsSymbolLayerWidget::createAuxiliaryField()
170 if ( dlg.exec() == QDialog::Accepted )
171 def = dlg.propertyDefinition();
181 property.setActive(
true );
203 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
204 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
208 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
210 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [=] {
211 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
212 if ( !mCheckAlignDash->isChecked() )
213 mCheckDashCorners->setChecked(
false );
221 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [=] {
236 btnChangeColor->setAllowOpacity(
true );
237 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
238 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
240 mColorDDBtn->registerLinkedWidget( btnChangeColor );
245 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [=](
int ) {
253 spinOffset->setClearValue( 0.0 );
254 spinPatternOffset->setClearValue( 0.0 );
256 mTrimStartDistanceSpin->setClearValue( 0.0 );
257 mTrimDistanceEndSpin->setClearValue( 0.0 );
263 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
265 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
267 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
268 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
269 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
270 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
271 connect( spinPatternOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
273 connect( mTrimStartDistanceSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
288 connect( mTrimDistanceEndSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
312void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
314 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
316 mAssistantPreviewSymbol->deleteSymbolLayer( i );
318 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
321 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
327 if ( !layer || layer->
layerType() != QLatin1String(
"SimpleLine" ) )
334 mPenWidthUnitWidget->blockSignals(
true );
337 mPenWidthUnitWidget->blockSignals(
false );
338 mOffsetUnitWidget->blockSignals(
true );
341 mOffsetUnitWidget->blockSignals(
false );
342 mDashPatternUnitWidget->blockSignals(
true );
345 mDashPatternUnitWidget->blockSignals(
false );
355 spinWidth->blockSignals(
true );
357 spinWidth->blockSignals(
false );
358 btnChangeColor->blockSignals(
true );
360 btnChangeColor->blockSignals(
false );
361 spinOffset->blockSignals(
true );
363 spinOffset->blockSignals(
false );
364 cboPenStyle->blockSignals(
true );
365 cboJoinStyle->blockSignals(
true );
366 cboCapStyle->blockSignals(
true );
370 cboPenStyle->blockSignals(
false );
371 cboJoinStyle->blockSignals(
false );
372 cboCapStyle->blockSignals(
false );
379 mChangePatternButton->setEnabled( useCustomDashPattern );
380 label_3->setEnabled( !useCustomDashPattern );
381 cboPenStyle->setEnabled( !useCustomDashPattern );
382 mCustomCheckBox->blockSignals(
true );
383 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
384 mCustomCheckBox->blockSignals(
false );
387 const QSize size = mChangePatternButton->minimumSizeHint();
389 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
393 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
414 updateAssistantSymbol();
431 mDrawInsideCheckBox->hide();
432 mRingFilterComboBox->hide();
442void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
449void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
455void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
464void QgsSimpleLineSymbolLayerWidget::offsetChanged()
471void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
478void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
480 const bool checked = ( state == Qt::Checked );
481 mChangePatternButton->setEnabled( checked );
482 label_3->setEnabled( !checked );
483 cboPenStyle->setEnabled( !checked );
489void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
496 widget->
setUnit( mDashPatternUnitWidget->unit() );
507 d.setUnit( mDashPatternUnitWidget->unit() );
508 if ( d.exec() == QDialog::Accepted )
516void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
527void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
537void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
548void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
550 const bool checked = ( state == Qt::Checked );
555void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
572 std::unique_ptr<QgsSimpleLineSymbolLayer> layerCopy(
mLayer->
clone() );
577 const QColor color = qApp->palette().color( QPalette::WindowText );
578 layerCopy->setColor( color );
580 layerCopy->setOffset( 0 );
581 layerCopy->setUseCustomDashPattern(
true );
583 QSize currentIconSize;
586 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
588 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
591 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
597 const std::unique_ptr<QgsLineSymbol> previewSymbol = std::make_unique<QgsLineSymbol>(
QgsSymbolLayerList() << layerCopy.release() );
599 mChangePatternButton->setIconSize( currentIconSize );
600 mChangePatternButton->setIcon( icon );
604 const int width =
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
605 const int height =
static_cast<int>( width / 1.61803398875 );
609 QBuffer buffer( &data );
610 pm.save( &buffer,
"PNG", 100 );
611 mChangePatternButton->setToolTip( QStringLiteral(
"<img src='data:image/png;base64, %3' width=\"%4\">" ).arg( QString( data.toBase64() ) ).arg( width ) );
616 QgsSymbolLayerWidget::resizeEvent( event );
634 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
635 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
636 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
637 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
642 btnChangeColorFill->setAllowOpacity(
true );
643 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
644 btnChangeColorFill->setContext( QStringLiteral(
"symbology" ) );
645 btnChangeColorFill->setShowNoColor(
true );
646 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
647 btnChangeColorStroke->setAllowOpacity(
true );
648 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
649 btnChangeColorStroke->setContext( QStringLiteral(
"symbology" ) );
650 btnChangeColorStroke->setShowNoColor(
true );
651 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
653 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
654 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
656 spinOffsetX->setClearValue( 0.0 );
657 spinOffsetY->setClearValue( 0.0 );
658 spinAngle->setClearValue( 0.0 );
664 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
666 int size = lstNames->iconSize().width();
668 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
670 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
671 lstNames->setIconSize( QSize( size, size ) );
673 const double markerSize = size * 0.8;
679 lyr->
setColor( QColor( 200, 200, 200 ) );
682 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
683 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
688 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
690 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
693 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
694 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged );
695 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
696 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
697 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
698 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
706 if ( layer->
layerType() != QLatin1String(
"SimpleMarker" ) )
714 for (
int i = 0; i < lstNames->count(); ++i )
716 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
718 lstNames->setCurrentRow( i );
722 btnChangeColorStroke->blockSignals(
true );
724 btnChangeColorStroke->blockSignals(
false );
725 btnChangeColorFill->blockSignals(
true );
728 btnChangeColorFill->blockSignals(
false );
729 spinSize->blockSignals(
true );
731 spinSize->blockSignals(
false );
732 spinAngle->blockSignals(
true );
734 spinAngle->blockSignals(
false );
735 mStrokeStyleComboBox->blockSignals(
true );
737 mStrokeStyleComboBox->blockSignals(
false );
738 mStrokeWidthSpinBox->blockSignals(
true );
740 mStrokeWidthSpinBox->blockSignals(
false );
741 cboJoinStyle->blockSignals(
true );
743 cboJoinStyle->blockSignals(
false );
744 cboCapStyle->blockSignals(
true );
746 cboCapStyle->blockSignals(
false );
749 spinOffsetX->blockSignals(
true );
751 spinOffsetX->blockSignals(
false );
752 spinOffsetY->blockSignals(
true );
754 spinOffsetY->blockSignals(
false );
756 mSizeUnitWidget->blockSignals(
true );
759 mSizeUnitWidget->blockSignals(
false );
760 mOffsetUnitWidget->blockSignals(
true );
763 mOffsetUnitWidget->blockSignals(
false );
764 mStrokeWidthUnitWidget->blockSignals(
true );
767 mStrokeWidthUnitWidget->blockSignals(
false );
770 mHorizontalAnchorComboBox->blockSignals(
true );
771 mVerticalAnchorComboBox->blockSignals(
true );
774 mHorizontalAnchorComboBox->blockSignals(
false );
775 mVerticalAnchorComboBox->blockSignals(
false );
790 updateAssistantSymbol();
798void QgsSimpleMarkerSymbolLayerWidget::setShape()
817void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
823void QgsSimpleMarkerSymbolLayerWidget::penCapStyleChanged()
829void QgsSimpleMarkerSymbolLayerWidget::setSize()
835void QgsSimpleMarkerSymbolLayerWidget::setAngle()
841void QgsSimpleMarkerSymbolLayerWidget::setOffset()
843 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
847void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
858void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
867void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
877void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
887void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
897void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
906void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
915void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
917 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
919 mAssistantPreviewSymbol->deleteSymbolLayer( i );
921 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
924 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
941 btnChangeColor->setAllowOpacity(
true );
942 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
943 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
944 btnChangeColor->setShowNoColor(
true );
945 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
946 btnChangeStrokeColor->setAllowOpacity(
true );
947 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
948 btnChangeStrokeColor->setContext( QStringLiteral(
"symbology" ) );
949 btnChangeStrokeColor->setShowNoColor(
true );
950 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
952 spinOffsetX->setClearValue( 0.0 );
953 spinOffsetY->setClearValue( 0.0 );
956 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
958 connect( spinStrokeWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
959 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
960 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
961 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
962 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
964 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
965 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
970 if ( layer->
layerType() != QLatin1String(
"SimpleFill" ) )
977 btnChangeColor->blockSignals(
true );
979 btnChangeColor->blockSignals(
false );
980 cboFillStyle->blockSignals(
true );
982 cboFillStyle->blockSignals(
false );
983 btnChangeStrokeColor->blockSignals(
true );
985 btnChangeStrokeColor->blockSignals(
false );
986 cboStrokeStyle->blockSignals(
true );
988 cboStrokeStyle->blockSignals(
false );
989 spinStrokeWidth->blockSignals(
true );
991 spinStrokeWidth->blockSignals(
false );
992 cboJoinStyle->blockSignals(
true );
994 cboJoinStyle->blockSignals(
false );
995 spinOffsetX->blockSignals(
true );
997 spinOffsetX->blockSignals(
false );
998 spinOffsetY->blockSignals(
true );
1000 spinOffsetY->blockSignals(
false );
1002 mStrokeWidthUnitWidget->blockSignals(
true );
1005 mStrokeWidthUnitWidget->blockSignals(
false );
1006 mOffsetUnitWidget->blockSignals(
true );
1009 mOffsetUnitWidget->blockSignals(
false );
1037void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
1043void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1049void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1056void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1058 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1062void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1072void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1092 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1093 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1097 spinOffsetX->setClearValue( 0.0 );
1098 spinOffsetY->setClearValue( 0.0 );
1099 spinAngle->setClearValue( 0.0 );
1105 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1107 int size = lstNames->iconSize().width();
1108 size = std::max( 30,
static_cast<int>( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1109 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1110 lstNames->setIconSize( QSize( size, size ) );
1112 const double markerSize = size * 0.8;
1118 lyr->
setColor( QColor( 200, 200, 200 ) );
1121 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1122 item->setData( Qt::UserRole,
static_cast<int>( shape ) );
1127 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1129 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1130 connect( spinSize,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1131 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1132 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1133 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1141 if ( layer->
layerType() != QLatin1String(
"FilledMarker" ) )
1149 for (
int i = 0; i < lstNames->count(); ++i )
1151 if (
static_cast<Qgis::MarkerShape>( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
1153 lstNames->setCurrentRow( i );
1162 mSizeUnitWidget->blockSignals(
true );
1165 mSizeUnitWidget->blockSignals(
false );
1166 mOffsetUnitWidget->blockSignals(
true );
1169 mOffsetUnitWidget->blockSignals(
false );
1182 updateAssistantSymbol();
1190void QgsFilledMarkerSymbolLayerWidget::setShape()
1196void QgsFilledMarkerSymbolLayerWidget::setSize()
1202void QgsFilledMarkerSymbolLayerWidget::setAngle()
1208void QgsFilledMarkerSymbolLayerWidget::setOffset()
1210 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1214void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1224void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1234void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
1243void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
1252void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1254 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
1256 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1258 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1261 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1274 connect( mSpinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1277 btnColorRamp->setShowGradientOnly(
true );
1279 btnChangeColor->setAllowOpacity(
true );
1280 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1281 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1282 btnChangeColor->setShowNoColor(
true );
1283 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1284 btnChangeColor2->setAllowOpacity(
true );
1285 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1286 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1287 btnChangeColor2->setShowNoColor(
true );
1288 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1290 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1291 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1293 spinOffsetX->setClearValue( 0.0 );
1294 spinOffsetY->setClearValue( 0.0 );
1295 mSpinAngle->setClearValue( 0.0 );
1303 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1304 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1305 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1306 connect( spinRefPoint1X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1307 connect( spinRefPoint1Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1308 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1309 connect( spinRefPoint2X,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1310 connect( spinRefPoint2Y,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1311 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1316 if ( layer->
layerType() != QLatin1String(
"GradientFill" ) )
1323 btnChangeColor->blockSignals(
true );
1325 btnChangeColor->blockSignals(
false );
1326 btnChangeColor2->blockSignals(
true );
1328 btnChangeColor2->blockSignals(
false );
1332 radioTwoColor->setChecked(
true );
1333 btnColorRamp->setEnabled(
false );
1337 radioColorRamp->setChecked(
true );
1338 btnChangeColor->setEnabled(
false );
1339 btnChangeColor2->setEnabled(
false );
1345 btnColorRamp->blockSignals(
true );
1347 btnColorRamp->blockSignals(
false );
1350 cboGradientType->blockSignals(
true );
1354 cboGradientType->setCurrentIndex( 0 );
1357 cboGradientType->setCurrentIndex( 1 );
1360 cboGradientType->setCurrentIndex( 2 );
1363 cboGradientType->blockSignals(
false );
1365 cboCoordinateMode->blockSignals(
true );
1369 cboCoordinateMode->setCurrentIndex( 1 );
1370 checkRefPoint1Centroid->setEnabled(
false );
1371 checkRefPoint2Centroid->setEnabled(
false );
1375 cboCoordinateMode->setCurrentIndex( 0 );
1378 cboCoordinateMode->blockSignals(
false );
1380 cboGradientSpread->blockSignals(
true );
1384 cboGradientSpread->setCurrentIndex( 0 );
1387 cboGradientSpread->setCurrentIndex( 1 );
1390 cboGradientSpread->setCurrentIndex( 2 );
1393 cboGradientSpread->blockSignals(
false );
1395 spinRefPoint1X->blockSignals(
true );
1397 spinRefPoint1X->blockSignals(
false );
1398 spinRefPoint1Y->blockSignals(
true );
1400 spinRefPoint1Y->blockSignals(
false );
1401 checkRefPoint1Centroid->blockSignals(
true );
1405 spinRefPoint1X->setEnabled(
false );
1406 spinRefPoint1Y->setEnabled(
false );
1408 checkRefPoint1Centroid->blockSignals(
false );
1409 spinRefPoint2X->blockSignals(
true );
1411 spinRefPoint2X->blockSignals(
false );
1412 spinRefPoint2Y->blockSignals(
true );
1414 spinRefPoint2Y->blockSignals(
false );
1415 checkRefPoint2Centroid->blockSignals(
true );
1419 spinRefPoint2X->setEnabled(
false );
1420 spinRefPoint2Y->setEnabled(
false );
1422 checkRefPoint2Centroid->blockSignals(
false );
1424 spinOffsetX->blockSignals(
true );
1426 spinOffsetX->blockSignals(
false );
1427 spinOffsetY->blockSignals(
true );
1429 spinOffsetY->blockSignals(
false );
1430 mSpinAngle->blockSignals(
true );
1432 mSpinAngle->blockSignals(
false );
1434 mOffsetUnitWidget->blockSignals(
true );
1437 mOffsetUnitWidget->blockSignals(
false );
1471void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1473 if ( radioTwoColor->isChecked() )
1486 if ( btnColorRamp->isNull() )
1500 spinRefPoint1X->setValue( 0.5 );
1501 spinRefPoint1Y->setValue( 0 );
1502 spinRefPoint2X->setValue( 0.5 );
1503 spinRefPoint2Y->setValue( 1 );
1508 spinRefPoint1X->setValue( 0 );
1509 spinRefPoint1Y->setValue( 0 );
1510 spinRefPoint2X->setValue( 1 );
1511 spinRefPoint2Y->setValue( 1 );
1515 spinRefPoint1X->setValue( 0.5 );
1516 spinRefPoint1Y->setValue( 0.5 );
1517 spinRefPoint2X->setValue( 1 );
1518 spinRefPoint2Y->setValue( 1 );
1532 checkRefPoint1Centroid->setEnabled(
true );
1533 checkRefPoint2Centroid->setEnabled(
true );
1539 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1540 checkRefPoint1Centroid->setEnabled(
false );
1541 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1542 checkRefPoint2Centroid->setEnabled(
false );
1567void QgsGradientFillSymbolLayerWidget::offsetChanged()
1569 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1573void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1582void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1588void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1606 connect( mSpinBlurRadius, qOverload<int>( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1607 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1609 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1611 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1615 QButtonGroup *group1 =
new QButtonGroup(
this );
1616 group1->addButton( radioColorRamp );
1617 group1->addButton( radioTwoColor );
1618 QButtonGroup *group2 =
new QButtonGroup(
this );
1619 group2->addButton( mRadioUseMaxDistance );
1620 group2->addButton( mRadioUseWholeShape );
1621 btnChangeColor->setAllowOpacity(
true );
1622 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1623 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1624 btnChangeColor->setShowNoColor(
true );
1625 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1626 btnChangeColor2->setAllowOpacity(
true );
1627 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1628 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1629 btnChangeColor2->setShowNoColor(
true );
1630 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1632 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1633 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1635 spinOffsetX->setClearValue( 0.0 );
1636 spinOffsetY->setClearValue( 0.0 );
1637 mSpinMaxDistance->setClearValue( 5.0 );
1639 btnColorRamp->setShowGradientOnly(
true );
1645 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1646 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1647 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1649 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1650 connect( mSpinBlurRadius,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1655 if ( layer->
layerType() != QLatin1String(
"ShapeburstFill" ) )
1662 btnChangeColor->blockSignals(
true );
1664 btnChangeColor->blockSignals(
false );
1665 btnChangeColor2->blockSignals(
true );
1667 btnChangeColor2->blockSignals(
false );
1671 radioTwoColor->setChecked(
true );
1672 btnColorRamp->setEnabled(
false );
1676 radioColorRamp->setChecked(
true );
1677 btnChangeColor->setEnabled(
false );
1678 btnChangeColor2->setEnabled(
false );
1681 mSpinBlurRadius->blockSignals(
true );
1682 mBlurSlider->blockSignals(
true );
1685 mSpinBlurRadius->blockSignals(
false );
1686 mBlurSlider->blockSignals(
false );
1688 mSpinMaxDistance->blockSignals(
true );
1690 mSpinMaxDistance->blockSignals(
false );
1692 mRadioUseWholeShape->blockSignals(
true );
1693 mRadioUseMaxDistance->blockSignals(
true );
1696 mRadioUseWholeShape->setChecked(
true );
1697 mSpinMaxDistance->setEnabled(
false );
1698 mDistanceUnitWidget->setEnabled(
false );
1702 mRadioUseMaxDistance->setChecked(
true );
1703 mSpinMaxDistance->setEnabled(
true );
1704 mDistanceUnitWidget->setEnabled(
true );
1706 mRadioUseWholeShape->blockSignals(
false );
1707 mRadioUseMaxDistance->blockSignals(
false );
1709 mDistanceUnitWidget->blockSignals(
true );
1712 mDistanceUnitWidget->blockSignals(
false );
1714 mIgnoreRingsCheckBox->blockSignals(
true );
1715 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1716 mIgnoreRingsCheckBox->blockSignals(
false );
1721 btnColorRamp->blockSignals(
true );
1723 btnColorRamp->blockSignals(
false );
1726 spinOffsetX->blockSignals(
true );
1728 spinOffsetX->blockSignals(
false );
1729 spinOffsetY->blockSignals(
true );
1731 spinOffsetY->blockSignals(
false );
1732 mOffsetUnitWidget->blockSignals(
true );
1735 mOffsetUnitWidget->blockSignals(
false );
1769void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1776 if ( radioTwoColor->isChecked() )
1787void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1796void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1805void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1815void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1820 mDistanceUnitWidget->setEnabled( !value );
1825void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1835void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1839 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1844void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1855void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1857 const bool checked = ( state == Qt::Checked );
1882 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [=](
int ) {
1890 spinOffset->setClearValue( 0.0 );
1891 mSpinOffsetAlongLine->setClearValue( 0.0 );
1892 mSpinAverageAngleLength->setClearValue( 4.0 );
1896 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1897 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1898 connect( mSpinAverageAngleLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setAverageAngle );
1899 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1900 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1901 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1902 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1903 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1904 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1905 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1906 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [=] {
1917 if ( layer->
layerType() != QLatin1String(
"MarkerLine" ) )
1924 spinInterval->blockSignals(
true );
1926 spinInterval->blockSignals(
false );
1927 mSpinOffsetAlongLine->blockSignals(
true );
1929 mSpinOffsetAlongLine->blockSignals(
false );
1930 chkRotateMarker->blockSignals(
true );
1932 chkRotateMarker->blockSignals(
false );
1933 spinOffset->blockSignals(
true );
1935 spinOffset->blockSignals(
false );
1947 mIntervalUnitWidget->blockSignals(
true );
1950 mIntervalUnitWidget->blockSignals(
false );
1951 mOffsetUnitWidget->blockSignals(
true );
1954 mOffsetUnitWidget->blockSignals(
false );
1955 mOffsetAlongLineUnitWidget->blockSignals(
true );
1958 mOffsetAlongLineUnitWidget->blockSignals(
false );
1989 mRingFilterComboBox->hide();
1990 mRingsLabel->hide();
2011void QgsMarkerLineSymbolLayerWidget::setRotate()
2013 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2014 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2020void QgsMarkerLineSymbolLayerWidget::setOffset()
2026void QgsMarkerLineSymbolLayerWidget::setPlacement()
2028 const bool interval = mCheckInterval->isChecked();
2029 spinInterval->setEnabled( interval );
2030 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2031 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2032 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2033 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2034 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2037 if ( mCheckInterval->isChecked() )
2039 if ( mCheckVertex->isChecked() )
2041 if ( mCheckVertexLast->isChecked() )
2043 if ( mCheckVertexFirst->isChecked() )
2045 if ( mCheckCurvePoint->isChecked() )
2047 if ( mCheckSegmentCentralPoint->isChecked() )
2049 if ( mCheckCentralPoint->isChecked() )
2056void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2066void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2076void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2086void QgsMarkerLineSymbolLayerWidget::averageAngleUnitChanged()
2096void QgsMarkerLineSymbolLayerWidget::setAverageAngle(
double val )
2128 connect( mRingFilterComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [=](
int ) {
2136 spinOffset->setClearValue( 0.0 );
2137 mSpinOffsetAlongLine->setClearValue( 0.0 );
2138 mHashRotationSpinBox->setClearValue( 0 );
2139 mSpinAverageAngleLength->setClearValue( 4.0 );
2141 connect( spinInterval,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setInterval );
2142 connect( mSpinOffsetAlongLine,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffsetAlongLine );
2143 connect( mSpinHashLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashLength );
2144 connect( mHashRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashAngle );
2145 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setRotate );
2146 connect( spinOffset,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffset );
2147 connect( mSpinAverageAngleLength,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setAverageAngle );
2149 connect( mCheckInterval, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2150 connect( mCheckVertex, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2151 connect( mCheckVertexLast, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2152 connect( mCheckVertexFirst, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2153 connect( mCheckCentralPoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2154 connect( mCheckCurvePoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2155 connect( mCheckSegmentCentralPoint, &QCheckBox::toggled,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2157 connect( mCheckPlaceOnEveryPart, &QCheckBox::toggled,
this, [=] {
2168 if ( layer->
layerType() != QLatin1String(
"HashLine" ) )
2175 spinInterval->blockSignals(
true );
2176 spinInterval->setValue( mLayer->
interval() );
2177 spinInterval->blockSignals(
false );
2178 mSpinOffsetAlongLine->blockSignals(
true );
2180 mSpinOffsetAlongLine->blockSignals(
false );
2183 chkRotateMarker->blockSignals(
true );
2185 chkRotateMarker->blockSignals(
false );
2186 spinOffset->blockSignals(
true );
2187 spinOffset->setValue( mLayer->
offset() );
2188 spinOffset->blockSignals(
false );
2200 mIntervalUnitWidget->blockSignals(
true );
2201 mIntervalUnitWidget->setUnit( mLayer->
intervalUnit() );
2203 mIntervalUnitWidget->blockSignals(
false );
2204 mOffsetUnitWidget->blockSignals(
true );
2205 mOffsetUnitWidget->setUnit( mLayer->
offsetUnit() );
2207 mOffsetUnitWidget->blockSignals(
false );
2208 mOffsetAlongLineUnitWidget->blockSignals(
true );
2211 mOffsetAlongLineUnitWidget->blockSignals(
false );
2218 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->
ringFilter() ) );
2245 mRingFilterComboBox->hide();
2246 mRingsLabel->hide();
2255void QgsHashedLineSymbolLayerWidget::setInterval(
double val )
2261void QgsHashedLineSymbolLayerWidget::setOffsetAlongLine(
double val )
2267void QgsHashedLineSymbolLayerWidget::setHashLength(
double val )
2273void QgsHashedLineSymbolLayerWidget::setHashAngle(
double val )
2279void QgsHashedLineSymbolLayerWidget::setRotate()
2281 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2282 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2288void QgsHashedLineSymbolLayerWidget::setOffset()
2290 mLayer->
setOffset( spinOffset->value() );
2294void QgsHashedLineSymbolLayerWidget::setPlacement()
2296 const bool interval = mCheckInterval->isChecked();
2297 spinInterval->setEnabled( interval );
2298 mSpinOffsetAlongLine->setEnabled( mCheckInterval->isChecked() || mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2299 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2300 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( mCheckInterval->isChecked() || mCheckCentralPoint->isChecked() ) );
2301 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2302 mCheckPlaceOnEveryPart->setEnabled( mCheckVertexLast->isChecked() || mCheckVertexFirst->isChecked() );
2305 if ( mCheckInterval->isChecked() )
2307 if ( mCheckVertex->isChecked() )
2309 if ( mCheckVertexLast->isChecked() )
2311 if ( mCheckVertexFirst->isChecked() )
2313 if ( mCheckCurvePoint->isChecked() )
2315 if ( mCheckSegmentCentralPoint->isChecked() )
2317 if ( mCheckCentralPoint->isChecked() )
2324void QgsHashedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2334void QgsHashedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2344void QgsHashedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2354void QgsHashedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2364void QgsHashedLineSymbolLayerWidget::averageAngleUnitChanged()
2374void QgsHashedLineSymbolLayerWidget::setAverageAngle(
double val )
2393 mSvgSelectorWidget->setAllowParameters(
true );
2394 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2395 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral(
"/UI/lastSVGMarkerDir" ) );
2396 mSvgSelectorWidget->initParametersModel(
this, vl );
2400 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2401 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2405 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2406 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2410 mChangeColorButton->setAllowOpacity(
true );
2411 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2412 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2413 mChangeStrokeColorButton->setAllowOpacity(
true );
2414 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2415 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2417 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2418 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2420 spinOffsetX->setClearValue( 0.0 );
2421 spinOffsetY->setClearValue( 0.0 );
2422 spinAngle->setClearValue( 0.0 );
2424 connect( spinWidth,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2425 connect( spinHeight,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2427 connect( spinAngle,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2428 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2429 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2440 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2441 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2448#include <QAbstractListModel>
2449#include <QPixmapCache>
2461 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2462 QColor defaultFill, defaultStroke;
2463 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2464 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2465 QgsApplication::svgCache()->
containsParams( layer->
path(), hasFillParam, hasDefaultFillColor, defaultFill, hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity, hasStrokeParam, hasDefaultStrokeColor, defaultStroke, hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth, hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2466 mChangeColorButton->setEnabled( hasFillParam );
2467 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2468 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2469 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2470 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2475 const double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2476 if ( hasDefaultFillColor && !skipDefaultColors )
2480 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2481 mChangeColorButton->setColor( fill );
2483 if ( hasStrokeParam )
2486 const double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2487 if ( hasDefaultStrokeColor && !skipDefaultColors )
2489 stroke = defaultStroke;
2491 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2492 mChangeStrokeColorButton->setColor( stroke );
2495 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2497 mStrokeWidthSpinBox->blockSignals(
true );
2498 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2499 mStrokeWidthSpinBox->blockSignals(
false );
2502 spinHeight->blockSignals(
true );
2503 if ( preservedAspectRatio )
2512 spinHeight->blockSignals(
false );
2513 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2516void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2518 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
2520 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2522 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
2525 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2536 if ( layer->
layerType() != QLatin1String(
"SvgMarker" ) )
2543 mSvgSelectorWidget->setSvgPath(
mLayer->
path() );
2546 spinWidth->blockSignals(
true );
2548 spinWidth->blockSignals(
false );
2549 spinAngle->blockSignals(
true );
2551 spinAngle->blockSignals(
false );
2554 spinOffsetX->blockSignals(
true );
2556 spinOffsetX->blockSignals(
false );
2557 spinOffsetY->blockSignals(
true );
2559 spinOffsetY->blockSignals(
false );
2561 mSizeUnitWidget->blockSignals(
true );
2564 mSizeUnitWidget->blockSignals(
false );
2565 mStrokeWidthUnitWidget->blockSignals(
true );
2568 mStrokeWidthUnitWidget->blockSignals(
false );
2569 mOffsetUnitWidget->blockSignals(
true );
2572 mOffsetUnitWidget->blockSignals(
false );
2575 mHorizontalAnchorComboBox->blockSignals(
true );
2576 mVerticalAnchorComboBox->blockSignals(
true );
2579 mHorizontalAnchorComboBox->blockSignals(
false );
2580 mVerticalAnchorComboBox->blockSignals(
false );
2596 updateAssistantSymbol();
2613 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2622 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2628void QgsSvgMarkerSymbolLayerWidget::setWidth()
2631 double fixedAspectRatio = 0.0;
2632 spinHeight->blockSignals(
true );
2633 if ( defaultAspectRatio <= 0.0 )
2635 spinHeight->setValue( spinWidth->value() );
2637 else if ( mLockAspectRatio->locked() )
2639 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2643 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2645 spinHeight->blockSignals(
false );
2651void QgsSvgMarkerSymbolLayerWidget::setHeight()
2654 double fixedAspectRatio = 0.0;
2655 spinWidth->blockSignals(
true );
2656 if ( defaultAspectRatio <= 0.0 )
2658 spinWidth->setValue( spinHeight->value() );
2660 else if ( mLockAspectRatio->locked() )
2662 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2666 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2668 spinWidth->blockSignals(
false );
2674void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2678 if ( defaultAspectRatio <= 0.0 )
2694void QgsSvgMarkerSymbolLayerWidget::setAngle()
2700void QgsSvgMarkerSymbolLayerWidget::setOffset()
2702 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2706void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2713void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2724void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2735void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2744void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2754void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2764void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2774void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
2783void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
2800 mSvgSelectorWidget->setAllowParameters(
true );
2801 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2803 connect( mTextureWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2805 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2807 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2808 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2814 mRotationSpinBox->setClearValue( 0.0 );
2816 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2817 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2818 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2819 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2821 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2822 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2835 if ( layer->
layerType() != QLatin1String(
"SVGFill" ) )
2844 mTextureWidthSpinBox->blockSignals(
true );
2845 mTextureWidthSpinBox->setValue( width );
2846 mTextureWidthSpinBox->blockSignals(
false );
2848 mRotationSpinBox->blockSignals(
true );
2850 mRotationSpinBox->blockSignals(
false );
2851 mTextureWidthUnitWidget->blockSignals(
true );
2854 mTextureWidthUnitWidget->blockSignals(
false );
2855 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2858 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2859 mChangeColorButton->blockSignals(
true );
2861 mChangeColorButton->blockSignals(
false );
2862 mChangeStrokeColorButton->blockSignals(
true );
2864 mChangeStrokeColorButton->blockSignals(
false );
2865 mStrokeWidthSpinBox->blockSignals(
true );
2867 mStrokeWidthSpinBox->blockSignals(
false );
2891void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2900void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2912void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2915 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2921void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
2924 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2931void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2943 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2944 QColor defaultFill, defaultStroke;
2945 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2946 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2947 QgsApplication::svgCache()->
containsParams( mSvgSelectorWidget->sourceLineEdit()->source(), hasFillParam, hasDefaultFillColor, defaultFill, hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity, hasStrokeParam, hasDefaultStrokeColor, defaultStroke, hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth, hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2950 QColor fill = mChangeColorButton->color();
2951 const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2952 if ( hasDefaultFillColor )
2956 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2957 mChangeColorButton->setColor( fill );
2959 mChangeColorButton->setEnabled( hasFillParam );
2960 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2963 QColor stroke = mChangeStrokeColorButton->color();
2964 const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2965 if ( hasDefaultStrokeColor )
2967 stroke = defaultStroke;
2969 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2970 mChangeStrokeColorButton->setColor( stroke );
2972 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2973 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2974 if ( hasDefaultStrokeWidth && resetValues )
2976 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2978 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2981void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2992void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
3003void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3012void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
3022void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3038 connect( mAngleSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3039 connect( mDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3040 connect( mOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3045 mOffsetSpinBox->setClearValue( 0 );
3046 mAngleSpinBox->setClearValue( 0 );
3050 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [=] {
3061 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [=] {
3072 if ( layer->
layerType() != QLatin1String(
"LinePatternFill" ) )
3086 mDistanceUnitWidget->blockSignals(
true );
3089 mDistanceUnitWidget->blockSignals(
false );
3090 mOffsetUnitWidget->blockSignals(
true );
3093 mOffsetUnitWidget->blockSignals(
false );
3111void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3120void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3129void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3138void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3148void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3164 connect( mHorizontalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3165 connect( mVerticalDistanceSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3166 connect( mHorizontalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3167 connect( mVerticalDisplacementSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3168 connect( mHorizontalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3169 connect( mVerticalOffsetSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3170 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3171 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3172 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3173 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3174 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3175 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3187 connect( mClipModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [=] {
3197 connect( mCoordinateReferenceComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [=] {
3205 mSeedSpinBox->setShowClearButton(
true );
3206 mSeedSpinBox->setClearValue( 0 );
3207 mRandomXSpinBox->setClearValue( 0 );
3208 mRandomYSpinBox->setClearValue( 0 );
3212 connect( mRandomXSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double d ) {
3219 connect( mRandomYSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double d ) {
3242 connect( mSeedSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [=](
int v ) {
3250 mAngleSpinBox->setShowClearButton(
true );
3251 mAngleSpinBox->setClearValue( 0 );
3252 connect( mAngleSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double d ) {
3263 if ( !layer || layer->
layerType() != QLatin1String(
"PointPatternFill" ) )
3277 mHorizontalDistanceUnitWidget->blockSignals(
true );
3280 mHorizontalDistanceUnitWidget->blockSignals(
false );
3281 mVerticalDistanceUnitWidget->blockSignals(
true );
3284 mVerticalDistanceUnitWidget->blockSignals(
false );
3285 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3288 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3289 mVerticalDisplacementUnitWidget->blockSignals(
true );
3292 mVerticalDisplacementUnitWidget->blockSignals(
false );
3293 mHorizontalOffsetUnitWidget->blockSignals(
true );
3296 mHorizontalOffsetUnitWidget->blockSignals(
false );
3297 mVerticalOffsetUnitWidget->blockSignals(
true );
3300 mVerticalOffsetUnitWidget->blockSignals(
false );
3332void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3341void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3350void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3359void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3368void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3377void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3386void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3396void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3406void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3416void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3426void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3436void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3457 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3458 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3459 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3466 scrollArea->setVerticalOnly(
true );
3468 btnColor->setAllowOpacity(
true );
3469 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3470 btnColor->setContext( QStringLiteral(
"symbology" ) );
3471 btnStrokeColor->setAllowOpacity(
true );
3472 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3473 btnStrokeColor->setContext( QStringLiteral(
"symbology" ) );
3475 mColorDDBtn->registerLinkedWidget( btnColor );
3476 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3478 spinOffsetX->setClearValue( 0.0 );
3479 spinOffsetY->setClearValue( 0.0 );
3480 spinAngle->setClearValue( 0.0 );
3486 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3489 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3491 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3494 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3496 connect( spinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3497 connect( spinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3508 if ( layer->
layerType() != QLatin1String(
"FontMarker" ) )
3517 mFontStyleComboBox->blockSignals(
true );
3518 populateFontStyleComboBox();
3519 mFontStyleComboBox->blockSignals(
false );
3537 mCharPreview->
setFont( mRefFont );
3543 mSizeUnitWidget->blockSignals(
true );
3546 mSizeUnitWidget->blockSignals(
false );
3548 mStrokeWidthUnitWidget->blockSignals(
true );
3551 mStrokeWidthUnitWidget->blockSignals(
false );
3553 mOffsetUnitWidget->blockSignals(
true );
3556 mOffsetUnitWidget->blockSignals(
false );
3577 updateAssistantSymbol();
3592 mCharPreview->setFont( mRefFont );
3593 populateFontStyleComboBox();
3598void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3605 mCharPreview->setFont( mRefFont );
3637 mCharPreview->setText( text );
3639 if ( text.isEmpty() )
3643 QString character = text;
3644 if ( text.contains( QRegularExpression( QStringLiteral(
"^0x[0-9a-fA-F]{1,4}$" ) ) ) )
3647 const unsigned int value = text.toUInt( &ok, 0 );
3650 character = QChar( value );
3651 mCharPreview->setText( character );
3672 if (
mLayer->
character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3674 mCharLineEdit->insert( chr );
3680 mCharPreview->setText( chr );
3684void QgsFontMarkerSymbolLayerWidget::setOffset()
3686 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3690void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3696void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3706void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3716void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3726void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3728 mFontStyleComboBox->clear();
3729 const QStringList styles = mFontDB.styles( mRefFont.family() );
3730 const auto constStyles = styles;
3731 for (
const QString &style : constStyles )
3733 mFontStyleComboBox->addItem( style );
3736 QString targetStyle = mFontDB.styleString( mRefFont );
3737 if ( !styles.contains( targetStyle ) )
3740 targetStyle = QFontInfo( f ).styleName();
3741 mRefFont.setStyleName( targetStyle );
3744 const int stylIndx = mFontStyleComboBox->findText( targetStyle );
3745 if ( stylIndx > -1 )
3750 mFontStyleComboBox->setCurrentIndex( curIndx );
3753void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3756 setFontStyle( mFontStyleComboBox->currentText() );
3759void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3768void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3777void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3786void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3788 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1; i >= 0; --i )
3790 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3792 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
3795 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3807 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3808 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3809 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3810 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3815 if ( layer->
layerType() != QLatin1String(
"CentroidFill" ) )
3833void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3839void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3845void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
3851void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
3866 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3870 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3872 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3873 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3879 mSpinOffsetX->setClearValue( 0.0 );
3880 mSpinOffsetY->setClearValue( 0.0 );
3881 mRotationSpinBox->setClearValue( 0.0 );
3883 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3884 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3887 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3888 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3898 if ( layer->
layerType() != QLatin1String(
"RasterMarker" ) )
3909 mHeightSpinBox->blockSignals(
true );
3910 if ( preservedAspectRatio )
3919 mHeightSpinBox->blockSignals(
false );
3920 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
3928 mSizeUnitWidget->blockSignals(
true );
3931 mSizeUnitWidget->blockSignals(
false );
3932 mOffsetUnitWidget->blockSignals(
true );
3935 mOffsetUnitWidget->blockSignals(
false );
3950 updatePreviewImage();
3964void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
3967 updatePreviewImage();
3971void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
3973 bool fitsInCache =
false;
3975 if ( image.isNull() )
3977 mLabelImagePreview->setPixmap( QPixmap() );
3981 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3982 previewImage.fill( Qt::transparent );
3983 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3985 p.begin( &previewImage );
3987 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
3988 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3989 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3990 QBrush checkerBrush;
3991 checkerBrush.setTexture( pix );
3992 p.fillRect( imageRect, checkerBrush );
3999 p.drawImage( imageRect.left(), imageRect.top(), image );
4001 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4004void QgsRasterMarkerSymbolLayerWidget::setWidth()
4007 double fixedAspectRatio = 0.0;
4008 mHeightSpinBox->blockSignals(
true );
4009 if ( defaultAspectRatio <= 0.0 )
4011 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4013 else if ( mLockAspectRatio->locked() )
4015 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4019 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4021 mHeightSpinBox->blockSignals(
false );
4027void QgsRasterMarkerSymbolLayerWidget::setHeight()
4030 double fixedAspectRatio = 0.0;
4031 mWidthSpinBox->blockSignals(
true );
4032 if ( defaultAspectRatio <= 0.0 )
4034 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4036 else if ( mLockAspectRatio->locked() )
4038 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4042 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4044 mWidthSpinBox->blockSignals(
false );
4050void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4053 if ( defaultAspectRatio <= 0.0 )
4068void QgsRasterMarkerSymbolLayerWidget::setAngle()
4074void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
4078 updatePreviewImage();
4081void QgsRasterMarkerSymbolLayerWidget::setOffset()
4083 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4087void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4097void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4107void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
4116void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
4135 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastAnimatedMarkerImageDir" ) );
4139 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setAngle );
4141 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setWidth );
4142 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setHeight );
4145 mFrameRateSpin->setClearValue( 10 );
4146 mFrameRateSpin->setShowClearButton(
true );
4147 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this, [=](
double value ) {
4155 mSpinOffsetX->setClearValue( 0.0 );
4156 mSpinOffsetY->setClearValue( 0.0 );
4157 mRotationSpinBox->setClearValue( 0.0 );
4159 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4160 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::setOffset );
4163 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
4164 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
4174 if ( layer->
layerType() != QLatin1String(
"AnimatedMarker" ) )
4184 if ( firstFrameTime > 0 )
4186 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4190 mFrameRateSpin->setClearValue( 10 );
4195 mHeightSpinBox->blockSignals(
true );
4196 if ( preservedAspectRatio )
4205 mHeightSpinBox->blockSignals(
false );
4206 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
4216 mSizeUnitWidget->blockSignals(
true );
4219 mSizeUnitWidget->blockSignals(
false );
4220 mOffsetUnitWidget->blockSignals(
true );
4223 mOffsetUnitWidget->blockSignals(
false );
4238 updatePreviewImage();
4252void QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
4257 if ( firstFrameTime > 0 )
4259 mFrameRateSpin->setClearValue( 1000 / firstFrameTime );
4263 mFrameRateSpin->setClearValue( 10 );
4265 updatePreviewImage();
4269void QgsAnimatedMarkerSymbolLayerWidget::updatePreviewImage()
4271 if ( mPreviewMovie )
4273 mLabelImagePreview->setMovie(
nullptr );
4274 mPreviewMovie->deleteLater();
4275 mPreviewMovie =
nullptr;
4278 mPreviewMovie =
new QMovie(
mLayer->
path(), QByteArray(),
this );
4279 mPreviewMovie->setScaledSize( QSize( 150, 150 ) );
4280 mLabelImagePreview->setMovie( mPreviewMovie );
4281 mPreviewMovie->start();
4284void QgsAnimatedMarkerSymbolLayerWidget::setWidth()
4287 double fixedAspectRatio = 0.0;
4288 mHeightSpinBox->blockSignals(
true );
4289 if ( defaultAspectRatio <= 0.0 )
4291 mHeightSpinBox->setValue( mWidthSpinBox->value() );
4293 else if ( mLockAspectRatio->locked() )
4295 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
4299 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4301 mHeightSpinBox->blockSignals(
false );
4307void QgsAnimatedMarkerSymbolLayerWidget::setHeight()
4310 double fixedAspectRatio = 0.0;
4311 mWidthSpinBox->blockSignals(
true );
4312 if ( defaultAspectRatio <= 0.0 )
4314 mWidthSpinBox->setValue( mHeightSpinBox->value() );
4316 else if ( mLockAspectRatio->locked() )
4318 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
4322 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
4324 mWidthSpinBox->blockSignals(
false );
4330void QgsAnimatedMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
4333 if ( defaultAspectRatio <= 0.0 )
4348void QgsAnimatedMarkerSymbolLayerWidget::setAngle()
4354void QgsAnimatedMarkerSymbolLayerWidget::setOpacity(
double value )
4358 updatePreviewImage();
4361void QgsAnimatedMarkerSymbolLayerWidget::setOffset()
4363 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4367void QgsAnimatedMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
4377void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
4387void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
4396void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
4413 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
4417 connect( mRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4428 connect( mWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [=](
double d ) {
4437 connect( mHeightSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, [=](
double d ) {
4449 mSpinOffsetX->setClearValue( 0.0 );
4450 mSpinOffsetY->setClearValue( 0.0 );
4451 mRotationSpinBox->setClearValue( 0.0 );
4453 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4454 connect( mSpinOffsetX,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4455 connect( mSpinOffsetY,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4467 if ( layer->
layerType() != QLatin1String(
"RasterFill" ) )
4480 cboCoordinateMode->blockSignals(
true );
4484 cboCoordinateMode->setCurrentIndex( 1 );
4488 cboCoordinateMode->setCurrentIndex( 0 );
4491 cboCoordinateMode->blockSignals(
false );
4497 mOffsetUnitWidget->blockSignals(
true );
4500 mOffsetUnitWidget->blockSignals(
false );
4503 mSizeUnitWidget->blockSignals(
true );
4506 mSizeUnitWidget->blockSignals(
false );
4510 updatePreviewImage();
4525void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4528 updatePreviewImage();
4532void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4549void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4558 updatePreviewImage();
4561void QgsRasterFillSymbolLayerWidget::offsetChanged()
4563 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4567void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4578void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4587void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4589 bool fitsInCache =
false;
4591 if ( image.isNull() )
4593 mLabelImagePreview->setPixmap( QPixmap() );
4597 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4598 previewImage.fill( Qt::transparent );
4599 const QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4601 p.begin( &previewImage );
4603 uchar pixDataRGB[] = { 150, 150, 150, 150, 100, 100, 100, 150, 100, 100, 100, 150, 150, 150, 150, 150 };
4604 const QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4605 const QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4606 QBrush checkerBrush;
4607 checkerBrush.setTexture( pix );
4608 p.fillRect( imageRect, checkerBrush );
4615 p.drawImage( imageRect.left(), imageRect.top(), image );
4617 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4631 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
4636 connect( mPenWidthUnitWidget, &