45 #include <QAbstractButton> 46 #include <QButtonGroup> 47 #include <QColorDialog> 50 #include <QFileDialog> 52 #include <QStandardItemModel> 53 #include <QSvgRenderer> 54 #include <QMessageBox> 70 expContext << symbolScope;
83 expContext.setOriginalValueVariable( QVariant() );
103 if ( ddButton->assistant() )
104 ddButton->assistant()->setMapCanvas( mContext.
mapCanvas() );
123 void QgsSymbolLayerWidget::createAuxiliaryField()
144 if ( dlg.exec() == QDialog::Accepted )
155 property.setActive(
true );
177 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
178 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
182 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
190 btnChangeColor->setAllowOpacity(
true );
191 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
192 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
194 spinOffset->setClearValue( 0.0 );
199 mDrawInsideCheckBox->hide();
206 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
208 connect( spinWidth, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
210 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
211 connect( spinOffset, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
212 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
213 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
220 void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
222 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
224 mAssistantPreviewSymbol->deleteSymbolLayer( i );
226 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
229 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
235 if ( !layer || layer->
layerType() != QLatin1String(
"SimpleLine" ) )
242 mPenWidthUnitWidget->blockSignals(
true );
245 mPenWidthUnitWidget->blockSignals(
false );
246 mOffsetUnitWidget->blockSignals(
true );
249 mOffsetUnitWidget->blockSignals(
false );
250 mDashPatternUnitWidget->blockSignals(
true );
254 mDashPatternUnitWidget->blockSignals(
false );
257 spinWidth->blockSignals(
true );
259 spinWidth->blockSignals(
false );
260 btnChangeColor->blockSignals(
true );
262 btnChangeColor->blockSignals(
false );
263 spinOffset->blockSignals(
true );
265 spinOffset->blockSignals(
false );
266 cboPenStyle->blockSignals(
true );
267 cboJoinStyle->blockSignals(
true );
268 cboCapStyle->blockSignals(
true );
272 cboPenStyle->blockSignals(
false );
273 cboJoinStyle->blockSignals(
false );
274 cboCapStyle->blockSignals(
false );
278 mChangePatternButton->setEnabled( useCustomDashPattern );
279 label_3->setEnabled( !useCustomDashPattern );
280 cboPenStyle->setEnabled( !useCustomDashPattern );
281 mCustomCheckBox->blockSignals(
true );
282 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
283 mCustomCheckBox->blockSignals(
false );
287 mDrawInsideCheckBox->blockSignals(
true );
288 mDrawInsideCheckBox->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
289 mDrawInsideCheckBox->blockSignals(
false );
301 updateAssistantSymbol();
309 void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
316 void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
323 void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
331 void QgsSimpleLineSymbolLayerWidget::offsetChanged()
338 void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
340 bool checked = ( state == Qt::Checked );
341 mChangePatternButton->setEnabled( checked );
342 label_3->setEnabled( !checked );
343 cboPenStyle->setEnabled( !checked );
349 void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
352 if ( d.exec() == QDialog::Accepted )
360 void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
370 void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
380 void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
390 void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
392 bool checked = ( state == Qt::Checked );
411 mChangePatternButton->setIcon( buttonIcon );
428 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
429 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
430 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
431 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
439 btnChangeColorFill->setAllowOpacity(
true );
440 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
441 btnChangeColorFill->setContext( QStringLiteral(
"symbology" ) );
442 btnChangeColorFill->setShowNoColor(
true );
443 btnChangeColorFill->setNoColorString( tr(
"Transparent fill" ) );
444 btnChangeColorStroke->setAllowOpacity(
true );
445 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
446 btnChangeColorStroke->setContext( QStringLiteral(
"symbology" ) );
447 btnChangeColorStroke->setShowNoColor(
true );
448 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
450 spinOffsetX->setClearValue( 0.0 );
451 spinOffsetY->setClearValue( 0.0 );
452 spinAngle->setClearValue( 0.0 );
458 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
460 int size = lstNames->iconSize().width();
461 size = std::max( 30, static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width( QStringLiteral(
"XXX" ) ) ) ) );
462 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
463 lstNames->setIconSize( QSize( size, size ) );
465 double markerSize = size * 0.8;
470 lyr->
setColor( QColor( 200, 200, 200 ) );
473 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
474 item->setData( Qt::UserRole, static_cast< int >( shape ) );
479 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
481 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
484 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
485 connect( spinSize, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
486 connect( spinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
487 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
488 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
494 if ( layer->
layerType() != QLatin1String(
"SimpleMarker" ) )
502 for (
int i = 0; i < lstNames->count(); ++i )
504 if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
506 lstNames->setCurrentRow( i );
510 btnChangeColorStroke->blockSignals(
true );
512 btnChangeColorStroke->blockSignals(
false );
513 btnChangeColorFill->blockSignals(
true );
516 btnChangeColorFill->blockSignals(
false );
517 spinSize->blockSignals(
true );
519 spinSize->blockSignals(
false );
520 spinAngle->blockSignals(
true );
522 spinAngle->blockSignals(
false );
523 mStrokeStyleComboBox->blockSignals(
true );
525 mStrokeStyleComboBox->blockSignals(
false );
526 mStrokeWidthSpinBox->blockSignals(
true );
528 mStrokeWidthSpinBox->blockSignals(
false );
529 cboJoinStyle->blockSignals(
true );
531 cboJoinStyle->blockSignals(
false );
534 spinOffsetX->blockSignals(
true );
536 spinOffsetX->blockSignals(
false );
537 spinOffsetY->blockSignals(
true );
539 spinOffsetY->blockSignals(
false );
541 mSizeUnitWidget->blockSignals(
true );
544 mSizeUnitWidget->blockSignals(
false );
545 mOffsetUnitWidget->blockSignals(
true );
548 mOffsetUnitWidget->blockSignals(
false );
549 mStrokeWidthUnitWidget->blockSignals(
true );
552 mStrokeWidthUnitWidget->blockSignals(
false );
555 mHorizontalAnchorComboBox->blockSignals(
true );
556 mVerticalAnchorComboBox->blockSignals(
true );
559 mHorizontalAnchorComboBox->blockSignals(
false );
560 mVerticalAnchorComboBox->blockSignals(
false );
574 updateAssistantSymbol();
582 void QgsSimpleMarkerSymbolLayerWidget::setShape()
584 mLayer->
setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
601 void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
607 void QgsSimpleMarkerSymbolLayerWidget::setSize()
613 void QgsSimpleMarkerSymbolLayerWidget::setAngle()
619 void QgsSimpleMarkerSymbolLayerWidget::setOffset()
621 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
625 void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
636 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
645 void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
655 void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
665 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
675 void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
684 void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
693 void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
695 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
697 mAssistantPreviewSymbol->deleteSymbolLayer( i );
699 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
702 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
721 btnChangeColor->setAllowOpacity(
true );
722 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
723 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
724 btnChangeColor->setShowNoColor(
true );
725 btnChangeColor->setNoColorString( tr(
"Transparent fill" ) );
726 btnChangeStrokeColor->setAllowOpacity(
true );
727 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
728 btnChangeStrokeColor->setContext( QStringLiteral(
"symbology" ) );
729 btnChangeStrokeColor->setShowNoColor(
true );
730 btnChangeStrokeColor->setNoColorString( tr(
"Transparent stroke" ) );
732 spinOffsetX->setClearValue( 0.0 );
733 spinOffsetY->setClearValue( 0.0 );
736 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
738 connect( spinStrokeWidth, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
739 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
740 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
741 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
742 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
747 if ( layer->
layerType() != QLatin1String(
"SimpleFill" ) )
754 btnChangeColor->blockSignals(
true );
756 btnChangeColor->blockSignals(
false );
757 cboFillStyle->blockSignals(
true );
759 cboFillStyle->blockSignals(
false );
760 btnChangeStrokeColor->blockSignals(
true );
762 btnChangeStrokeColor->blockSignals(
false );
763 cboStrokeStyle->blockSignals(
true );
765 cboStrokeStyle->blockSignals(
false );
766 spinStrokeWidth->blockSignals(
true );
768 spinStrokeWidth->blockSignals(
false );
769 cboJoinStyle->blockSignals(
true );
771 cboJoinStyle->blockSignals(
false );
772 spinOffsetX->blockSignals(
true );
774 spinOffsetX->blockSignals(
false );
775 spinOffsetY->blockSignals(
true );
777 spinOffsetY->blockSignals(
false );
779 mStrokeWidthUnitWidget->blockSignals(
true );
782 mStrokeWidthUnitWidget->blockSignals(
false );
783 mOffsetUnitWidget->blockSignals(
true );
786 mOffsetUnitWidget->blockSignals(
false );
814 void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
820 void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
826 void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
833 void QgsSimpleFillSymbolLayerWidget::offsetChanged()
835 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
839 void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
849 void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
869 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
870 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
876 spinOffsetX->setClearValue( 0.0 );
877 spinOffsetY->setClearValue( 0.0 );
878 spinAngle->setClearValue( 0.0 );
884 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
886 QSize size = lstNames->iconSize();
894 lyr->
setColor( QColor( 200, 200, 200 ) );
897 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
898 item->setData( Qt::UserRole, static_cast< int >( shape ) );
903 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
904 connect( spinSize, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
905 connect( spinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
906 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
907 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
913 if ( layer->
layerType() != QLatin1String(
"FilledMarker" ) )
921 for (
int i = 0; i < lstNames->count(); ++i )
923 if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
925 lstNames->setCurrentRow( i );
934 mSizeUnitWidget->blockSignals(
true );
937 mSizeUnitWidget->blockSignals(
false );
938 mOffsetUnitWidget->blockSignals(
true );
941 mOffsetUnitWidget->blockSignals(
false );
954 updateAssistantSymbol();
962 void QgsFilledMarkerSymbolLayerWidget::setShape()
964 mLayer->
setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
968 void QgsFilledMarkerSymbolLayerWidget::setSize()
974 void QgsFilledMarkerSymbolLayerWidget::setAngle()
980 void QgsFilledMarkerSymbolLayerWidget::setOffset()
982 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
986 void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
996 void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1006 void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
1015 void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
1024 void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1026 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1028 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1030 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1033 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1046 connect( mSpinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1050 btnColorRamp->setShowGradientOnly(
true );
1052 btnChangeColor->setAllowOpacity(
true );
1053 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1054 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1055 btnChangeColor->setShowNoColor(
true );
1056 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1057 btnChangeColor2->setAllowOpacity(
true );
1058 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1059 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1060 btnChangeColor2->setShowNoColor(
true );
1061 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1063 spinOffsetX->setClearValue( 0.0 );
1064 spinOffsetY->setClearValue( 0.0 );
1065 mSpinAngle->setClearValue( 0.0 );
1073 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1074 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1075 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1076 connect( spinRefPoint1X, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1077 connect( spinRefPoint1Y, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1078 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1079 connect( spinRefPoint2X, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1080 connect( spinRefPoint2Y, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1081 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1086 if ( layer->
layerType() != QLatin1String(
"GradientFill" ) )
1093 btnChangeColor->blockSignals(
true );
1095 btnChangeColor->blockSignals(
false );
1096 btnChangeColor2->blockSignals(
true );
1098 btnChangeColor2->blockSignals(
false );
1102 radioTwoColor->setChecked(
true );
1103 btnColorRamp->setEnabled(
false );
1107 radioColorRamp->setChecked(
true );
1108 btnChangeColor->setEnabled(
false );
1109 btnChangeColor2->setEnabled(
false );
1115 btnColorRamp->blockSignals(
true );
1117 btnColorRamp->blockSignals(
false );
1120 cboGradientType->blockSignals(
true );
1124 cboGradientType->setCurrentIndex( 0 );
1127 cboGradientType->setCurrentIndex( 1 );
1130 cboGradientType->setCurrentIndex( 2 );
1133 cboGradientType->blockSignals(
false );
1135 cboCoordinateMode->blockSignals(
true );
1139 cboCoordinateMode->setCurrentIndex( 1 );
1140 checkRefPoint1Centroid->setEnabled(
false );
1141 checkRefPoint2Centroid->setEnabled(
false );
1145 cboCoordinateMode->setCurrentIndex( 0 );
1148 cboCoordinateMode->blockSignals(
false );
1150 cboGradientSpread->blockSignals(
true );
1154 cboGradientSpread->setCurrentIndex( 0 );
1157 cboGradientSpread->setCurrentIndex( 1 );
1160 cboGradientSpread->setCurrentIndex( 2 );
1163 cboGradientSpread->blockSignals(
false );
1165 spinRefPoint1X->blockSignals(
true );
1167 spinRefPoint1X->blockSignals(
false );
1168 spinRefPoint1Y->blockSignals(
true );
1170 spinRefPoint1Y->blockSignals(
false );
1171 checkRefPoint1Centroid->blockSignals(
true );
1175 spinRefPoint1X->setEnabled(
false );
1176 spinRefPoint1Y->setEnabled(
false );
1178 checkRefPoint1Centroid->blockSignals(
false );
1179 spinRefPoint2X->blockSignals(
true );
1181 spinRefPoint2X->blockSignals(
false );
1182 spinRefPoint2Y->blockSignals(
true );
1184 spinRefPoint2Y->blockSignals(
false );
1185 checkRefPoint2Centroid->blockSignals(
true );
1189 spinRefPoint2X->setEnabled(
false );
1190 spinRefPoint2Y->setEnabled(
false );
1192 checkRefPoint2Centroid->blockSignals(
false );
1194 spinOffsetX->blockSignals(
true );
1196 spinOffsetX->blockSignals(
false );
1197 spinOffsetY->blockSignals(
true );
1199 spinOffsetY->blockSignals(
false );
1200 mSpinAngle->blockSignals(
true );
1202 mSpinAngle->blockSignals(
false );
1204 mOffsetUnitWidget->blockSignals(
true );
1207 mOffsetUnitWidget->blockSignals(
false );
1240 void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1242 if ( radioTwoColor->isChecked() )
1255 if ( btnColorRamp->isNull() )
1269 spinRefPoint1X->setValue( 0.5 );
1270 spinRefPoint1Y->setValue( 0 );
1271 spinRefPoint2X->setValue( 0.5 );
1272 spinRefPoint2Y->setValue( 1 );
1277 spinRefPoint1X->setValue( 0 );
1278 spinRefPoint1Y->setValue( 0 );
1279 spinRefPoint2X->setValue( 1 );
1280 spinRefPoint2Y->setValue( 1 );
1284 spinRefPoint1X->setValue( 0.5 );
1285 spinRefPoint1Y->setValue( 0.5 );
1286 spinRefPoint2X->setValue( 1 );
1287 spinRefPoint2Y->setValue( 1 );
1302 checkRefPoint1Centroid->setEnabled(
true );
1303 checkRefPoint2Centroid->setEnabled(
true );
1309 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1310 checkRefPoint1Centroid->setEnabled(
false );
1311 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1312 checkRefPoint2Centroid->setEnabled(
false );
1337 void QgsGradientFillSymbolLayerWidget::offsetChanged()
1339 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1343 void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1352 void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1358 void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1376 connect( mSpinBlurRadius, qgis::overload< int >::of( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1377 connect( mSpinMaxDistance, qgis::overload< double >::of( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1379 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1381 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1387 QButtonGroup *group1 =
new QButtonGroup(
this );
1388 group1->addButton( radioColorRamp );
1389 group1->addButton( radioTwoColor );
1390 QButtonGroup *group2 =
new QButtonGroup(
this );
1391 group2->addButton( mRadioUseMaxDistance );
1392 group2->addButton( mRadioUseWholeShape );
1393 btnChangeColor->setAllowOpacity(
true );
1394 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1395 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1396 btnChangeColor->setShowNoColor(
true );
1397 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1398 btnChangeColor2->setAllowOpacity(
true );
1399 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1400 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1401 btnChangeColor2->setShowNoColor(
true );
1402 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1404 spinOffsetX->setClearValue( 0.0 );
1405 spinOffsetY->setClearValue( 0.0 );
1407 btnColorRamp->setShowGradientOnly(
true );
1413 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1414 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1415 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1417 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1418 connect( mSpinBlurRadius, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1423 if ( layer->
layerType() != QLatin1String(
"ShapeburstFill" ) )
1430 btnChangeColor->blockSignals(
true );
1432 btnChangeColor->blockSignals(
false );
1433 btnChangeColor2->blockSignals(
true );
1435 btnChangeColor2->blockSignals(
false );
1439 radioTwoColor->setChecked(
true );
1440 btnColorRamp->setEnabled(
false );
1444 radioColorRamp->setChecked(
true );
1445 btnChangeColor->setEnabled(
false );
1446 btnChangeColor2->setEnabled(
false );
1449 mSpinBlurRadius->blockSignals(
true );
1450 mBlurSlider->blockSignals(
true );
1453 mSpinBlurRadius->blockSignals(
false );
1454 mBlurSlider->blockSignals(
false );
1456 mSpinMaxDistance->blockSignals(
true );
1458 mSpinMaxDistance->blockSignals(
false );
1460 mRadioUseWholeShape->blockSignals(
true );
1461 mRadioUseMaxDistance->blockSignals(
true );
1464 mRadioUseWholeShape->setChecked(
true );
1465 mSpinMaxDistance->setEnabled(
false );
1466 mDistanceUnitWidget->setEnabled(
false );
1470 mRadioUseMaxDistance->setChecked(
true );
1471 mSpinMaxDistance->setEnabled(
true );
1472 mDistanceUnitWidget->setEnabled(
true );
1474 mRadioUseWholeShape->blockSignals(
false );
1475 mRadioUseMaxDistance->blockSignals(
false );
1477 mDistanceUnitWidget->blockSignals(
true );
1480 mDistanceUnitWidget->blockSignals(
false );
1482 mIgnoreRingsCheckBox->blockSignals(
true );
1483 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1484 mIgnoreRingsCheckBox->blockSignals(
false );
1489 btnColorRamp->blockSignals(
true );
1491 btnColorRamp->blockSignals(
false );
1494 spinOffsetX->blockSignals(
true );
1496 spinOffsetX->blockSignals(
false );
1497 spinOffsetY->blockSignals(
true );
1499 spinOffsetY->blockSignals(
false );
1500 mOffsetUnitWidget->blockSignals(
true );
1503 mOffsetUnitWidget->blockSignals(
false );
1536 void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1543 if ( radioTwoColor->isChecked() )
1554 void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1563 void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1572 void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1582 void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1587 mDistanceUnitWidget->setEnabled( !value );
1592 void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1602 void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1606 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1611 void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1622 void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1624 bool checked = ( state == Qt::Checked );
1647 spinOffset->setClearValue( 0.0 );
1651 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1652 connect( spinOffset, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1653 connect( radInterval, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1654 connect( radVertex, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1655 connect( radVertexLast, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1656 connect( radVertexFirst, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1657 connect( radCentralPoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1658 connect( radCurvePoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1663 if ( layer->
layerType() != QLatin1String(
"MarkerLine" ) )
1670 spinInterval->blockSignals(
true );
1672 spinInterval->blockSignals(
false );
1673 mSpinOffsetAlongLine->blockSignals(
true );
1675 mSpinOffsetAlongLine->blockSignals(
false );
1676 chkRotateMarker->blockSignals(
true );
1678 chkRotateMarker->blockSignals(
false );
1679 spinOffset->blockSignals(
true );
1681 spinOffset->blockSignals(
false );
1683 radInterval->setChecked(
true );
1685 radVertex->setChecked(
true );
1687 radVertexLast->setChecked(
true );
1689 radCentralPoint->setChecked(
true );
1691 radCurvePoint->setChecked(
true );
1693 radVertexFirst->setChecked(
true );
1696 mIntervalUnitWidget->blockSignals(
true );
1699 mIntervalUnitWidget->blockSignals(
false );
1700 mOffsetUnitWidget->blockSignals(
true );
1703 mOffsetUnitWidget->blockSignals(
false );
1704 mOffsetAlongLineUnitWidget->blockSignals(
true );
1707 mOffsetAlongLineUnitWidget->blockSignals(
false );
1734 void QgsMarkerLineSymbolLayerWidget::setRotate()
1740 void QgsMarkerLineSymbolLayerWidget::setOffset()
1746 void QgsMarkerLineSymbolLayerWidget::setPlacement()
1748 bool interval = radInterval->isChecked();
1749 spinInterval->setEnabled( interval );
1750 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1752 if ( radInterval->isChecked() )
1754 else if ( radVertex->isChecked() )
1756 else if ( radVertexLast->isChecked() )
1758 else if ( radVertexFirst->isChecked() )
1760 else if ( radCurvePoint->isChecked() )
1768 void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
1778 void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
1788 void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
1807 connect( mFileToolButton, &QToolButton::clicked,
this, &QgsSvgMarkerSymbolLayerWidget::mFileToolButton_clicked );
1808 connect( mFileLineEdit, &QLineEdit::textEdited,
this, &QgsSvgMarkerSymbolLayerWidget::mFileLineEdit_textEdited );
1809 connect( mFileLineEdit, &QLineEdit::editingFinished,
this, &QgsSvgMarkerSymbolLayerWidget::mFileLineEdit_editingFinished );
1811 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
1812 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
1816 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1817 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1824 viewGroups->setHeaderHidden(
true );
1825 mChangeColorButton->setAllowOpacity(
true );
1826 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
1827 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
1828 mChangeStrokeColorButton->setAllowOpacity(
true );
1829 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
1830 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
1832 spinOffsetX->setClearValue( 0.0 );
1833 spinOffsetY->setClearValue( 0.0 );
1834 spinAngle->setClearValue( 0.0 );
1836 mIconSize = std::max( 30, static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width( QStringLiteral(
"XXXX" ) ) ) ) );
1837 viewImages->setGridSize( QSize( mIconSize * 1.2, mIconSize * 1.2 ) );
1841 connect( viewImages->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSvgMarkerSymbolLayerWidget::setName );
1842 connect( viewGroups->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSvgMarkerSymbolLayerWidget::populateIcons );
1843 connect( spinWidth, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
1844 connect( spinHeight, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
1846 connect( spinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
1847 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
1848 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
1857 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
1858 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
1863 #include <QAbstractListModel> 1864 #include <QPixmapCache> 1870 QAbstractItemModel *oldModel = viewGroups->model();
1872 viewGroups->setModel( g );
1876 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
1877 for (
int i = 0; i < rows; i++ )
1879 viewGroups->setExpanded( g->indexFromItem( g->item( i ) ),
true );
1883 oldModel = viewImages->model();
1885 viewImages->setModel( m );
1889 void QgsSvgMarkerSymbolLayerWidget::populateIcons(
const QModelIndex &idx )
1891 QString path = idx.data( Qt::UserRole + 1 ).toString();
1893 QAbstractItemModel *oldModel = viewImages->model();
1895 viewImages->setModel( m );
1898 connect( viewImages->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSvgMarkerSymbolLayerWidget::setName );
1909 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
1910 QColor defaultFill, defaultStroke;
1911 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
1912 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
1914 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
1915 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
1916 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
1917 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
1918 mChangeColorButton->setEnabled( hasFillParam );
1919 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
1920 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
1921 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
1922 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
1927 double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
1928 if ( hasDefaultFillColor )
1932 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
1933 mChangeColorButton->setColor( fill );
1935 if ( hasStrokeParam )
1938 double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
1939 if ( hasDefaultStrokeColor )
1941 stroke = defaultStroke;
1943 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
1944 mChangeStrokeColorButton->setColor( stroke );
1947 mFileLineEdit->blockSignals(
true );
1948 mFileLineEdit->setText( layer->
path() );
1949 mFileLineEdit->blockSignals(
false );
1951 mStrokeWidthSpinBox->blockSignals(
true );
1952 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
1953 mStrokeWidthSpinBox->blockSignals(
false );
1956 spinHeight->blockSignals(
true );
1957 if ( preservedAspectRatio )
1959 spinHeight->setValue( layer->
size() );
1966 spinHeight->blockSignals(
false );
1967 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
1970 void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
1972 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1974 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1976 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1979 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1990 if ( layer->
layerType() != QLatin1String(
"SvgMarker" ) )
1998 QAbstractItemModel *m = viewImages->model();
1999 QItemSelectionModel *selModel = viewImages->selectionModel();
2000 for (
int i = 0; i < m->rowCount(); i++ )
2002 QModelIndex idx( m->index( i, 0 ) );
2003 if ( m->data( idx ).toString() ==
mLayer->
path() )
2005 selModel->select( idx, QItemSelectionModel::SelectCurrent );
2006 selModel->setCurrentIndex( idx, QItemSelectionModel::SelectCurrent );
2012 spinWidth->blockSignals(
true );
2014 spinWidth->blockSignals(
false );
2015 spinAngle->blockSignals(
true );
2017 spinAngle->blockSignals(
false );
2020 spinOffsetX->blockSignals(
true );
2022 spinOffsetX->blockSignals(
false );
2023 spinOffsetY->blockSignals(
true );
2025 spinOffsetY->blockSignals(
false );
2027 mSizeUnitWidget->blockSignals(
true );
2030 mSizeUnitWidget->blockSignals(
false );
2031 mStrokeWidthUnitWidget->blockSignals(
true );
2034 mStrokeWidthUnitWidget->blockSignals(
false );
2035 mOffsetUnitWidget->blockSignals(
true );
2038 mOffsetUnitWidget->blockSignals(
false );
2041 mHorizontalAnchorComboBox->blockSignals(
true );
2042 mVerticalAnchorComboBox->blockSignals(
true );
2045 mHorizontalAnchorComboBox->blockSignals(
false );
2046 mVerticalAnchorComboBox->blockSignals(
false );
2061 updateAssistantSymbol();
2069 void QgsSvgMarkerSymbolLayerWidget::setName(
const QModelIndex &idx )
2071 QString name = idx.data( Qt::UserRole ).toString();
2073 mFileLineEdit->setText( name );
2079 void QgsSvgMarkerSymbolLayerWidget::setWidth()
2082 double fixedAspectRatio = 0.0;
2083 spinHeight->blockSignals(
true );
2084 if ( defaultAspectRatio <= 0.0 )
2086 spinHeight->setValue( spinWidth->value() );
2088 else if ( mLockAspectRatio->locked() )
2090 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2094 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2096 spinHeight->blockSignals(
false );
2102 void QgsSvgMarkerSymbolLayerWidget::setHeight()
2105 double fixedAspectRatio = 0.0;
2106 spinWidth->blockSignals(
true );
2107 if ( defaultAspectRatio <= 0.0 )
2109 spinWidth->setValue( spinHeight->value() );
2111 else if ( mLockAspectRatio->locked() )
2113 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2117 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2119 spinWidth->blockSignals(
false );
2125 void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2129 if ( defaultAspectRatio <= 0.0 )
2145 void QgsSvgMarkerSymbolLayerWidget::setAngle()
2151 void QgsSvgMarkerSymbolLayerWidget::setOffset()
2153 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2157 void QgsSvgMarkerSymbolLayerWidget::mFileToolButton_clicked()
2160 QString file = QFileDialog::getOpenFileName(
nullptr,
2161 tr(
"Select SVG file" ),
2162 s.
value( QStringLiteral(
"/UI/lastSVGMarkerDir" ), QDir::homePath() ).toString(),
2163 tr(
"SVG files" ) +
" (*.svg)" );
2164 QFileInfo fi( file );
2165 if ( file.isEmpty() || !fi.exists() )
2169 mFileLineEdit->setText( file );
2171 s.
setValue( QStringLiteral(
"/UI/lastSVGMarkerDir" ), fi.absolutePath() );
2176 void QgsSvgMarkerSymbolLayerWidget::mFileLineEdit_textEdited(
const QString &text )
2178 if ( !QFileInfo::exists( text ) )
2187 void QgsSvgMarkerSymbolLayerWidget::mFileLineEdit_editingFinished()
2189 if ( !QFileInfo::exists( mFileLineEdit->text() ) )
2191 QUrl url( mFileLineEdit->text() );
2192 if ( !url.isValid() )
2198 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
2200 QApplication::restoreOverrideCursor();
2206 void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2217 void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2228 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2237 void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2247 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2257 void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2267 void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
2276 void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
2291 connect( mBrowseToolButton, &QToolButton::clicked,
this, &QgsSVGFillSymbolLayerWidget::mBrowseToolButton_clicked );
2292 connect( mTextureWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2293 connect( mSVGLineEdit, &QLineEdit::textEdited,
this, &QgsSVGFillSymbolLayerWidget::mSVGLineEdit_textEdited );
2294 connect( mSVGLineEdit, &QLineEdit::editingFinished,
this, &QgsSVGFillSymbolLayerWidget::mSVGLineEdit_editingFinished );
2295 connect( mRotationSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2297 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2298 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2305 mSvgTreeView->setHeaderHidden(
true );
2308 mRotationSpinBox->setClearValue( 0.0 );
2310 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2311 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2312 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2313 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2315 connect( mSvgListView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSVGFillSymbolLayerWidget::setFile );
2316 connect( mSvgTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSVGFillSymbolLayerWidget::populateIcons );
2326 if ( layer->
layerType() != QLatin1String(
"SVGFill" ) )
2335 mTextureWidthSpinBox->blockSignals(
true );
2336 mTextureWidthSpinBox->setValue( width );
2337 mTextureWidthSpinBox->blockSignals(
false );
2339 mRotationSpinBox->blockSignals(
true );
2341 mRotationSpinBox->blockSignals(
false );
2342 mTextureWidthUnitWidget->blockSignals(
true );
2345 mTextureWidthUnitWidget->blockSignals(
false );
2346 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2349 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2350 mChangeColorButton->blockSignals(
true );
2352 mChangeColorButton->blockSignals(
false );
2353 mChangeStrokeColorButton->blockSignals(
true );
2355 mChangeStrokeColorButton->blockSignals(
false );
2356 mStrokeWidthSpinBox->blockSignals(
true );
2358 mStrokeWidthSpinBox->blockSignals(
false );
2375 void QgsSVGFillSymbolLayerWidget::mBrowseToolButton_clicked()
2377 QString filePath = QFileDialog::getOpenFileName(
nullptr, tr(
"Select SVG Texture File" ), QDir::homePath(), tr(
"SVG file" ) +
" (*.svg);;" + tr(
"All files" ) +
" (*.*)" );
2378 if ( !filePath.isNull() )
2380 mSVGLineEdit->setText( filePath );
2385 void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2394 void QgsSVGFillSymbolLayerWidget::mSVGLineEdit_textEdited(
const QString &text )
2401 QFileInfo fi( text );
2411 void QgsSVGFillSymbolLayerWidget::mSVGLineEdit_editingFinished()
2418 QFileInfo fi( mSVGLineEdit->text() );
2421 QUrl url( mSVGLineEdit->text() );
2422 if ( !url.isValid() )
2428 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
2430 QApplication::restoreOverrideCursor();
2436 void QgsSVGFillSymbolLayerWidget::setFile(
const QModelIndex &item )
2438 QString file = item.data( Qt::UserRole ).toString();
2440 mSVGLineEdit->setText( file );
2448 QAbstractItemModel *oldModel = mSvgTreeView->model();
2450 mSvgTreeView->setModel( g );
2454 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
2455 for (
int i = 0; i < rows; i++ )
2457 mSvgTreeView->setExpanded( g->indexFromItem( g->item( i ) ),
true );
2460 oldModel = mSvgListView->model();
2462 mSvgListView->setModel( m );
2466 void QgsSVGFillSymbolLayerWidget::populateIcons(
const QModelIndex &idx )
2468 QString path = idx.data( Qt::UserRole + 1 ).toString();
2470 QAbstractItemModel *oldModel = mSvgListView->model();
2472 mSvgListView->setModel( m );
2475 connect( mSvgListView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSVGFillSymbolLayerWidget::setFile );
2479 void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2491 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2492 QColor defaultFill, defaultStroke;
2493 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2494 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2496 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2497 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2498 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2499 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2502 QColor fill = mChangeColorButton->color();
2503 double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2504 if ( hasDefaultFillColor )
2508 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2509 mChangeColorButton->setColor( fill );
2511 mChangeColorButton->setEnabled( hasFillParam );
2512 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2515 QColor stroke = mChangeStrokeColorButton->color();
2516 double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2517 if ( hasDefaultStrokeColor )
2519 stroke = defaultStroke;
2521 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2522 mChangeStrokeColorButton->setColor( stroke );
2524 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2525 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2526 if ( hasDefaultStrokeWidth && resetValues )
2528 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2530 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2533 void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2544 void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2555 void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2564 void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
2574 void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
2590 connect( mAngleSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
2591 connect( mDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
2592 connect( mOffsetSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
2599 mOffsetSpinBox->setClearValue( 0 );
2600 mAngleSpinBox->setClearValue( 0 );
2605 if ( layer->
layerType() != QLatin1String(
"LinePatternFill" ) )
2614 mAngleSpinBox->blockSignals(
true );
2616 mAngleSpinBox->blockSignals(
false );
2617 mDistanceSpinBox->blockSignals(
true );
2619 mDistanceSpinBox->blockSignals(
false );
2620 mOffsetSpinBox->blockSignals(
true );
2622 mOffsetSpinBox->blockSignals(
false );
2625 mDistanceUnitWidget->blockSignals(
true );
2628 mDistanceUnitWidget->blockSignals(
false );
2629 mOffsetUnitWidget->blockSignals(
true );
2632 mOffsetUnitWidget->blockSignals(
false );
2644 void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
2653 void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
2662 void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
2671 void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
2681 void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
2697 connect( mHorizontalDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
2698 connect( mVerticalDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
2699 connect( mHorizontalDisplacementSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
2700 connect( mVerticalDisplacementSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
2701 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
2702 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
2703 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
2704 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
2718 if ( !layer || layer->
layerType() != QLatin1String(
"PointPatternFill" ) )
2724 mHorizontalDistanceSpinBox->blockSignals(
true );
2726 mHorizontalDistanceSpinBox->blockSignals(
false );
2727 mVerticalDistanceSpinBox->blockSignals(
true );
2729 mVerticalDistanceSpinBox->blockSignals(
false );
2730 mHorizontalDisplacementSpinBox->blockSignals(
true );
2732 mHorizontalDisplacementSpinBox->blockSignals(
false );
2733 mVerticalDisplacementSpinBox->blockSignals(
true );
2735 mVerticalDisplacementSpinBox->blockSignals(
false );
2737 mHorizontalDistanceUnitWidget->blockSignals(
true );
2740 mHorizontalDistanceUnitWidget->blockSignals(
false );
2741 mVerticalDistanceUnitWidget->blockSignals(
true );
2744 mVerticalDistanceUnitWidget->blockSignals(
false );
2745 mHorizontalDisplacementUnitWidget->blockSignals(
true );
2748 mHorizontalDisplacementUnitWidget->blockSignals(
false );
2749 mVerticalDisplacementUnitWidget->blockSignals(
true );
2752 mVerticalDisplacementUnitWidget->blockSignals(
false );
2765 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
2774 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
2783 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
2792 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
2801 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
2811 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
2821 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
2831 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
2852 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2853 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2854 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2864 btnColor->setAllowOpacity(
true );
2865 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
2866 btnColor->setContext( QStringLiteral(
"symbology" ) );
2867 btnStrokeColor->setAllowOpacity(
true );
2868 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
2869 btnStrokeColor->setContext( QStringLiteral(
"symbology" ) );
2871 spinOffsetX->setClearValue( 0.0 );
2872 spinOffsetY->setClearValue( 0.0 );
2873 spinAngle->setClearValue( 0.0 );
2879 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
2883 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
2886 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
2888 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
2889 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
2896 if ( layer->
layerType() != QLatin1String(
"FontMarker" ) )
2920 mSizeUnitWidget->blockSignals(
true );
2923 mSizeUnitWidget->blockSignals(
false );
2925 mStrokeWidthUnitWidget->blockSignals(
true );
2928 mStrokeWidthUnitWidget->blockSignals(
false );
2930 mOffsetUnitWidget->blockSignals(
true );
2933 mOffsetUnitWidget->blockSignals(
false );
2952 updateAssistantSymbol();
2998 void QgsFontMarkerSymbolLayerWidget::setOffset()
3000 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3004 void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3010 void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3020 void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3030 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3040 void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3049 void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3058 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3067 void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3069 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
3071 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3073 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
3076 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3088 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3089 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3094 if ( layer->
layerType() != QLatin1String(
"CentroidFill" ) )
3110 void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3116 void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3129 connect( mBrowseToolButton, &QToolButton::clicked,
this, &QgsRasterFillSymbolLayerWidget::mBrowseToolButton_clicked );
3130 connect( mImageLineEdit, &QLineEdit::editingFinished,
this, &QgsRasterFillSymbolLayerWidget::mImageLineEdit_editingFinished );
3132 connect( mRotationSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
3134 connect( mWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged );
3141 mSpinOffsetX->setClearValue( 0.0 );
3142 mSpinOffsetY->setClearValue( 0.0 );
3143 mRotationSpinBox->setClearValue( 0.0 );
3145 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
3146 connect( mSpinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3147 connect( mSpinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3159 if ( layer->
layerType() != QLatin1String(
"RasterFill" ) )
3170 mImageLineEdit->blockSignals(
true );
3172 mImageLineEdit->blockSignals(
false );
3174 cboCoordinateMode->blockSignals(
true );
3178 cboCoordinateMode->setCurrentIndex( 1 );
3182 cboCoordinateMode->setCurrentIndex( 0 );
3185 cboCoordinateMode->blockSignals(
false );
3186 mOpacityWidget->blockSignals(
true );
3188 mOpacityWidget->blockSignals(
false );
3189 mRotationSpinBox->blockSignals(
true );
3191 mRotationSpinBox->blockSignals(
false );
3193 mSpinOffsetX->blockSignals(
true );
3195 mSpinOffsetX->blockSignals(
false );
3196 mSpinOffsetY->blockSignals(
true );
3198 mSpinOffsetY->blockSignals(
false );
3199 mOffsetUnitWidget->blockSignals(
true );
3202 mOffsetUnitWidget->blockSignals(
false );
3204 mWidthSpinBox->blockSignals(
true );
3206 mWidthSpinBox->blockSignals(
false );
3207 mWidthUnitWidget->blockSignals(
true );
3210 mWidthUnitWidget->blockSignals(
false );
3211 updatePreviewImage();
3224 void QgsRasterFillSymbolLayerWidget::mBrowseToolButton_clicked()
3228 QString lineEditText = mImageLineEdit->text();
3229 if ( !lineEditText.isEmpty() )
3231 QFileInfo openDirFileInfo( lineEditText );
3232 openDir = openDirFileInfo.path();
3235 if ( openDir.isEmpty() )
3237 openDir = s.
value( QStringLiteral(
"/UI/lastRasterFillImageDir" ), QDir::homePath() ).toString();
3241 QString filePath = QFileDialog::getOpenFileName(
nullptr, tr(
"Select Image File" ), openDir );
3242 if ( !filePath.isNull() )
3245 QFileInfo fileInfo( filePath );
3246 if ( !fileInfo.exists() || !fileInfo.isReadable() )
3248 QMessageBox::critical(
nullptr, QStringLiteral(
"Select Image File" ), QStringLiteral(
"Error, file does not exist or is not readable." ) );
3252 s.
setValue( QStringLiteral(
"/UI/lastRasterFillImageDir" ), fileInfo.absolutePath() );
3253 mImageLineEdit->setText( filePath );
3254 mImageLineEdit_editingFinished();
3258 void QgsRasterFillSymbolLayerWidget::mImageLineEdit_editingFinished()
3265 QFileInfo fi( mImageLineEdit->text() );
3268 QUrl url( mImageLineEdit->text() );
3269 if ( !url.isValid() )
3275 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
3277 updatePreviewImage();
3278 QApplication::restoreOverrideCursor();
3283 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
3300 void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
3309 updatePreviewImage();
3312 void QgsRasterFillSymbolLayerWidget::offsetChanged()
3314 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
3318 void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3329 void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
3338 void QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed()
3349 void QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged(
double d )
3360 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
3368 if ( image.isNull() )
3370 mLabelImagePreview->setPixmap( QPixmap() );
3374 if ( image.height() > 150 || image.width() > 150 )
3376 image = image.scaled( 150, 150, Qt::KeepAspectRatio, Qt::SmoothTransformation );
3379 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3380 previewImage.fill( Qt::transparent );
3381 QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3383 p.begin( &previewImage );
3385 uchar pixDataRGB[] = { 150, 150, 150, 150,
3390 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3391 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3392 QBrush checkerBrush;
3393 checkerBrush.setTexture( pix );
3394 p.fillRect( imageRect, checkerBrush );
3401 p.drawImage( imageRect.left(), imageRect.top(), image );
3403 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3412 modificationExpressionSelector->setMultiLine(
true );
3413 modificationExpressionSelector->setLayer( const_cast<QgsVectorLayer *>( vl ) );
3414 modificationExpressionSelector->registerExpressionContextGenerator(
this );
3419 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
3426 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData( mLayer->
symbolType() ) );
3434 void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
3441 void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
3443 mLayer->
setSymbolType( static_cast<QgsSymbol::SymbolType>( cbxGeometryType->currentData().toInt() ) );
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
const QgsMapUnitScale & intervalMapUnitScale() const
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
void setSvgStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
double interval() const
Returns the interval between individual markers.
QgsUnitTypes::RenderUnit customDashPatternUnit() const
Returns the units for lengths used in the custom dash pattern.
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
Meters value as Map units.
void setDistance(double d)
Sets the distance between lines in the fill pattern.
Single variable definition for use within a QgsExpressionContextScope.
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
Gradient reference point 1 is centroid.
const QgsMapUnitScale & displacementYMapUnitScale() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's offset.
void setMapUnitScale(const QgsMapUnitScale &scale) override
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the marker's stroke join style (e.g., miter, bevel, etc).
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Set stroke width map unit scale.
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp used for the gradient fill.
QString svgFilePath() const
void setPatternWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the width of the SVG images in the pattern.
QColor strokeColor() const override
Gets stroke color.
Gradient reference point 1 x.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the fill's offset.
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
QgsUnitTypes::RenderUnit distanceUnit() const
Returns the units for the distance between lines in the fill pattern.
void setSvgFillColor(const QColor &c)
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
QString fontFamily() const
void setUseCustomDashPattern(bool b)
A model for displaying SVG files with a preview icon.
const QgsMapUnitScale & displacementXMapUnitScale() const
static const double UI_SCALE_FACTOR
UI scaling factor.
This class is a composition of two QSettings instances:
bool exists(const QgsPropertyDefinition &definition) const
Returns true if the property is stored in the layer already, false otherwise.
QString imageFilePath() const
The path to the raster image used for the fill.
QPointF offset() const
Returns the offset for the shapeburst fill.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit u)
Sets the unit for the width of the marker's stroke.
void setStrokeStyle(Qt::PenStyle strokeStyle)
Sets the marker's stroke style (e.g., solid, dashed, etc)
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke...
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
virtual void setWidth(double width)
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient. Controls how the gradient stops are positioned.
const QgsMapUnitScale & offsetMapUnitScale() const
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
QgsFontMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setReferencePoint1IsCentroid(bool isCentroid)
Sets the starting point of the gradient to be the feature centroid.
Qt::PenJoinStyle penJoinStyle() const
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line pattern's offset.
GradientSpread gradientSpread() const
Gradient spread mode. Controls how the gradient behaves outside of the predefined stops...
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.
QString geometryExpression() const
Gets the expression to generate this geometry.
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp used to draw the shapeburst fill.
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the image's width.
void setDisplacementYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical displacement between rows in the pattern.
void setOffset(QPointF offset)
Sets the offset for the shapeburst fill.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
QgsUnitTypes::RenderUnit patternWidthUnit() const
Returns the units for the width of the SVG images in the pattern.
void setAngle(double angle)
Abstract base class for color ramps.
void setRotateMarker(bool rotate)
Shall the marker be rotated.
void setUseWholeShape(bool useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
void setStrokeColor(const QColor &color) override
Sets the marker's stroke color.
void setDistanceUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
const QgsMapUnitScale & strokeWidthMapUnitScale() const
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
void setStrokeColor(const QColor &c) override
Set stroke color.
void setStrokeWidth(double w)
Sets the width of the marker's stroke.
void setDistanceUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the distance between lines in the fill pattern.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's offset.
void setStrokeWidth(double width)
Set stroke width.
VerticalAnchorPoint verticalAnchorPoint() const
Returns the vertical anchor point for positioning the symbol.
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
void setOffsetUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units for the fill's offset.
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the symbol's offset.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line's offset.
QColor strokeColor() const override
Returns the marker's stroke color.
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for markers...
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
void setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
const QgsMapUnitScale & svgStrokeWidthMapUnitScale() const
static QString encodeShape(QgsSimpleMarkerSymbolLayerBase::Shape shape)
Encodes a shape to its string representation.
void setPointOnAllParts(bool pointOnAllParts)
Sets whether a point is drawn for all parts or only on the biggest part of multi-part features...
QPointF referencePoint1() const
Qt::PenJoinStyle penJoinStyle() const
Gets stroke join style.
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
Shapeburst use whole shape.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
virtual double width() const
bool rotateMarker() const
Shall the marker be rotated.
Name, eg shape name for simple markers.
void setStrokeWidth(double strokeWidth)
void setPatternWidth(double width)
void setWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line's width.
Gradient reference point 2 y.
static QList< QgsSimpleMarkerSymbolLayerBase::Shape > availableShapes()
Returns a list of all available shape types.
QString path() const
Returns the marker SVG path.
QColor strokeColor() const override
Gets stroke color.
void setGradientType(GradientType gradientType)
void setInterval(double interval)
Sets the interval between individual markers.
void setPenJoinStyle(Qt::PenJoinStyle style)
Set stroke join style.
static QIcon symbolLayerPreviewIcon(QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
Draws a symbol layer preview to an icon.
double strokeWidth() const
Returns the width of the marker's stroke.
const QgsMapUnitScale & offsetMapUnitScale() const
void setPath(const QString &path)
Set the marker SVG path.
void setCustomDashPatternUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for lengths used in the custom dash pattern.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line pattern's offset.
void setCoordinateMode(FillCoordinateMode mode)
Set the coordinate mode for fill.
virtual void setColor(const QColor &color)
The fill color.
void setOffset(QPointF offset)
void setBlurRadius(int blurRadius)
Sets the blur radius, which controls the amount of blurring applied to the fill.
double offsetAlongLine() const
Returns the offset along the line for the marker placement.
QPointF referencePoint2() const
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Gets stroke width unit.
HorizontalAnchorPoint horizontalAnchorPoint() const
Returns the horizontal anchor point for positioning the symbol.
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
A dialog to create a new auxiliary layer.
void setField(const QString &field)
Sets the field name the property references.
void setLineAngle(double a)
const QgsMapUnitScale & distanceMapUnitScale() const
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the stroke width.
void setImageFilePath(const QString &imagePath)
Sets the path to the raster image used for the fill.
double strokeWidth() const
A class for filling symbols with a repeated raster image.
void setPlacement(Placement p)
The placement of the markers.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
A dialog to enter a custom dash space pattern for lines.
void setStrokeColor(const QColor &color) override
Set stroke color.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setColor2(const QColor &color2)
Sets the color for the endpoint of the shapeburst fill.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
void setColor(const QColor &color) override
The fill color.
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
QgsUnitTypes::RenderUnit displacementYUnit() const
Returns the units for the vertical displacement between rows in the pattern.
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the line's width.
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the width of the marker's stroke.
QVector< qreal > customDashVector() const
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
void setSvgStrokeWidth(double w)
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Gets stroke width map unit scale.
Gradient coordinate mode.
double size() const
Returns the symbol size.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the map scale for the width of the marker's stroke.
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides...
void setSize(double size)
Sets the symbol size.
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
double displacementX() const
points (e.g., for font sizes)
const QgsMapUnitScale & offsetMapUnitScale() const
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's size.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
void setStrokeStyle(Qt::PenStyle strokeStyle)
virtual QColor color() const
The fill color.
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
QColor fillColor() const override
Gets fill color.
Filename, eg for svg files.
bool referencePoint2IsCentroid() const
void setSymbolType(QgsSymbol::SymbolType symbolType)
Set the type of symbol which should be created.
double strokeWidth() const
void setStrokeWidth(double w)
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Set stroke width unit.
Shapeburst fill from edge distance.
void setCharacter(QChar ch)
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
QgsUnitTypes::RenderUnit offsetUnit() const
Qt::PenJoinStyle penJoinStyle() const
Character, eg for font marker symbol layers.
Qt::PenJoinStyle penJoinStyle() const
Returns the marker's stroke join style (e.g., miter, bevel, etc).
void setPenJoinStyle(Qt::PenJoinStyle style)
bool useCustomDashPattern() const
QgsSimpleMarkerSymbolLayerBase::Shape shape() const
Returns the shape for the rendered marker symbol.
Single scope for storing variables and functions for use within a QgsExpressionContext.
A store for object properties.
QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const
Returns the units for the stroke width.
QColor svgStrokeColor() const
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for markers...
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
void setOffset(QPointF offset)
Sets the offset for the fill.
void setPenStyle(Qt::PenStyle style)
void setMapUnitScale(const QgsMapUnitScale &scale) override
Qt::PenStyle strokeStyle() const
Returns the marker's stroke style (e.g., solid, dashed, etc)
Definition for a property.
HorizontalAnchorPoint
Symbol horizontal anchor points.
void setSvgStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the stroke width.
Gradient reference point 1 y.
void setStrokeColor(const QColor &strokeColor) override
Set stroke color.
void setOffsetAlongLineUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit used for calculating the offset along line for markers.
void setOffset(QPointF offset)
Offset for gradient fill.
VerticalAnchorPoint
Symbol vertical anchor points.
void expressionChanged(const QString &expression)
Emitted when the expression is changed.
void setDistanceXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal distance between points in the pattern.
void setPenCapStyle(Qt::PenCapStyle style)
void setDisplacementY(double d)
const double DEFAULT_POINT_SIZE
Magic number that determines the default point size for point symbols.
void containsParams(const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasStrokeParam, QColor &defaultStrokeColor, bool &hasStrokeWidthParam, double &defaultStrokeWidth) const
Tests if an svg file contains parameters for fill, stroke color, stroke width.
QgsUnitTypes::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for markers.
Qt::BrushStyle brushStyle() const
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
GradientType gradientType() const
Type of gradient, e.g., linear or radial.
const QgsMapUnitScale & distanceMapUnitScale() const
A model for displaying SVG search paths.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's size.
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
A class for svg fill patterns.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Stroke style (eg solid, dashed)
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the unit for the width of the marker's stroke.
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
QgsSimpleLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setShape(QgsSimpleMarkerSymbolLayerBase::Shape shape)
Sets the rendered marker shape.
bool drawInsidePolygon() const
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
void setGradientColorType(GradientColorType gradientColorType)
QColor svgFillColor() const
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0...
void setWidthUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units for the image's width.
QgsSvgMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
QgsSimpleMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
QgsUnitTypes::RenderUnit distanceXUnit() const
Returns the units for the horizontal distance between points in the pattern.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
QgsUnitTypes::RenderUnit displacementXUnit() const
Returns the units for the horizontal displacement between rows in the pattern.
const QgsMapUnitScale & distanceXMapUnitScale() const
Shape
Marker symbol shapes.
const QgsMapUnitScale & patternWidthMapUnitScale() const
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
void setSvgFilePath(const QString &svgPath)
Qt::PenStyle penStyle() const
Qt::PenStyle strokeStyle() const
const QgsMapUnitScale & offsetMapUnitScale() const
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the width of the fill's stroke.
double strokeWidth() const
Gets stroke width.
void setIntervalUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the interval between markers.
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line's offset.
const QgsMapUnitScale & distanceYMapUnitScale() const
QColor fillColor() const override
Gets fill color.
FillCoordinateMode coordinateMode() const
Coordinate mode for fill.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
bool pointOnSurface() const
double patternWidth() const
const QgsMapUnitScale & widthMapUnitScale() const
Returns the map unit scale for the image's width.
void setDisplacementXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal displacement between rows in the pattern.
void setDistanceY(double d)
QgsSymbol::SymbolType symbolType() const
Access the symbol type.
Secondary color (eg for gradient fills)
void setDrawInsidePolygon(bool drawInsidePolygon)
double maxDistance() const
Returns the maximum distance from the shape's boundary which is shaded.
bool referencePoint1IsCentroid() const
void setCustomDashVector(const QVector< qreal > &vector)
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the stroke width.
void setFontFamily(const QString &family)
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
bool pointOnAllParts() const
Returns whether a point is drawn for all parts or only on the biggest part of multi-part features...
void setMaxDistance(double maxDistance)
Sets the maximum distance to shape inside of the shape from the polygon's boundary.
double opacity() const
Returns the opacity for the raster image used in the fill.
void setColor2(const QColor &color2)
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
void setAngle(double angle)
Sets the rotation angle for the marker.
const QgsMapUnitScale & widthMapUnitScale() const
const QgsMapUnitScale & customDashPatternMapUnitScale() const
void setDistanceX(double d)
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setBrushStyle(Qt::BrushStyle style)
QgsColorRamp * colorRamp()
Returns the color ramp used for the gradient fill.
double svgStrokeWidth() const
void setFillColor(const QColor &color) override
Set fill color.
static bool shapeIsFilled(QgsSimpleMarkerSymbolLayerBase::Shape shape)
Returns true if a symbol shape has a fill.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
QColor strokeColor() const override
Gets stroke color.
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the marker placement.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the offset for the shapeburst fill.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
void setOffset(double offset)
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the width of the fill's stroke.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setOpacity(double opacity)
Sets the opacity for the raster image used in the fill.
void setSvgStrokeColor(const QColor &c)
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Units for gradient fill offset.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
double distance() const
Returns the distance between lines in the fill pattern.
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
Placement placement() const
The placement of the markers.
void setColorType(ShapeburstColorType colorType)
Sets the color mode to use for the shapeburst fill.
Fill style (eg solid, dots)
Represents a vector layer which manages a vector based data sets.
void setDistanceYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical distance between points in the pattern.
double displacementY() const
Qt::PenCapStyle penCapStyle() const
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the symbol's offset.
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
void setDisplacementX(double d)
double width() const
Returns the width used for scaling the image used in the fill.
QgsColorRamp * colorRamp()
Returns the color ramp used for the shapeburst fill.
QgsFilledMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
QgsUnitTypes::RenderUnit intervalUnit() const
Returns the units for the interval between markers.
const QgsMapUnitScale & offsetMapUnitScale() const
Gradient reference point 2 is centroid.
void setGradientSpread(GradientSpread gradientSpread)
void setCoordinateMode(GradientCoordinateMode coordinateMode)
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
QgsPropertyDefinition propertyDefinition() const
Returns the underlying property definition.
Gradient reference point 2 x.
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
QgsUnitTypes::RenderUnit distanceYUnit() const
Returns the units for the vertical distance between points in the pattern.
Property
Data definable properties.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
void setPenJoinStyle(Qt::PenJoinStyle style)
A dialog to create a new auxiliary field.
void setPointOnSurface(bool pointOnSurface)
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer...
void setOffset(double offset)
Horizontal distance between points.
QPointF offset() const
Returns the offset for the fill.
virtual QString layerType() const =0
Returns a string that represents this layer type.
QgsUnitTypes::RenderUnit distanceUnit() const
Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
Vertical distance between points.