47 #include <QAbstractButton> 48 #include <QButtonGroup> 49 #include <QColorDialog> 52 #include <QFileDialog> 54 #include <QStandardItemModel> 55 #include <QSvgRenderer> 56 #include <QMessageBox> 59 #include <QInputDialog> 75 expContext << symbolScope;
88 expContext.setOriginalValueVariable( QVariant() );
108 if ( ddButton->assistant() )
109 ddButton->assistant()->setMapCanvas( mContext.
mapCanvas() );
128 void QgsSymbolLayerWidget::createAuxiliaryField()
149 if ( dlg.exec() == QDialog::Accepted )
160 property.setActive(
true );
182 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
183 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
187 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
195 btnChangeColor->setAllowOpacity(
true );
196 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
197 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
199 mColorDDBtn->registerLinkedWidget( btnChangeColor );
204 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
208 mLayer->
setRingFilter( static_cast< QgsLineSymbolLayer::RenderRingFilter >( mRingFilterComboBox->currentData().toInt() ) );
213 spinOffset->setClearValue( 0.0 );
218 mDrawInsideCheckBox->hide();
219 mRingFilterComboBox->hide();
227 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
229 connect( spinWidth, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
231 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
232 connect( spinOffset, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
233 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
234 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
241 void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
243 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
245 mAssistantPreviewSymbol->deleteSymbolLayer( i );
247 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
250 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
256 if ( !layer || layer->
layerType() != QLatin1String(
"SimpleLine" ) )
263 mPenWidthUnitWidget->blockSignals(
true );
266 mPenWidthUnitWidget->blockSignals(
false );
267 mOffsetUnitWidget->blockSignals(
true );
270 mOffsetUnitWidget->blockSignals(
false );
271 mDashPatternUnitWidget->blockSignals(
true );
275 mDashPatternUnitWidget->blockSignals(
false );
278 spinWidth->blockSignals(
true );
280 spinWidth->blockSignals(
false );
281 btnChangeColor->blockSignals(
true );
283 btnChangeColor->blockSignals(
false );
284 spinOffset->blockSignals(
true );
286 spinOffset->blockSignals(
false );
287 cboPenStyle->blockSignals(
true );
288 cboJoinStyle->blockSignals(
true );
289 cboCapStyle->blockSignals(
true );
293 cboPenStyle->blockSignals(
false );
294 cboJoinStyle->blockSignals(
false );
295 cboCapStyle->blockSignals(
false );
299 mChangePatternButton->setEnabled( useCustomDashPattern );
300 label_3->setEnabled( !useCustomDashPattern );
301 cboPenStyle->setEnabled( !useCustomDashPattern );
302 mCustomCheckBox->blockSignals(
true );
303 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
304 mCustomCheckBox->blockSignals(
false );
308 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
322 updateAssistantSymbol();
330 void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
337 void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
344 void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
352 void QgsSimpleLineSymbolLayerWidget::offsetChanged()
359 void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
361 bool checked = ( state == Qt::Checked );
362 mChangePatternButton->setEnabled( checked );
363 label_3->setEnabled( !checked );
364 cboPenStyle->setEnabled( !checked );
370 void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
373 if ( d.exec() == QDialog::Accepted )
381 void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
391 void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
401 void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
411 void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
413 bool checked = ( state == Qt::Checked );
432 mChangePatternButton->setIcon( buttonIcon );
449 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
450 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
451 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
452 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
460 btnChangeColorFill->setAllowOpacity(
true );
461 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
462 btnChangeColorFill->setContext( QStringLiteral(
"symbology" ) );
463 btnChangeColorFill->setShowNoColor(
true );
464 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
465 btnChangeColorStroke->setAllowOpacity(
true );
466 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
467 btnChangeColorStroke->setContext( QStringLiteral(
"symbology" ) );
468 btnChangeColorStroke->setShowNoColor(
true );
469 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
471 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
472 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
474 spinOffsetX->setClearValue( 0.0 );
475 spinOffsetY->setClearValue( 0.0 );
476 spinAngle->setClearValue( 0.0 );
482 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
484 int size = lstNames->iconSize().width();
485 size = std::max( 30, static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width( QStringLiteral(
"XXX" ) ) ) ) );
486 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
487 lstNames->setIconSize( QSize( size, size ) );
489 double markerSize = size * 0.8;
494 lyr->
setColor( QColor( 200, 200, 200 ) );
497 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
498 item->setData( Qt::UserRole, static_cast< int >( shape ) );
503 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
505 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
508 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
509 connect( spinSize, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
510 connect( spinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
511 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
512 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
518 if ( layer->
layerType() != QLatin1String(
"SimpleMarker" ) )
526 for (
int i = 0; i < lstNames->count(); ++i )
528 if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
530 lstNames->setCurrentRow( i );
534 btnChangeColorStroke->blockSignals(
true );
536 btnChangeColorStroke->blockSignals(
false );
537 btnChangeColorFill->blockSignals(
true );
540 btnChangeColorFill->blockSignals(
false );
541 spinSize->blockSignals(
true );
543 spinSize->blockSignals(
false );
544 spinAngle->blockSignals(
true );
546 spinAngle->blockSignals(
false );
547 mStrokeStyleComboBox->blockSignals(
true );
549 mStrokeStyleComboBox->blockSignals(
false );
550 mStrokeWidthSpinBox->blockSignals(
true );
552 mStrokeWidthSpinBox->blockSignals(
false );
553 cboJoinStyle->blockSignals(
true );
555 cboJoinStyle->blockSignals(
false );
558 spinOffsetX->blockSignals(
true );
560 spinOffsetX->blockSignals(
false );
561 spinOffsetY->blockSignals(
true );
563 spinOffsetY->blockSignals(
false );
565 mSizeUnitWidget->blockSignals(
true );
568 mSizeUnitWidget->blockSignals(
false );
569 mOffsetUnitWidget->blockSignals(
true );
572 mOffsetUnitWidget->blockSignals(
false );
573 mStrokeWidthUnitWidget->blockSignals(
true );
576 mStrokeWidthUnitWidget->blockSignals(
false );
579 mHorizontalAnchorComboBox->blockSignals(
true );
580 mVerticalAnchorComboBox->blockSignals(
true );
583 mHorizontalAnchorComboBox->blockSignals(
false );
584 mVerticalAnchorComboBox->blockSignals(
false );
598 updateAssistantSymbol();
606 void QgsSimpleMarkerSymbolLayerWidget::setShape()
608 mLayer->
setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
625 void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
631 void QgsSimpleMarkerSymbolLayerWidget::setSize()
637 void QgsSimpleMarkerSymbolLayerWidget::setAngle()
643 void QgsSimpleMarkerSymbolLayerWidget::setOffset()
645 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
649 void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
660 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
669 void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
679 void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
689 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
699 void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
708 void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
717 void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
719 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
721 mAssistantPreviewSymbol->deleteSymbolLayer( i );
723 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
726 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
745 btnChangeColor->setAllowOpacity(
true );
746 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
747 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
748 btnChangeColor->setShowNoColor(
true );
749 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
750 btnChangeStrokeColor->setAllowOpacity(
true );
751 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
752 btnChangeStrokeColor->setContext( QStringLiteral(
"symbology" ) );
753 btnChangeStrokeColor->setShowNoColor(
true );
754 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
756 spinOffsetX->setClearValue( 0.0 );
757 spinOffsetY->setClearValue( 0.0 );
760 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
762 connect( spinStrokeWidth, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
763 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
764 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
765 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
766 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
768 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
769 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
774 if ( layer->
layerType() != QLatin1String(
"SimpleFill" ) )
781 btnChangeColor->blockSignals(
true );
783 btnChangeColor->blockSignals(
false );
784 cboFillStyle->blockSignals(
true );
786 cboFillStyle->blockSignals(
false );
787 btnChangeStrokeColor->blockSignals(
true );
789 btnChangeStrokeColor->blockSignals(
false );
790 cboStrokeStyle->blockSignals(
true );
792 cboStrokeStyle->blockSignals(
false );
793 spinStrokeWidth->blockSignals(
true );
795 spinStrokeWidth->blockSignals(
false );
796 cboJoinStyle->blockSignals(
true );
798 cboJoinStyle->blockSignals(
false );
799 spinOffsetX->blockSignals(
true );
801 spinOffsetX->blockSignals(
false );
802 spinOffsetY->blockSignals(
true );
804 spinOffsetY->blockSignals(
false );
806 mStrokeWidthUnitWidget->blockSignals(
true );
809 mStrokeWidthUnitWidget->blockSignals(
false );
810 mOffsetUnitWidget->blockSignals(
true );
813 mOffsetUnitWidget->blockSignals(
false );
841 void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
847 void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
853 void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
860 void QgsSimpleFillSymbolLayerWidget::offsetChanged()
862 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
866 void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
876 void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
896 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
897 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
903 spinOffsetX->setClearValue( 0.0 );
904 spinOffsetY->setClearValue( 0.0 );
905 spinAngle->setClearValue( 0.0 );
911 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
913 QSize size = lstNames->iconSize();
921 lyr->
setColor( QColor( 200, 200, 200 ) );
924 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
925 item->setData( Qt::UserRole, static_cast< int >( shape ) );
930 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
931 connect( spinSize, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
932 connect( spinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
933 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
934 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
940 if ( layer->
layerType() != QLatin1String(
"FilledMarker" ) )
948 for (
int i = 0; i < lstNames->count(); ++i )
950 if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
952 lstNames->setCurrentRow( i );
961 mSizeUnitWidget->blockSignals(
true );
964 mSizeUnitWidget->blockSignals(
false );
965 mOffsetUnitWidget->blockSignals(
true );
968 mOffsetUnitWidget->blockSignals(
false );
981 updateAssistantSymbol();
989 void QgsFilledMarkerSymbolLayerWidget::setShape()
991 mLayer->
setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
995 void QgsFilledMarkerSymbolLayerWidget::setSize()
1001 void QgsFilledMarkerSymbolLayerWidget::setAngle()
1007 void QgsFilledMarkerSymbolLayerWidget::setOffset()
1009 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1013 void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1023 void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1033 void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
1042 void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
1051 void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1053 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1055 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1057 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1060 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1073 connect( mSpinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1077 btnColorRamp->setShowGradientOnly(
true );
1079 btnChangeColor->setAllowOpacity(
true );
1080 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1081 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1082 btnChangeColor->setShowNoColor(
true );
1083 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1084 btnChangeColor2->setAllowOpacity(
true );
1085 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1086 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1087 btnChangeColor2->setShowNoColor(
true );
1088 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1090 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1091 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1093 spinOffsetX->setClearValue( 0.0 );
1094 spinOffsetY->setClearValue( 0.0 );
1095 mSpinAngle->setClearValue( 0.0 );
1103 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1104 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1105 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1106 connect( spinRefPoint1X, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1107 connect( spinRefPoint1Y, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1108 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1109 connect( spinRefPoint2X, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1110 connect( spinRefPoint2Y, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1111 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1116 if ( layer->
layerType() != QLatin1String(
"GradientFill" ) )
1123 btnChangeColor->blockSignals(
true );
1125 btnChangeColor->blockSignals(
false );
1126 btnChangeColor2->blockSignals(
true );
1128 btnChangeColor2->blockSignals(
false );
1132 radioTwoColor->setChecked(
true );
1133 btnColorRamp->setEnabled(
false );
1137 radioColorRamp->setChecked(
true );
1138 btnChangeColor->setEnabled(
false );
1139 btnChangeColor2->setEnabled(
false );
1145 btnColorRamp->blockSignals(
true );
1147 btnColorRamp->blockSignals(
false );
1150 cboGradientType->blockSignals(
true );
1154 cboGradientType->setCurrentIndex( 0 );
1157 cboGradientType->setCurrentIndex( 1 );
1160 cboGradientType->setCurrentIndex( 2 );
1163 cboGradientType->blockSignals(
false );
1165 cboCoordinateMode->blockSignals(
true );
1169 cboCoordinateMode->setCurrentIndex( 1 );
1170 checkRefPoint1Centroid->setEnabled(
false );
1171 checkRefPoint2Centroid->setEnabled(
false );
1175 cboCoordinateMode->setCurrentIndex( 0 );
1178 cboCoordinateMode->blockSignals(
false );
1180 cboGradientSpread->blockSignals(
true );
1184 cboGradientSpread->setCurrentIndex( 0 );
1187 cboGradientSpread->setCurrentIndex( 1 );
1190 cboGradientSpread->setCurrentIndex( 2 );
1193 cboGradientSpread->blockSignals(
false );
1195 spinRefPoint1X->blockSignals(
true );
1197 spinRefPoint1X->blockSignals(
false );
1198 spinRefPoint1Y->blockSignals(
true );
1200 spinRefPoint1Y->blockSignals(
false );
1201 checkRefPoint1Centroid->blockSignals(
true );
1205 spinRefPoint1X->setEnabled(
false );
1206 spinRefPoint1Y->setEnabled(
false );
1208 checkRefPoint1Centroid->blockSignals(
false );
1209 spinRefPoint2X->blockSignals(
true );
1211 spinRefPoint2X->blockSignals(
false );
1212 spinRefPoint2Y->blockSignals(
true );
1214 spinRefPoint2Y->blockSignals(
false );
1215 checkRefPoint2Centroid->blockSignals(
true );
1219 spinRefPoint2X->setEnabled(
false );
1220 spinRefPoint2Y->setEnabled(
false );
1222 checkRefPoint2Centroid->blockSignals(
false );
1224 spinOffsetX->blockSignals(
true );
1226 spinOffsetX->blockSignals(
false );
1227 spinOffsetY->blockSignals(
true );
1229 spinOffsetY->blockSignals(
false );
1230 mSpinAngle->blockSignals(
true );
1232 mSpinAngle->blockSignals(
false );
1234 mOffsetUnitWidget->blockSignals(
true );
1237 mOffsetUnitWidget->blockSignals(
false );
1270 void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1272 if ( radioTwoColor->isChecked() )
1285 if ( btnColorRamp->isNull() )
1299 spinRefPoint1X->setValue( 0.5 );
1300 spinRefPoint1Y->setValue( 0 );
1301 spinRefPoint2X->setValue( 0.5 );
1302 spinRefPoint2Y->setValue( 1 );
1307 spinRefPoint1X->setValue( 0 );
1308 spinRefPoint1Y->setValue( 0 );
1309 spinRefPoint2X->setValue( 1 );
1310 spinRefPoint2Y->setValue( 1 );
1314 spinRefPoint1X->setValue( 0.5 );
1315 spinRefPoint1Y->setValue( 0.5 );
1316 spinRefPoint2X->setValue( 1 );
1317 spinRefPoint2Y->setValue( 1 );
1332 checkRefPoint1Centroid->setEnabled(
true );
1333 checkRefPoint2Centroid->setEnabled(
true );
1339 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1340 checkRefPoint1Centroid->setEnabled(
false );
1341 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1342 checkRefPoint2Centroid->setEnabled(
false );
1367 void QgsGradientFillSymbolLayerWidget::offsetChanged()
1369 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1373 void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1382 void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1388 void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1406 connect( mSpinBlurRadius, qgis::overload< int >::of( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1407 connect( mSpinMaxDistance, qgis::overload< double >::of( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1409 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1411 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1417 QButtonGroup *group1 =
new QButtonGroup(
this );
1418 group1->addButton( radioColorRamp );
1419 group1->addButton( radioTwoColor );
1420 QButtonGroup *group2 =
new QButtonGroup(
this );
1421 group2->addButton( mRadioUseMaxDistance );
1422 group2->addButton( mRadioUseWholeShape );
1423 btnChangeColor->setAllowOpacity(
true );
1424 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1425 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1426 btnChangeColor->setShowNoColor(
true );
1427 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1428 btnChangeColor2->setAllowOpacity(
true );
1429 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1430 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1431 btnChangeColor2->setShowNoColor(
true );
1432 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1434 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1435 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1437 spinOffsetX->setClearValue( 0.0 );
1438 spinOffsetY->setClearValue( 0.0 );
1440 btnColorRamp->setShowGradientOnly(
true );
1446 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1447 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1448 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1450 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1451 connect( mSpinBlurRadius, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1456 if ( layer->
layerType() != QLatin1String(
"ShapeburstFill" ) )
1463 btnChangeColor->blockSignals(
true );
1465 btnChangeColor->blockSignals(
false );
1466 btnChangeColor2->blockSignals(
true );
1468 btnChangeColor2->blockSignals(
false );
1472 radioTwoColor->setChecked(
true );
1473 btnColorRamp->setEnabled(
false );
1477 radioColorRamp->setChecked(
true );
1478 btnChangeColor->setEnabled(
false );
1479 btnChangeColor2->setEnabled(
false );
1482 mSpinBlurRadius->blockSignals(
true );
1483 mBlurSlider->blockSignals(
true );
1486 mSpinBlurRadius->blockSignals(
false );
1487 mBlurSlider->blockSignals(
false );
1489 mSpinMaxDistance->blockSignals(
true );
1491 mSpinMaxDistance->blockSignals(
false );
1493 mRadioUseWholeShape->blockSignals(
true );
1494 mRadioUseMaxDistance->blockSignals(
true );
1497 mRadioUseWholeShape->setChecked(
true );
1498 mSpinMaxDistance->setEnabled(
false );
1499 mDistanceUnitWidget->setEnabled(
false );
1503 mRadioUseMaxDistance->setChecked(
true );
1504 mSpinMaxDistance->setEnabled(
true );
1505 mDistanceUnitWidget->setEnabled(
true );
1507 mRadioUseWholeShape->blockSignals(
false );
1508 mRadioUseMaxDistance->blockSignals(
false );
1510 mDistanceUnitWidget->blockSignals(
true );
1513 mDistanceUnitWidget->blockSignals(
false );
1515 mIgnoreRingsCheckBox->blockSignals(
true );
1516 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1517 mIgnoreRingsCheckBox->blockSignals(
false );
1522 btnColorRamp->blockSignals(
true );
1524 btnColorRamp->blockSignals(
false );
1527 spinOffsetX->blockSignals(
true );
1529 spinOffsetX->blockSignals(
false );
1530 spinOffsetY->blockSignals(
true );
1532 spinOffsetY->blockSignals(
false );
1533 mOffsetUnitWidget->blockSignals(
true );
1536 mOffsetUnitWidget->blockSignals(
false );
1569 void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1576 if ( radioTwoColor->isChecked() )
1587 void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1596 void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1605 void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1615 void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1620 mDistanceUnitWidget->setEnabled( !value );
1625 void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1635 void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1639 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1644 void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1655 void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1657 bool checked = ( state == Qt::Checked );
1683 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
1687 mLayer->
setRingFilter( static_cast< QgsLineSymbolLayer::RenderRingFilter >( mRingFilterComboBox->currentData().toInt() ) );
1692 spinOffset->setClearValue( 0.0 );
1697 mRingFilterComboBox->hide();
1698 mRingsLabel->hide();
1703 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1704 connect( spinOffset, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1705 connect( radInterval, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1706 connect( radVertex, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1707 connect( radVertexLast, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1708 connect( radVertexFirst, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1709 connect( radCentralPoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1710 connect( radCurvePoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1715 if ( layer->
layerType() != QLatin1String(
"MarkerLine" ) )
1722 spinInterval->blockSignals(
true );
1724 spinInterval->blockSignals(
false );
1725 mSpinOffsetAlongLine->blockSignals(
true );
1727 mSpinOffsetAlongLine->blockSignals(
false );
1728 chkRotateMarker->blockSignals(
true );
1730 chkRotateMarker->blockSignals(
false );
1731 spinOffset->blockSignals(
true );
1733 spinOffset->blockSignals(
false );
1735 radInterval->setChecked(
true );
1737 radVertex->setChecked(
true );
1739 radVertexLast->setChecked(
true );
1741 radCentralPoint->setChecked(
true );
1743 radCurvePoint->setChecked(
true );
1745 radVertexFirst->setChecked(
true );
1748 mIntervalUnitWidget->blockSignals(
true );
1751 mIntervalUnitWidget->blockSignals(
false );
1752 mOffsetUnitWidget->blockSignals(
true );
1755 mOffsetUnitWidget->blockSignals(
false );
1756 mOffsetAlongLineUnitWidget->blockSignals(
true );
1759 mOffsetAlongLineUnitWidget->blockSignals(
false );
1788 void QgsMarkerLineSymbolLayerWidget::setRotate()
1794 void QgsMarkerLineSymbolLayerWidget::setOffset()
1800 void QgsMarkerLineSymbolLayerWidget::setPlacement()
1802 bool interval = radInterval->isChecked();
1803 spinInterval->setEnabled( interval );
1804 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1806 if ( radInterval->isChecked() )
1808 else if ( radVertex->isChecked() )
1810 else if ( radVertexLast->isChecked() )
1812 else if ( radVertexFirst->isChecked() )
1814 else if ( radCurvePoint->isChecked() )
1822 void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
1832 void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
1842 void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
1862 mSvgSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastSVGMarkerDir" ) );
1866 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
1867 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
1871 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1872 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1879 viewGroups->setHeaderHidden(
true );
1880 mChangeColorButton->setAllowOpacity(
true );
1881 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
1882 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
1883 mChangeStrokeColorButton->setAllowOpacity(
true );
1884 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
1885 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
1887 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
1888 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
1890 spinOffsetX->setClearValue( 0.0 );
1891 spinOffsetY->setClearValue( 0.0 );
1892 spinAngle->setClearValue( 0.0 );
1894 mIconSize = std::max( 30, static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width( QStringLiteral(
"XXXX" ) ) ) ) );
1895 viewImages->setGridSize( QSize( mIconSize * 1.2, mIconSize * 1.2 ) );
1899 connect( viewImages->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSvgMarkerSymbolLayerWidget::setName );
1900 connect( viewGroups->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSvgMarkerSymbolLayerWidget::populateIcons );
1901 connect( spinWidth, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
1902 connect( spinHeight, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
1904 connect( spinAngle, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
1905 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
1906 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
1915 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
1916 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
1921 #include <QAbstractListModel> 1922 #include <QPixmapCache> 1928 QAbstractItemModel *oldModel = viewGroups->model();
1930 viewGroups->setModel( g );
1934 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
1935 for (
int i = 0; i < rows; i++ )
1937 viewGroups->setExpanded( g->indexFromItem( g->item( i ) ),
true );
1941 oldModel = viewImages->model();
1943 viewImages->setModel( m );
1947 void QgsSvgMarkerSymbolLayerWidget::populateIcons(
const QModelIndex &idx )
1949 QString path = idx.data( Qt::UserRole + 1 ).toString();
1951 QAbstractItemModel *oldModel = viewImages->model();
1953 viewImages->setModel( m );
1956 connect( viewImages->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSvgMarkerSymbolLayerWidget::setName );
1967 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
1968 QColor defaultFill, defaultStroke;
1969 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
1970 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
1972 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
1973 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
1974 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
1975 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
1976 mChangeColorButton->setEnabled( hasFillParam );
1977 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
1978 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
1979 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
1980 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
1985 double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
1986 if ( hasDefaultFillColor )
1990 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
1991 mChangeColorButton->setColor( fill );
1993 if ( hasStrokeParam )
1996 double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
1997 if ( hasDefaultStrokeColor )
1999 stroke = defaultStroke;
2001 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2002 mChangeStrokeColorButton->setColor( stroke );
2007 mStrokeWidthSpinBox->blockSignals(
true );
2008 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2009 mStrokeWidthSpinBox->blockSignals(
false );
2012 spinHeight->blockSignals(
true );
2013 if ( preservedAspectRatio )
2015 spinHeight->setValue( layer->
size() );
2022 spinHeight->blockSignals(
false );
2023 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2026 void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2028 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
2030 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2032 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
2035 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2046 if ( layer->
layerType() != QLatin1String(
"SvgMarker" ) )
2054 QAbstractItemModel *m = viewImages->model();
2055 QItemSelectionModel *selModel = viewImages->selectionModel();
2056 for (
int i = 0; i < m->rowCount(); i++ )
2058 QModelIndex idx( m->index( i, 0 ) );
2059 if ( m->data( idx ).toString() ==
mLayer->
path() )
2061 selModel->select( idx, QItemSelectionModel::SelectCurrent );
2062 selModel->setCurrentIndex( idx, QItemSelectionModel::SelectCurrent );
2068 spinWidth->blockSignals(
true );
2070 spinWidth->blockSignals(
false );
2071 spinAngle->blockSignals(
true );
2073 spinAngle->blockSignals(
false );
2076 spinOffsetX->blockSignals(
true );
2078 spinOffsetX->blockSignals(
false );
2079 spinOffsetY->blockSignals(
true );
2081 spinOffsetY->blockSignals(
false );
2083 mSizeUnitWidget->blockSignals(
true );
2086 mSizeUnitWidget->blockSignals(
false );
2087 mStrokeWidthUnitWidget->blockSignals(
true );
2090 mStrokeWidthUnitWidget->blockSignals(
false );
2091 mOffsetUnitWidget->blockSignals(
true );
2094 mOffsetUnitWidget->blockSignals(
false );
2097 mHorizontalAnchorComboBox->blockSignals(
true );
2098 mVerticalAnchorComboBox->blockSignals(
true );
2101 mHorizontalAnchorComboBox->blockSignals(
false );
2102 mVerticalAnchorComboBox->blockSignals(
false );
2117 updateAssistantSymbol();
2128 mSvgSourceLineEdit->setMessageBar( context.
messageBar() );
2131 void QgsSvgMarkerSymbolLayerWidget::setName(
const QModelIndex &idx )
2133 QString name = idx.data( Qt::UserRole ).toString();
2141 void QgsSvgMarkerSymbolLayerWidget::setWidth()
2144 double fixedAspectRatio = 0.0;
2145 spinHeight->blockSignals(
true );
2146 if ( defaultAspectRatio <= 0.0 )
2148 spinHeight->setValue( spinWidth->value() );
2150 else if ( mLockAspectRatio->locked() )
2152 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2156 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2158 spinHeight->blockSignals(
false );
2164 void QgsSvgMarkerSymbolLayerWidget::setHeight()
2167 double fixedAspectRatio = 0.0;
2168 spinWidth->blockSignals(
true );
2169 if ( defaultAspectRatio <= 0.0 )
2171 spinWidth->setValue( spinHeight->value() );
2173 else if ( mLockAspectRatio->locked() )
2175 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2179 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2181 spinWidth->blockSignals(
false );
2187 void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2191 if ( defaultAspectRatio <= 0.0 )
2207 void QgsSvgMarkerSymbolLayerWidget::setAngle()
2213 void QgsSvgMarkerSymbolLayerWidget::setOffset()
2215 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2219 void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2226 void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2237 void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2248 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2257 void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2267 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2277 void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2287 void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
2296 void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
2311 connect( mTextureWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2313 connect( mRotationSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2315 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2316 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2323 mSvgTreeView->setHeaderHidden(
true );
2326 mRotationSpinBox->setClearValue( 0.0 );
2328 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2329 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2330 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2331 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2333 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2334 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2336 connect( mSvgListView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSVGFillSymbolLayerWidget::setFile );
2337 connect( mSvgTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSVGFillSymbolLayerWidget::populateIcons );
2347 if ( layer->
layerType() != QLatin1String(
"SVGFill" ) )
2356 mTextureWidthSpinBox->blockSignals(
true );
2357 mTextureWidthSpinBox->setValue( width );
2358 mTextureWidthSpinBox->blockSignals(
false );
2360 mRotationSpinBox->blockSignals(
true );
2362 mRotationSpinBox->blockSignals(
false );
2363 mTextureWidthUnitWidget->blockSignals(
true );
2366 mTextureWidthUnitWidget->blockSignals(
false );
2367 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2370 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2371 mChangeColorButton->blockSignals(
true );
2373 mChangeColorButton->blockSignals(
false );
2374 mChangeStrokeColorButton->blockSignals(
true );
2376 mChangeStrokeColorButton->blockSignals(
false );
2377 mStrokeWidthSpinBox->blockSignals(
true );
2379 mStrokeWidthSpinBox->blockSignals(
false );
2399 mSvgSourceLineEdit->setMessageBar( context.
messageBar() );
2402 void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2411 void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2423 void QgsSVGFillSymbolLayerWidget::setFile(
const QModelIndex &item )
2425 QString file = item.data( Qt::UserRole ).toString();
2435 QAbstractItemModel *oldModel = mSvgTreeView->model();
2437 mSvgTreeView->setModel( g );
2441 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
2442 for (
int i = 0; i < rows; i++ )
2444 mSvgTreeView->setExpanded( g->indexFromItem( g->item( i ) ),
true );
2447 oldModel = mSvgListView->model();
2449 mSvgListView->setModel( m );
2453 void QgsSVGFillSymbolLayerWidget::populateIcons(
const QModelIndex &idx )
2455 QString path = idx.data( Qt::UserRole + 1 ).toString();
2457 QAbstractItemModel *oldModel = mSvgListView->model();
2459 mSvgListView->setModel( m );
2462 connect( mSvgListView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsSVGFillSymbolLayerWidget::setFile );
2466 void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2478 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2479 QColor defaultFill, defaultStroke;
2480 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2481 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2483 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2484 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2485 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2486 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2489 QColor fill = mChangeColorButton->color();
2490 double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2491 if ( hasDefaultFillColor )
2495 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2496 mChangeColorButton->setColor( fill );
2498 mChangeColorButton->setEnabled( hasFillParam );
2499 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2502 QColor stroke = mChangeStrokeColorButton->color();
2503 double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2504 if ( hasDefaultStrokeColor )
2506 stroke = defaultStroke;
2508 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2509 mChangeStrokeColorButton->setColor( stroke );
2511 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2512 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2513 if ( hasDefaultStrokeWidth && resetValues )
2515 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2517 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2520 void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2531 void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2542 void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2551 void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
2561 void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
2577 connect( mAngleSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
2578 connect( mDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
2579 connect( mOffsetSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
2586 mOffsetSpinBox->setClearValue( 0 );
2587 mAngleSpinBox->setClearValue( 0 );
2592 if ( layer->
layerType() != QLatin1String(
"LinePatternFill" ) )
2601 mAngleSpinBox->blockSignals(
true );
2603 mAngleSpinBox->blockSignals(
false );
2604 mDistanceSpinBox->blockSignals(
true );
2606 mDistanceSpinBox->blockSignals(
false );
2607 mOffsetSpinBox->blockSignals(
true );
2609 mOffsetSpinBox->blockSignals(
false );
2612 mDistanceUnitWidget->blockSignals(
true );
2615 mDistanceUnitWidget->blockSignals(
false );
2616 mOffsetUnitWidget->blockSignals(
true );
2619 mOffsetUnitWidget->blockSignals(
false );
2631 void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
2640 void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
2649 void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
2658 void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
2668 void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
2684 connect( mHorizontalDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
2685 connect( mVerticalDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
2686 connect( mHorizontalDisplacementSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
2687 connect( mVerticalDisplacementSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
2688 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
2689 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
2690 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
2691 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
2705 if ( !layer || layer->
layerType() != QLatin1String(
"PointPatternFill" ) )
2711 mHorizontalDistanceSpinBox->blockSignals(
true );
2713 mHorizontalDistanceSpinBox->blockSignals(
false );
2714 mVerticalDistanceSpinBox->blockSignals(
true );
2716 mVerticalDistanceSpinBox->blockSignals(
false );
2717 mHorizontalDisplacementSpinBox->blockSignals(
true );
2719 mHorizontalDisplacementSpinBox->blockSignals(
false );
2720 mVerticalDisplacementSpinBox->blockSignals(
true );
2722 mVerticalDisplacementSpinBox->blockSignals(
false );
2724 mHorizontalDistanceUnitWidget->blockSignals(
true );
2727 mHorizontalDistanceUnitWidget->blockSignals(
false );
2728 mVerticalDistanceUnitWidget->blockSignals(
true );
2731 mVerticalDistanceUnitWidget->blockSignals(
false );
2732 mHorizontalDisplacementUnitWidget->blockSignals(
true );
2735 mHorizontalDisplacementUnitWidget->blockSignals(
false );
2736 mVerticalDisplacementUnitWidget->blockSignals(
true );
2739 mVerticalDisplacementUnitWidget->blockSignals(
false );
2752 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
2761 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
2770 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
2779 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
2788 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
2798 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
2808 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
2818 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
2839 connect( mStrokeWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2840 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2841 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2851 btnColor->setAllowOpacity(
true );
2852 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
2853 btnColor->setContext( QStringLiteral(
"symbology" ) );
2854 btnStrokeColor->setAllowOpacity(
true );
2855 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
2856 btnStrokeColor->setContext( QStringLiteral(
"symbology" ) );
2858 mColorDDBtn->registerLinkedWidget( btnColor );
2859 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
2861 spinOffsetX->setClearValue( 0.0 );
2862 spinOffsetY->setClearValue( 0.0 );
2863 spinAngle->setClearValue( 0.0 );
2869 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
2873 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
2876 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
2878 connect( spinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
2879 connect( spinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
2886 if ( layer->
layerType() != QLatin1String(
"FontMarker" ) )
2910 mSizeUnitWidget->blockSignals(
true );
2913 mSizeUnitWidget->blockSignals(
false );
2915 mStrokeWidthUnitWidget->blockSignals(
true );
2918 mStrokeWidthUnitWidget->blockSignals(
false );
2920 mOffsetUnitWidget->blockSignals(
true );
2923 mOffsetUnitWidget->blockSignals(
false );
2942 updateAssistantSymbol();
2988 void QgsFontMarkerSymbolLayerWidget::setOffset()
2990 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2994 void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3000 void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3010 void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3020 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3030 void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3039 void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3048 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3057 void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3059 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
3061 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3063 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
3066 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3078 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3079 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3084 if ( layer->
layerType() != QLatin1String(
"CentroidFill" ) )
3100 void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3106 void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3121 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3125 connect( mRotationSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3127 connect( mWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3128 connect( mHeightSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3136 mSpinOffsetX->setClearValue( 0.0 );
3137 mSpinOffsetY->setClearValue( 0.0 );
3138 mRotationSpinBox->setClearValue( 0.0 );
3140 connect( mSpinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3141 connect( mSpinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3144 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3145 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3155 if ( layer->
layerType() != QLatin1String(
"RasterMarker" ) )
3166 mHeightSpinBox->blockSignals(
true );
3167 if ( preservedAspectRatio )
3176 mHeightSpinBox->blockSignals(
false );
3177 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
3185 mSizeUnitWidget->blockSignals(
true );
3188 mSizeUnitWidget->blockSignals(
false );
3189 mOffsetUnitWidget->blockSignals(
true );
3192 mOffsetUnitWidget->blockSignals(
false );
3207 updatePreviewImage();
3218 mImageSourceLineEdit->setMessageBar( context.
messageBar() );
3221 void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
3224 updatePreviewImage();
3228 void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
3230 bool fitsInCache =
false;
3232 if ( image.isNull() )
3234 mLabelImagePreview->setPixmap( QPixmap() );
3238 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3239 previewImage.fill( Qt::transparent );
3240 QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3242 p.begin( &previewImage );
3244 uchar pixDataRGB[] = { 150, 150, 150, 150,
3249 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3250 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3251 QBrush checkerBrush;
3252 checkerBrush.setTexture( pix );
3253 p.fillRect( imageRect, checkerBrush );
3260 p.drawImage( imageRect.left(), imageRect.top(), image );
3262 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3265 void QgsRasterMarkerSymbolLayerWidget::setWidth()
3268 double fixedAspectRatio = 0.0;
3269 mHeightSpinBox->blockSignals(
true );
3270 if ( defaultAspectRatio <= 0.0 )
3272 mHeightSpinBox->setValue( mWidthSpinBox->value() );
3274 else if ( mLockAspectRatio->locked() )
3276 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
3280 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3282 mHeightSpinBox->blockSignals(
false );
3288 void QgsRasterMarkerSymbolLayerWidget::setHeight()
3291 double fixedAspectRatio = 0.0;
3292 mWidthSpinBox->blockSignals(
true );
3293 if ( defaultAspectRatio <= 0.0 )
3295 mWidthSpinBox->setValue( mHeightSpinBox->value() );
3297 else if ( mLockAspectRatio->locked() )
3299 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
3303 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3305 mWidthSpinBox->blockSignals(
false );
3311 void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
3314 if ( defaultAspectRatio <= 0.0 )
3329 void QgsRasterMarkerSymbolLayerWidget::setAngle()
3335 void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
3339 updatePreviewImage();
3342 void QgsRasterMarkerSymbolLayerWidget::setOffset()
3344 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
3348 void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3358 void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3368 void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3377 void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3394 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3398 connect( mRotationSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
3400 connect( mWidthSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged );
3407 mSpinOffsetX->setClearValue( 0.0 );
3408 mSpinOffsetY->setClearValue( 0.0 );
3409 mRotationSpinBox->setClearValue( 0.0 );
3411 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
3412 connect( mSpinOffsetX, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3413 connect( mSpinOffsetY, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
3425 if ( layer->
layerType() != QLatin1String(
"RasterFill" ) )
3438 cboCoordinateMode->blockSignals(
true );
3442 cboCoordinateMode->setCurrentIndex( 1 );
3446 cboCoordinateMode->setCurrentIndex( 0 );
3449 cboCoordinateMode->blockSignals(
false );
3455 mOffsetUnitWidget->blockSignals(
true );
3458 mOffsetUnitWidget->blockSignals(
false );
3461 mWidthUnitWidget->blockSignals(
true );
3464 mWidthUnitWidget->blockSignals(
false );
3466 updatePreviewImage();
3479 void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
3482 updatePreviewImage();
3486 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
3503 void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
3512 updatePreviewImage();
3515 void QgsRasterFillSymbolLayerWidget::offsetChanged()
3517 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
3521 void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3532 void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
3541 void QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed()
3552 void QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged(
double d )
3562 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
3564 bool fitsInCache =
false;
3566 if ( image.isNull() )
3568 mLabelImagePreview->setPixmap( QPixmap() );
3572 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3573 previewImage.fill( Qt::transparent );
3574 QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3576 p.begin( &previewImage );
3578 uchar pixDataRGB[] = { 150, 150, 150, 150,
3583 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3584 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3585 QBrush checkerBrush;
3586 checkerBrush.setTexture( pix );
3587 p.fillRect( imageRect, checkerBrush );
3594 p.drawImage( imageRect.left(), imageRect.top(), image );
3596 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3605 modificationExpressionSelector->setMultiLine(
true );
3606 modificationExpressionSelector->setLayer( const_cast<QgsVectorLayer *>( vl ) );
3607 modificationExpressionSelector->registerExpressionContextGenerator(
this );
3612 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
3619 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData( mLayer->
symbolType() ) );
3627 void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
3634 void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
3636 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)
Sets the map unit scale for the pattern's stroke.
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.
RenderRingFilter ringFilter() const
Returns the line symbol layer's ring filter, which controls which rings are rendered when the line sy...
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)
static QIcon symbolLayerPreviewIcon(const QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
Draws a symbol layer preview to an icon.
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)
Sets the stroke width map unit scale.
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp used for the gradient fill.
QString svgFilePath() const
Returns the path to the SVG file used to render the fill.
void setPatternWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the width of the SVG images in the pattern.
QColor strokeColor() const override
Gets stroke color.
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
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)
Sets the fill color used for rendering the SVG content.
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's width.
QString fontFamily() const
Returns the font family name for the associated font which will be used to render the point...
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.
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
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.
A symbol fill consisting of repeated parallel lines.
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.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images...
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.
Render both exterior and interior rings.
void setAngle(double angle)
Abstract base class for color ramps.
void sourceChanged(const QString &source)
Emitted whenever the file source is changed in the widget.
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 unit 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's the marker's 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
Returns the map unit scale for the pattern's stroke.
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
Returns the stroke join style.
Tiling is based on complete map viewport.
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
Returns the estimated width for the line symbol layer.
bool rotateMarker() const
Shall the marker be rotated.
A marker symbol type, for rendering Point and MultiPoint geometries.
Name, eg shape name for simple markers.
void setStrokeWidth(double strokeWidth)
void setPatternWidth(double width)
Sets the width to render the SVG content as within the fill (i.e.
void setWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line's width.
A line symbol type, for rendering LineString and MultiLineString geometries.
Gradient reference point 2 y.
static QList< QgsSimpleMarkerSymbolLayerBase::Shape > availableShapes()
Returns a list of all available shape types.
double lineAngle() const
Returns the angle for the parallel lines used to fill the symbol.
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)
Sets the stroke join style.
double strokeWidth() const
Returns the width of the marker's stroke.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the pattern's line offset.
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 unit 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
Returns the 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...
double offset() const
Returns the offset distance for lines within the fill, which is the distance to offset the parallel l...
A dialog to create a new auxiliary layer.
void setField(const QString &field)
Sets the field name the property references.
void setLineAngle(double a)
Sets the angle for the parallel lines used to fill the symbol.
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
Raster marker symbol layer class.
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.
double opacity() const
Returns the marker opacity.
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the line's width.
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
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)
Sets the stroke width used for rendering the SVG content.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
Gradient coordinate mode.
double size() const
Returns the symbol size.
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0...
Render the interior rings only.
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)
Sets the stroke width unit.
Shapeburst fill from edge distance.
void setCharacter(QChar ch)
Sets the character used when rendering points.
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.
void setOpacity(double opacity)
Set the marker opacity.
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
Returns the stroke color used for rendering the SVG content.
QString path() const
Returns the marker raster image path.
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for markers...
Tiling is based on feature bounding box.
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 setPath(const QString &path)
Set the marker raster image path.
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 unit 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.
void sourceChanged(const QString &source)
Emitted whenever the SVG source is changed in the widget.
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
Returns the map unit scale for the pattern's line distance.
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 filling symbols with a repeated SVG file.
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.
QChar character() const
Returns the character used when rendering points.
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
Returns true if the line should only be drawn inside polygons, and any portion of the line which fall...
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
void setGradientColorType(GradientColorType gradientColorType)
QColor svgFillColor() const
Returns the fill color used for rendering the SVG content.
QImage pathAsImage(const QString &path, const QSize size, const bool keepAspectRatio, const double opacity, bool &fitsInCache)
Returns the specified path rendered as an image.
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.
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
Returns the map unit scale for the pattern's width.
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)
Sets the path to the SVG file to render in the fill.
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
Returns the marker's 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.
void setRingFilter(QgsLineSymbolLayer::RenderRingFilter filter)
Sets the line symbol layer's ring filter, which controls which rings are rendered when the line symbo...
const QgsMapUnitScale & distanceYMapUnitScale() const
QColor fillColor() const override
Gets fill color.
FillCoordinateMode coordinateMode() const
Coordinate mode for fill.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
bool pointOnSurface() const
double patternWidth() const
Returns the width of the rendered SVG content within the fill (i.e.
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)
Sets whether the line should only be drawn inside polygons, and any portion of the line which falls o...
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)
Sets the font family for the font which will be used to render the point.
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
Render the exterior ring only.
void setBrushStyle(Qt::BrushStyle style)
QgsColorRamp * colorRamp()
Returns the color ramp used for the gradient fill.
double svgStrokeWidth() const
Returns the stroke width used for rendering the SVG content.
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)
Sets the offset distance for lines within the fill, which is the distance to offset the parallel line...
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.
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
void setSvgStrokeColor(const QColor &c)
Sets the stroke color used for rendering the SVG content.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Units for gradient fill offset.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line offset.
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)
Sets the map unit scale for the pattern's line distance.
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.