49 #include <QAbstractButton>
50 #include <QButtonGroup>
51 #include <QColorDialog>
54 #include <QFileDialog>
56 #include <QStandardItemModel>
57 #include <QSvgRenderer>
58 #include <QMessageBox>
61 #include <QInputDialog>
66 return *lExpressionContext;
77 expContext << symbolScope;
97 QStringList highlights;
102 << QStringLiteral(
"symbol_layer_count" ) << QStringLiteral(
"symbol_layer_index" );
105 if ( expContext.
hasVariable( QStringLiteral(
"zoom_level" ) ) )
107 highlights << QStringLiteral(
"zoom_level" );
109 if ( expContext.
hasVariable( QStringLiteral(
"vector_tile_zoom" ) ) )
111 highlights << QStringLiteral(
"vector_tile_zoom" );
122 const auto unitSelectionWidgets = findChildren<QgsUnitSelectionWidget *>();
125 unitWidget->setMapCanvas( mContext.
mapCanvas() );
143 void QgsSymbolLayerWidget::createAuxiliaryField()
164 if ( dlg.exec() == QDialog::Accepted )
165 def = dlg.propertyDefinition();
175 property.setActive(
true );
197 connect( mCustomCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged );
198 connect( mChangePatternButton, &QPushButton::clicked,
this, &QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked );
202 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
204 connect( mCheckAlignDash, &QCheckBox::toggled,
this, [ = ]
206 mCheckDashCorners->setEnabled( mCheckAlignDash->isChecked() );
207 if ( !mCheckAlignDash->isChecked() )
208 mCheckDashCorners->setChecked(
false );
216 connect( mCheckDashCorners, &QCheckBox::toggled,
this, [ = ]
234 btnChangeColor->setAllowOpacity(
true );
235 btnChangeColor->setColorDialogTitle( tr(
"Select Line Color" ) );
236 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
238 mColorDDBtn->registerLinkedWidget( btnChangeColor );
243 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
252 spinOffset->setClearValue( 0.0 );
253 spinPatternOffset->setClearValue( 0.0 );
259 mPenWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
261 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penWidthChanged );
263 connect( cboPenStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
264 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::offsetChanged );
265 connect( cboCapStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
266 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleLineSymbolLayerWidget::penStyleChanged );
267 connect( spinPatternOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleLineSymbolLayerWidget::patternOffsetChanged );
274 void QgsSimpleLineSymbolLayerWidget::updateAssistantSymbol()
276 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
278 mAssistantPreviewSymbol->deleteSymbolLayer( i );
280 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
283 mAssistantPreviewSymbol->setDataDefinedWidth( ddWidth );
289 if ( !layer || layer->
layerType() != QLatin1String(
"SimpleLine" ) )
296 mPenWidthUnitWidget->blockSignals(
true );
299 mPenWidthUnitWidget->blockSignals(
false );
300 mOffsetUnitWidget->blockSignals(
true );
303 mOffsetUnitWidget->blockSignals(
false );
304 mDashPatternUnitWidget->blockSignals(
true );
307 mDashPatternUnitWidget->blockSignals(
false );
313 spinWidth->blockSignals(
true );
315 spinWidth->blockSignals(
false );
316 btnChangeColor->blockSignals(
true );
318 btnChangeColor->blockSignals(
false );
319 spinOffset->blockSignals(
true );
321 spinOffset->blockSignals(
false );
322 cboPenStyle->blockSignals(
true );
323 cboJoinStyle->blockSignals(
true );
324 cboCapStyle->blockSignals(
true );
328 cboPenStyle->blockSignals(
false );
329 cboJoinStyle->blockSignals(
false );
330 cboCapStyle->blockSignals(
false );
335 mChangePatternButton->setEnabled( useCustomDashPattern );
336 label_3->setEnabled( !useCustomDashPattern );
337 cboPenStyle->setEnabled( !useCustomDashPattern );
338 mCustomCheckBox->blockSignals(
true );
339 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
340 mCustomCheckBox->blockSignals(
false );
343 QSize size = mChangePatternButton->minimumSizeHint();
345 mChangePatternButton->setMinimumSize( QSize( size.width(), std::max( size.height(), fontHeight ) ) );
349 whileBlocking( mDrawInsideCheckBox )->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
368 updateAssistantSymbol();
385 mDrawInsideCheckBox->hide();
386 mRingFilterComboBox->hide();
396 void QgsSimpleLineSymbolLayerWidget::penWidthChanged()
403 void QgsSimpleLineSymbolLayerWidget::colorChanged(
const QColor &color )
409 void QgsSimpleLineSymbolLayerWidget::penStyleChanged()
418 void QgsSimpleLineSymbolLayerWidget::offsetChanged()
425 void QgsSimpleLineSymbolLayerWidget::patternOffsetChanged()
432 void QgsSimpleLineSymbolLayerWidget::mCustomCheckBox_stateChanged(
int state )
434 bool checked = ( state == Qt::Checked );
435 mChangePatternButton->setEnabled( checked );
436 label_3->setEnabled( !checked );
437 cboPenStyle->setEnabled( !checked );
443 void QgsSimpleLineSymbolLayerWidget::mChangePatternButton_clicked()
450 widget->
setUnit( mDashPatternUnitWidget->unit() );
462 d.setUnit( mDashPatternUnitWidget->unit() );
463 if ( d.exec() == QDialog::Accepted )
471 void QgsSimpleLineSymbolLayerWidget::mPenWidthUnitWidget_changed()
482 void QgsSimpleLineSymbolLayerWidget::mOffsetUnitWidget_changed()
492 void QgsSimpleLineSymbolLayerWidget::mDashPatternUnitWidget_changed()
503 void QgsSimpleLineSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
505 bool checked = ( state == Qt::Checked );
510 void QgsSimpleLineSymbolLayerWidget::patternOffsetUnitChanged()
527 std::unique_ptr< QgsSimpleLineSymbolLayer > layerCopy(
mLayer->
clone() );
532 QColor color = qApp->palette().color( QPalette::WindowText );
533 layerCopy->setColor( color );
535 layerCopy->setOffset( 0 );
536 layerCopy->setUseCustomDashPattern(
true );
538 QSize currentIconSize;
541 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 6 );
543 currentIconSize = QSize( mChangePatternButton->width() - 10, mChangePatternButton->height() - 12 );
546 if ( !currentIconSize.isValid() || currentIconSize.width() <= 0 || currentIconSize.height() <= 0 )
552 std::unique_ptr< QgsLineSymbol > previewSymbol = qgis::make_unique< QgsLineSymbol >(
QgsSymbolLayerList() << layerCopy.release() );
554 mChangePatternButton->setIconSize( currentIconSize );
555 mChangePatternButton->setIcon( icon );
559 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
562 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 23 );
564 int height =
static_cast< int >( width / 1.61803398875 );
568 QBuffer buffer( &data );
569 pm.save( &buffer,
"PNG", 100 );
570 mChangePatternButton->setToolTip( QStringLiteral(
"<img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) ) );
575 QgsSymbolLayerWidget::resizeEvent( event );
593 connect( mStrokeStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged );
594 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
595 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
596 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
604 btnChangeColorFill->setAllowOpacity(
true );
605 btnChangeColorFill->setColorDialogTitle( tr(
"Select Fill Color" ) );
606 btnChangeColorFill->setContext( QStringLiteral(
"symbology" ) );
607 btnChangeColorFill->setShowNoColor(
true );
608 btnChangeColorFill->setNoColorString( tr(
"Transparent Fill" ) );
609 btnChangeColorStroke->setAllowOpacity(
true );
610 btnChangeColorStroke->setColorDialogTitle( tr(
"Select Stroke Color" ) );
611 btnChangeColorStroke->setContext( QStringLiteral(
"symbology" ) );
612 btnChangeColorStroke->setShowNoColor(
true );
613 btnChangeColorStroke->setNoColorString( tr(
"Transparent Stroke" ) );
615 mFillColorDDBtn->registerLinkedWidget( btnChangeColorFill );
616 mStrokeColorDDBtn->registerLinkedWidget( btnChangeColorStroke );
618 spinOffsetX->setClearValue( 0.0 );
619 spinOffsetY->setClearValue( 0.0 );
620 spinAngle->setClearValue( 0.0 );
626 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
628 int size = lstNames->iconSize().width();
630 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
631 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width(
'X' ) * 3 ) ) );
633 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
636 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
637 lstNames->setIconSize( QSize( size, size ) );
639 double markerSize = size * 0.8;
645 lyr->
setColor( QColor( 200, 200, 200 ) );
648 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
649 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
654 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
656 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsSimpleMarkerSymbolLayerWidget::setShape );
659 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged );
660 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setSize );
661 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setAngle );
662 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
663 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleMarkerSymbolLayerWidget::setOffset );
669 if ( layer->
layerType() != QLatin1String(
"SimpleMarker" ) )
677 for (
int i = 0; i < lstNames->count(); ++i )
681 lstNames->setCurrentRow( i );
685 btnChangeColorStroke->blockSignals(
true );
687 btnChangeColorStroke->blockSignals(
false );
688 btnChangeColorFill->blockSignals(
true );
691 btnChangeColorFill->blockSignals(
false );
692 spinSize->blockSignals(
true );
694 spinSize->blockSignals(
false );
695 spinAngle->blockSignals(
true );
697 spinAngle->blockSignals(
false );
698 mStrokeStyleComboBox->blockSignals(
true );
700 mStrokeStyleComboBox->blockSignals(
false );
701 mStrokeWidthSpinBox->blockSignals(
true );
703 mStrokeWidthSpinBox->blockSignals(
false );
704 cboJoinStyle->blockSignals(
true );
706 cboJoinStyle->blockSignals(
false );
709 spinOffsetX->blockSignals(
true );
711 spinOffsetX->blockSignals(
false );
712 spinOffsetY->blockSignals(
true );
714 spinOffsetY->blockSignals(
false );
716 mSizeUnitWidget->blockSignals(
true );
719 mSizeUnitWidget->blockSignals(
false );
720 mOffsetUnitWidget->blockSignals(
true );
723 mOffsetUnitWidget->blockSignals(
false );
724 mStrokeWidthUnitWidget->blockSignals(
true );
727 mStrokeWidthUnitWidget->blockSignals(
false );
730 mHorizontalAnchorComboBox->blockSignals(
true );
731 mVerticalAnchorComboBox->blockSignals(
true );
734 mHorizontalAnchorComboBox->blockSignals(
false );
735 mVerticalAnchorComboBox->blockSignals(
false );
749 updateAssistantSymbol();
757 void QgsSimpleMarkerSymbolLayerWidget::setShape()
776 void QgsSimpleMarkerSymbolLayerWidget::penJoinStyleChanged()
782 void QgsSimpleMarkerSymbolLayerWidget::setSize()
788 void QgsSimpleMarkerSymbolLayerWidget::setAngle()
794 void QgsSimpleMarkerSymbolLayerWidget::setOffset()
796 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
800 void QgsSimpleMarkerSymbolLayerWidget::mStrokeStyleComboBox_currentIndexChanged(
int index )
811 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
820 void QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
830 void QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
840 void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
850 void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
859 void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
868 void QgsSimpleMarkerSymbolLayerWidget::updateAssistantSymbol()
870 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
872 mAssistantPreviewSymbol->deleteSymbolLayer( i );
874 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
877 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
896 btnChangeColor->setAllowOpacity(
true );
897 btnChangeColor->setColorDialogTitle( tr(
"Select Fill Color" ) );
898 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
899 btnChangeColor->setShowNoColor(
true );
900 btnChangeColor->setNoColorString( tr(
"Transparent Fill" ) );
901 btnChangeStrokeColor->setAllowOpacity(
true );
902 btnChangeStrokeColor->setColorDialogTitle( tr(
"Select Stroke Color" ) );
903 btnChangeStrokeColor->setContext( QStringLiteral(
"symbology" ) );
904 btnChangeStrokeColor->setShowNoColor(
true );
905 btnChangeStrokeColor->setNoColorString( tr(
"Transparent Stroke" ) );
907 spinOffsetX->setClearValue( 0.0 );
908 spinOffsetY->setClearValue( 0.0 );
911 connect( cboFillStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::setBrushStyle );
913 connect( spinStrokeWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeWidthChanged );
914 connect( cboStrokeStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
915 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSimpleFillSymbolLayerWidget::strokeStyleChanged );
916 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
917 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSimpleFillSymbolLayerWidget::offsetChanged );
919 mFillColorDDBtn->registerLinkedWidget( btnChangeColor );
920 mStrokeColorDDBtn->registerLinkedWidget( btnChangeStrokeColor );
925 if ( layer->
layerType() != QLatin1String(
"SimpleFill" ) )
932 btnChangeColor->blockSignals(
true );
934 btnChangeColor->blockSignals(
false );
935 cboFillStyle->blockSignals(
true );
937 cboFillStyle->blockSignals(
false );
938 btnChangeStrokeColor->blockSignals(
true );
940 btnChangeStrokeColor->blockSignals(
false );
941 cboStrokeStyle->blockSignals(
true );
943 cboStrokeStyle->blockSignals(
false );
944 spinStrokeWidth->blockSignals(
true );
946 spinStrokeWidth->blockSignals(
false );
947 cboJoinStyle->blockSignals(
true );
949 cboJoinStyle->blockSignals(
false );
950 spinOffsetX->blockSignals(
true );
952 spinOffsetX->blockSignals(
false );
953 spinOffsetY->blockSignals(
true );
955 spinOffsetY->blockSignals(
false );
957 mStrokeWidthUnitWidget->blockSignals(
true );
960 mStrokeWidthUnitWidget->blockSignals(
false );
961 mOffsetUnitWidget->blockSignals(
true );
964 mOffsetUnitWidget->blockSignals(
false );
992 void QgsSimpleFillSymbolLayerWidget::setBrushStyle()
998 void QgsSimpleFillSymbolLayerWidget::strokeWidthChanged()
1004 void QgsSimpleFillSymbolLayerWidget::strokeStyleChanged()
1011 void QgsSimpleFillSymbolLayerWidget::offsetChanged()
1013 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1017 void QgsSimpleFillSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
1027 void QgsSimpleFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1047 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
1048 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
1054 spinOffsetX->setClearValue( 0.0 );
1055 spinOffsetY->setClearValue( 0.0 );
1056 spinAngle->setClearValue( 0.0 );
1062 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
1064 int size = lstNames->iconSize().width();
1065 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
1066 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().width(
'X' ) * 3 ) ) );
1068 size = std::max( 30,
static_cast< int >( std::round(
Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance(
'X' ) * 3 ) ) );
1070 lstNames->setGridSize( QSize( size * 1.2, size * 1.2 ) );
1071 lstNames->setIconSize( QSize( size, size ) );
1073 double markerSize = size * 0.8;
1079 lyr->
setColor( QColor( 200, 200, 200 ) );
1082 QListWidgetItem *item =
new QListWidgetItem( icon, QString(), lstNames );
1083 item->setData( Qt::UserRole,
static_cast< int >( shape ) );
1088 lstNames->setMinimumHeight( lstNames->gridSize().height() * 3.1 );
1090 connect( lstNames, &QListWidget::currentRowChanged,
this, &QgsFilledMarkerSymbolLayerWidget::setShape );
1091 connect( spinSize,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setSize );
1092 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setAngle );
1093 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1094 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFilledMarkerSymbolLayerWidget::setOffset );
1100 if ( layer->
layerType() != QLatin1String(
"FilledMarker" ) )
1108 for (
int i = 0; i < lstNames->count(); ++i )
1112 lstNames->setCurrentRow( i );
1121 mSizeUnitWidget->blockSignals(
true );
1124 mSizeUnitWidget->blockSignals(
false );
1125 mOffsetUnitWidget->blockSignals(
true );
1128 mOffsetUnitWidget->blockSignals(
false );
1141 updateAssistantSymbol();
1149 void QgsFilledMarkerSymbolLayerWidget::setShape()
1155 void QgsFilledMarkerSymbolLayerWidget::setSize()
1161 void QgsFilledMarkerSymbolLayerWidget::setAngle()
1167 void QgsFilledMarkerSymbolLayerWidget::setOffset()
1169 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1173 void QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
1183 void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
1193 void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
1202 void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
1211 void QgsFilledMarkerSymbolLayerWidget::updateAssistantSymbol()
1213 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
1215 mAssistantPreviewSymbol->deleteSymbolLayer( i );
1217 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
1220 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
1233 connect( mSpinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged );
1237 btnColorRamp->setShowGradientOnly(
true );
1239 btnChangeColor->setAllowOpacity(
true );
1240 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1241 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1242 btnChangeColor->setShowNoColor(
true );
1243 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1244 btnChangeColor2->setAllowOpacity(
true );
1245 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1246 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1247 btnChangeColor2->setShowNoColor(
true );
1248 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1250 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1251 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1253 spinOffsetX->setClearValue( 0.0 );
1254 spinOffsetY->setClearValue( 0.0 );
1255 mSpinAngle->setClearValue( 0.0 );
1263 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::colorModeChanged );
1264 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1265 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::offsetChanged );
1266 connect( spinRefPoint1X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1267 connect( spinRefPoint1Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1268 connect( checkRefPoint1Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1269 connect( spinRefPoint2X,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1270 connect( spinRefPoint2Y,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1271 connect( checkRefPoint2Centroid, &QAbstractButton::toggled,
this, &QgsGradientFillSymbolLayerWidget::referencePointChanged );
1276 if ( layer->
layerType() != QLatin1String(
"GradientFill" ) )
1283 btnChangeColor->blockSignals(
true );
1285 btnChangeColor->blockSignals(
false );
1286 btnChangeColor2->blockSignals(
true );
1288 btnChangeColor2->blockSignals(
false );
1292 radioTwoColor->setChecked(
true );
1293 btnColorRamp->setEnabled(
false );
1297 radioColorRamp->setChecked(
true );
1298 btnChangeColor->setEnabled(
false );
1299 btnChangeColor2->setEnabled(
false );
1305 btnColorRamp->blockSignals(
true );
1307 btnColorRamp->blockSignals(
false );
1310 cboGradientType->blockSignals(
true );
1314 cboGradientType->setCurrentIndex( 0 );
1317 cboGradientType->setCurrentIndex( 1 );
1320 cboGradientType->setCurrentIndex( 2 );
1323 cboGradientType->blockSignals(
false );
1325 cboCoordinateMode->blockSignals(
true );
1329 cboCoordinateMode->setCurrentIndex( 1 );
1330 checkRefPoint1Centroid->setEnabled(
false );
1331 checkRefPoint2Centroid->setEnabled(
false );
1335 cboCoordinateMode->setCurrentIndex( 0 );
1338 cboCoordinateMode->blockSignals(
false );
1340 cboGradientSpread->blockSignals(
true );
1344 cboGradientSpread->setCurrentIndex( 0 );
1347 cboGradientSpread->setCurrentIndex( 1 );
1350 cboGradientSpread->setCurrentIndex( 2 );
1353 cboGradientSpread->blockSignals(
false );
1355 spinRefPoint1X->blockSignals(
true );
1357 spinRefPoint1X->blockSignals(
false );
1358 spinRefPoint1Y->blockSignals(
true );
1360 spinRefPoint1Y->blockSignals(
false );
1361 checkRefPoint1Centroid->blockSignals(
true );
1365 spinRefPoint1X->setEnabled(
false );
1366 spinRefPoint1Y->setEnabled(
false );
1368 checkRefPoint1Centroid->blockSignals(
false );
1369 spinRefPoint2X->blockSignals(
true );
1371 spinRefPoint2X->blockSignals(
false );
1372 spinRefPoint2Y->blockSignals(
true );
1374 spinRefPoint2Y->blockSignals(
false );
1375 checkRefPoint2Centroid->blockSignals(
true );
1379 spinRefPoint2X->setEnabled(
false );
1380 spinRefPoint2Y->setEnabled(
false );
1382 checkRefPoint2Centroid->blockSignals(
false );
1384 spinOffsetX->blockSignals(
true );
1386 spinOffsetX->blockSignals(
false );
1387 spinOffsetY->blockSignals(
true );
1389 spinOffsetY->blockSignals(
false );
1390 mSpinAngle->blockSignals(
true );
1392 mSpinAngle->blockSignals(
false );
1394 mOffsetUnitWidget->blockSignals(
true );
1397 mOffsetUnitWidget->blockSignals(
false );
1431 void QgsGradientFillSymbolLayerWidget::colorModeChanged()
1433 if ( radioTwoColor->isChecked() )
1446 if ( btnColorRamp->isNull() )
1460 spinRefPoint1X->setValue( 0.5 );
1461 spinRefPoint1Y->setValue( 0 );
1462 spinRefPoint2X->setValue( 0.5 );
1463 spinRefPoint2Y->setValue( 1 );
1468 spinRefPoint1X->setValue( 0 );
1469 spinRefPoint1Y->setValue( 0 );
1470 spinRefPoint2X->setValue( 1 );
1471 spinRefPoint2Y->setValue( 1 );
1475 spinRefPoint1X->setValue( 0.5 );
1476 spinRefPoint1Y->setValue( 0.5 );
1477 spinRefPoint2X->setValue( 1 );
1478 spinRefPoint2Y->setValue( 1 );
1493 checkRefPoint1Centroid->setEnabled(
true );
1494 checkRefPoint2Centroid->setEnabled(
true );
1500 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1501 checkRefPoint1Centroid->setEnabled(
false );
1502 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1503 checkRefPoint2Centroid->setEnabled(
false );
1528 void QgsGradientFillSymbolLayerWidget::offsetChanged()
1530 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1534 void QgsGradientFillSymbolLayerWidget::referencePointChanged()
1543 void QgsGradientFillSymbolLayerWidget::mSpinAngle_valueChanged(
double value )
1549 void QgsGradientFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1567 connect( mSpinBlurRadius, qgis::overload< int >::of( &QSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged );
1568 connect( mSpinMaxDistance, qgis::overload< double >::of( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged );
1570 connect( mRadioUseWholeShape, &QRadioButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled );
1572 connect( mIgnoreRingsCheckBox, &QCheckBox::stateChanged,
this, &QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged );
1578 QButtonGroup *group1 =
new QButtonGroup(
this );
1579 group1->addButton( radioColorRamp );
1580 group1->addButton( radioTwoColor );
1581 QButtonGroup *group2 =
new QButtonGroup(
this );
1582 group2->addButton( mRadioUseMaxDistance );
1583 group2->addButton( mRadioUseWholeShape );
1584 btnChangeColor->setAllowOpacity(
true );
1585 btnChangeColor->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1586 btnChangeColor->setContext( QStringLiteral(
"symbology" ) );
1587 btnChangeColor->setShowNoColor(
true );
1588 btnChangeColor->setNoColorString( tr(
"Transparent" ) );
1589 btnChangeColor2->setAllowOpacity(
true );
1590 btnChangeColor2->setColorDialogTitle( tr(
"Select Gradient Color" ) );
1591 btnChangeColor2->setContext( QStringLiteral(
"symbology" ) );
1592 btnChangeColor2->setShowNoColor(
true );
1593 btnChangeColor2->setNoColorString( tr(
"Transparent" ) );
1595 mStartColorDDBtn->registerLinkedWidget( btnChangeColor );
1596 mEndColorDDBtn->registerLinkedWidget( btnChangeColor2 );
1598 spinOffsetX->setClearValue( 0.0 );
1599 spinOffsetY->setClearValue( 0.0 );
1600 mSpinMaxDistance->setClearValue( 5.0 );
1602 btnColorRamp->setShowGradientOnly(
true );
1608 connect( radioTwoColor, &QAbstractButton::toggled,
this, &QgsShapeburstFillSymbolLayerWidget::colorModeChanged );
1609 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1610 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsShapeburstFillSymbolLayerWidget::offsetChanged );
1612 connect( mBlurSlider, &QAbstractSlider::valueChanged, mSpinBlurRadius, &QSpinBox::setValue );
1613 connect( mSpinBlurRadius,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ), mBlurSlider, &QAbstractSlider::setValue );
1618 if ( layer->
layerType() != QLatin1String(
"ShapeburstFill" ) )
1625 btnChangeColor->blockSignals(
true );
1627 btnChangeColor->blockSignals(
false );
1628 btnChangeColor2->blockSignals(
true );
1630 btnChangeColor2->blockSignals(
false );
1634 radioTwoColor->setChecked(
true );
1635 btnColorRamp->setEnabled(
false );
1639 radioColorRamp->setChecked(
true );
1640 btnChangeColor->setEnabled(
false );
1641 btnChangeColor2->setEnabled(
false );
1644 mSpinBlurRadius->blockSignals(
true );
1645 mBlurSlider->blockSignals(
true );
1648 mSpinBlurRadius->blockSignals(
false );
1649 mBlurSlider->blockSignals(
false );
1651 mSpinMaxDistance->blockSignals(
true );
1653 mSpinMaxDistance->blockSignals(
false );
1655 mRadioUseWholeShape->blockSignals(
true );
1656 mRadioUseMaxDistance->blockSignals(
true );
1659 mRadioUseWholeShape->setChecked(
true );
1660 mSpinMaxDistance->setEnabled(
false );
1661 mDistanceUnitWidget->setEnabled(
false );
1665 mRadioUseMaxDistance->setChecked(
true );
1666 mSpinMaxDistance->setEnabled(
true );
1667 mDistanceUnitWidget->setEnabled(
true );
1669 mRadioUseWholeShape->blockSignals(
false );
1670 mRadioUseMaxDistance->blockSignals(
false );
1672 mDistanceUnitWidget->blockSignals(
true );
1675 mDistanceUnitWidget->blockSignals(
false );
1677 mIgnoreRingsCheckBox->blockSignals(
true );
1678 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1679 mIgnoreRingsCheckBox->blockSignals(
false );
1684 btnColorRamp->blockSignals(
true );
1686 btnColorRamp->blockSignals(
false );
1689 spinOffsetX->blockSignals(
true );
1691 spinOffsetX->blockSignals(
false );
1692 spinOffsetY->blockSignals(
true );
1694 spinOffsetY->blockSignals(
false );
1695 mOffsetUnitWidget->blockSignals(
true );
1698 mOffsetUnitWidget->blockSignals(
false );
1732 void QgsShapeburstFillSymbolLayerWidget::colorModeChanged()
1739 if ( radioTwoColor->isChecked() )
1750 void QgsShapeburstFillSymbolLayerWidget::mSpinBlurRadius_valueChanged(
int value )
1759 void QgsShapeburstFillSymbolLayerWidget::mSpinMaxDistance_valueChanged(
double value )
1768 void QgsShapeburstFillSymbolLayerWidget::mDistanceUnitWidget_changed()
1778 void QgsShapeburstFillSymbolLayerWidget::mRadioUseWholeShape_toggled(
bool value )
1783 mDistanceUnitWidget->setEnabled( !value );
1788 void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
1798 void QgsShapeburstFillSymbolLayerWidget::offsetChanged()
1802 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1807 void QgsShapeburstFillSymbolLayerWidget::mOffsetUnitWidget_changed()
1818 void QgsShapeburstFillSymbolLayerWidget::mIgnoreRingsCheckBox_stateChanged(
int state )
1820 bool checked = ( state == Qt::Checked );
1849 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
1858 spinOffset->setClearValue( 0.0 );
1860 mSpinAverageAngleLength->setClearValue( 4.0 );
1864 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setRotate );
1865 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setOffset );
1866 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsMarkerLineSymbolLayerWidget::setAverageAngle );
1867 connect( radInterval, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1868 connect( radVertex, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1869 connect( radVertexLast, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1870 connect( radVertexFirst, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1871 connect( radCentralPoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1872 connect( radCurvePoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1873 connect( radSegmentCentralPoint, &QAbstractButton::clicked,
this, &QgsMarkerLineSymbolLayerWidget::setPlacement );
1878 if ( layer->
layerType() != QLatin1String(
"MarkerLine" ) )
1885 spinInterval->blockSignals(
true );
1887 spinInterval->blockSignals(
false );
1888 mSpinOffsetAlongLine->blockSignals(
true );
1890 mSpinOffsetAlongLine->blockSignals(
false );
1891 chkRotateMarker->blockSignals(
true );
1893 chkRotateMarker->blockSignals(
false );
1894 spinOffset->blockSignals(
true );
1896 spinOffset->blockSignals(
false );
1898 radInterval->setChecked(
true );
1900 radVertex->setChecked(
true );
1902 radVertexLast->setChecked(
true );
1904 radCentralPoint->setChecked(
true );
1906 radCurvePoint->setChecked(
true );
1908 radSegmentCentralPoint->setChecked(
true );
1910 radVertexFirst->setChecked(
true );
1913 mIntervalUnitWidget->blockSignals(
true );
1916 mIntervalUnitWidget->blockSignals(
false );
1917 mOffsetUnitWidget->blockSignals(
true );
1920 mOffsetUnitWidget->blockSignals(
false );
1921 mOffsetAlongLineUnitWidget->blockSignals(
true );
1924 mOffsetAlongLineUnitWidget->blockSignals(
false );
1955 mRingFilterComboBox->hide();
1956 mRingsLabel->hide();
1977 void QgsMarkerLineSymbolLayerWidget::setRotate()
1979 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
1980 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
1986 void QgsMarkerLineSymbolLayerWidget::setOffset()
1992 void QgsMarkerLineSymbolLayerWidget::setPlacement()
1994 bool interval = radInterval->isChecked();
1995 spinInterval->setEnabled( interval );
1996 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1997 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
1998 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
1999 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2001 if ( radInterval->isChecked() )
2003 else if ( radVertex->isChecked() )
2005 else if ( radVertexLast->isChecked() )
2007 else if ( radVertexFirst->isChecked() )
2009 else if ( radCurvePoint->isChecked() )
2011 else if ( radSegmentCentralPoint->isChecked() )
2019 void QgsMarkerLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2029 void QgsMarkerLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2039 void QgsMarkerLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2049 void QgsMarkerLineSymbolLayerWidget::averageAngleUnitChanged()
2059 void QgsMarkerLineSymbolLayerWidget::setAverageAngle(
double val )
2096 connect( mRingFilterComboBox, qgis::overload< int >::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
2105 spinOffset->setClearValue( 0.0 );
2107 mHashRotationSpinBox->setClearValue( 0 );
2108 mSpinAverageAngleLength->setClearValue( 4.0 );
2110 connect( spinInterval,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setInterval );
2111 connect( mSpinOffsetAlongLine,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffsetAlongLine );
2112 connect( mSpinHashLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashLength );
2113 connect( mHashRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setHashAngle );
2114 connect( chkRotateMarker, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setRotate );
2115 connect( spinOffset,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setOffset );
2116 connect( mSpinAverageAngleLength,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHashedLineSymbolLayerWidget::setAverageAngle );
2117 connect( radInterval, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2118 connect( radVertex, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2119 connect( radVertexLast, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2120 connect( radVertexFirst, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2121 connect( radCentralPoint, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2122 connect( radCurvePoint, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2123 connect( radSegmentCentralPoint, &QAbstractButton::clicked,
this, &QgsHashedLineSymbolLayerWidget::setPlacement );
2128 if ( layer->
layerType() != QLatin1String(
"HashLine" ) )
2135 spinInterval->blockSignals(
true );
2136 spinInterval->setValue( mLayer->
interval() );
2137 spinInterval->blockSignals(
false );
2138 mSpinOffsetAlongLine->blockSignals(
true );
2140 mSpinOffsetAlongLine->blockSignals(
false );
2143 chkRotateMarker->blockSignals(
true );
2145 chkRotateMarker->blockSignals(
false );
2146 spinOffset->blockSignals(
true );
2147 spinOffset->setValue( mLayer->
offset() );
2148 spinOffset->blockSignals(
false );
2150 radInterval->setChecked(
true );
2152 radVertex->setChecked(
true );
2154 radVertexLast->setChecked(
true );
2156 radCentralPoint->setChecked(
true );
2158 radCurvePoint->setChecked(
true );
2160 radSegmentCentralPoint->setChecked(
true );
2162 radVertexFirst->setChecked(
true );
2165 mIntervalUnitWidget->blockSignals(
true );
2166 mIntervalUnitWidget->setUnit( mLayer->
intervalUnit() );
2168 mIntervalUnitWidget->blockSignals(
false );
2169 mOffsetUnitWidget->blockSignals(
true );
2170 mOffsetUnitWidget->setUnit( mLayer->
offsetUnit() );
2172 mOffsetUnitWidget->blockSignals(
false );
2173 mOffsetAlongLineUnitWidget->blockSignals(
true );
2176 mOffsetAlongLineUnitWidget->blockSignals(
false );
2183 whileBlocking( mRingFilterComboBox )->setCurrentIndex( mRingFilterComboBox->findData( mLayer->
ringFilter() ) );
2210 mRingFilterComboBox->hide();
2211 mRingsLabel->hide();
2220 void QgsHashedLineSymbolLayerWidget::setInterval(
double val )
2226 void QgsHashedLineSymbolLayerWidget::setOffsetAlongLine(
double val )
2232 void QgsHashedLineSymbolLayerWidget::setHashLength(
double val )
2238 void QgsHashedLineSymbolLayerWidget::setHashAngle(
double val )
2244 void QgsHashedLineSymbolLayerWidget::setRotate()
2246 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
2247 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2253 void QgsHashedLineSymbolLayerWidget::setOffset()
2255 mLayer->
setOffset( spinOffset->value() );
2259 void QgsHashedLineSymbolLayerWidget::setPlacement()
2261 bool interval = radInterval->isChecked();
2262 spinInterval->setEnabled( interval );
2263 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
2264 mOffsetAlongLineUnitWidget->setEnabled( mSpinOffsetAlongLine->isEnabled() );
2265 mSpinAverageAngleLength->setEnabled( chkRotateMarker->isChecked() && ( radInterval->isChecked() || radCentralPoint->isChecked() ) );
2266 mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
2268 if ( radInterval->isChecked() )
2270 else if ( radVertex->isChecked() )
2272 else if ( radVertexLast->isChecked() )
2274 else if ( radVertexFirst->isChecked() )
2276 else if ( radCurvePoint->isChecked() )
2278 else if ( radSegmentCentralPoint->isChecked() )
2286 void QgsHashedLineSymbolLayerWidget::mIntervalUnitWidget_changed()
2296 void QgsHashedLineSymbolLayerWidget::mOffsetUnitWidget_changed()
2306 void QgsHashedLineSymbolLayerWidget::mOffsetAlongLineUnitWidget_changed()
2316 void QgsHashedLineSymbolLayerWidget::hashLengthUnitWidgetChanged()
2326 void QgsHashedLineSymbolLayerWidget::averageAngleUnitChanged()
2336 void QgsHashedLineSymbolLayerWidget::setAverageAngle(
double val )
2355 mSvgSelectorWidget->setAllowParameters(
true );
2356 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2357 mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral(
"/UI/lastSVGMarkerDir" ) );
2358 mSvgSelectorWidget->initParametersModel(
this, vl );
2362 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2363 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2367 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
2368 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
2375 mChangeColorButton->setAllowOpacity(
true );
2376 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill color" ) );
2377 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2378 mChangeStrokeColorButton->setAllowOpacity(
true );
2379 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2380 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2382 mFillColorDDBtn->registerLinkedWidget( mChangeColorButton );
2383 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2385 spinOffsetX->setClearValue( 0.0 );
2386 spinOffsetY->setClearValue( 0.0 );
2387 spinAngle->setClearValue( 0.0 );
2389 connect( spinWidth,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
2390 connect( spinHeight,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
2392 connect( spinAngle,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
2393 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2394 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
2405 mWidthDDBtn->setSymbol( mAssistantPreviewSymbol );
2406 mHeightDDBtn->setSymbol( mAssistantPreviewSymbol );
2411 #include <QAbstractListModel>
2412 #include <QPixmapCache>
2426 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2427 QColor defaultFill, defaultStroke;
2428 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2429 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2431 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2432 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2433 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2434 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2435 mChangeColorButton->setEnabled( hasFillParam );
2436 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2437 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2438 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2439 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2444 double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2445 if ( hasDefaultFillColor && !skipDefaultColors )
2449 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
2450 mChangeColorButton->setColor( fill );
2452 if ( hasStrokeParam )
2455 double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2456 if ( hasDefaultStrokeColor && !skipDefaultColors )
2458 stroke = defaultStroke;
2460 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : existingOpacity );
2461 mChangeStrokeColorButton->setColor( stroke );
2464 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( layer->
path() );
2466 mStrokeWidthSpinBox->blockSignals(
true );
2467 mStrokeWidthSpinBox->setValue( hasDefaultStrokeWidth ? defaultStrokeWidth : layer->
strokeWidth() );
2468 mStrokeWidthSpinBox->blockSignals(
false );
2471 spinHeight->blockSignals(
true );
2472 if ( preservedAspectRatio )
2481 spinHeight->blockSignals(
false );
2482 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
2485 void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
2487 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
2489 mAssistantPreviewSymbol->deleteSymbolLayer( i );
2491 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
2494 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
2505 if ( layer->
layerType() != QLatin1String(
"SvgMarker" ) )
2512 mSvgSelectorWidget->setSvgPath(
mLayer->
path() );
2515 spinWidth->blockSignals(
true );
2517 spinWidth->blockSignals(
false );
2518 spinAngle->blockSignals(
true );
2520 spinAngle->blockSignals(
false );
2523 spinOffsetX->blockSignals(
true );
2525 spinOffsetX->blockSignals(
false );
2526 spinOffsetY->blockSignals(
true );
2528 spinOffsetY->blockSignals(
false );
2530 mSizeUnitWidget->blockSignals(
true );
2533 mSizeUnitWidget->blockSignals(
false );
2534 mStrokeWidthUnitWidget->blockSignals(
true );
2537 mStrokeWidthUnitWidget->blockSignals(
false );
2538 mOffsetUnitWidget->blockSignals(
true );
2541 mOffsetUnitWidget->blockSignals(
false );
2544 mHorizontalAnchorComboBox->blockSignals(
true );
2545 mVerticalAnchorComboBox->blockSignals(
true );
2548 mHorizontalAnchorComboBox->blockSignals(
false );
2549 mVerticalAnchorComboBox->blockSignals(
false );
2565 updateAssistantSymbol();
2582 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2591 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2597 void QgsSvgMarkerSymbolLayerWidget::setWidth()
2600 double fixedAspectRatio = 0.0;
2601 spinHeight->blockSignals(
true );
2602 if ( defaultAspectRatio <= 0.0 )
2604 spinHeight->setValue( spinWidth->value() );
2606 else if ( mLockAspectRatio->locked() )
2608 spinHeight->setValue( spinWidth->value() * defaultAspectRatio );
2612 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2614 spinHeight->blockSignals(
false );
2620 void QgsSvgMarkerSymbolLayerWidget::setHeight()
2623 double fixedAspectRatio = 0.0;
2624 spinWidth->blockSignals(
true );
2625 if ( defaultAspectRatio <= 0.0 )
2627 spinWidth->setValue( spinHeight->value() );
2629 else if ( mLockAspectRatio->locked() )
2631 spinWidth->setValue( spinHeight->value() / defaultAspectRatio );
2635 fixedAspectRatio = spinHeight->value() / spinWidth->value();
2637 spinWidth->blockSignals(
false );
2643 void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged(
const bool locked )
2647 if ( defaultAspectRatio <= 0.0 )
2663 void QgsSvgMarkerSymbolLayerWidget::setAngle()
2669 void QgsSvgMarkerSymbolLayerWidget::setOffset()
2671 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2675 void QgsSvgMarkerSymbolLayerWidget::svgSourceChanged(
const QString &text )
2682 void QgsSvgMarkerSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2693 void QgsSvgMarkerSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2704 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2713 void QgsSvgMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
2723 void QgsSvgMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
2733 void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
2743 void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
2752 void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
2768 mSvgSelectorWidget->setAllowParameters(
true );
2769 mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible(
true );
2771 connect( mTextureWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged );
2773 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
2775 connect( mChangeStrokeColorButton, &
QgsColorButton::colorChanged,
this, &QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged );
2776 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
2784 mRotationSpinBox->setClearValue( 0.0 );
2786 mChangeColorButton->setColorDialogTitle( tr(
"Select Fill Color" ) );
2787 mChangeColorButton->setContext( QStringLiteral(
"symbology" ) );
2788 mChangeStrokeColorButton->setColorDialogTitle( tr(
"Select Stroke Color" ) );
2789 mChangeStrokeColorButton->setContext( QStringLiteral(
"symbology" ) );
2791 mFilColorDDBtn->registerLinkedWidget( mChangeColorButton );
2792 mStrokeColorDDBtn->registerLinkedWidget( mChangeStrokeColorButton );
2805 if ( layer->
layerType() != QLatin1String(
"SVGFill" ) )
2814 mTextureWidthSpinBox->blockSignals(
true );
2815 mTextureWidthSpinBox->setValue( width );
2816 mTextureWidthSpinBox->blockSignals(
false );
2818 mRotationSpinBox->blockSignals(
true );
2820 mRotationSpinBox->blockSignals(
false );
2821 mTextureWidthUnitWidget->blockSignals(
true );
2824 mTextureWidthUnitWidget->blockSignals(
false );
2825 mSvgStrokeWidthUnitWidget->blockSignals(
true );
2828 mSvgStrokeWidthUnitWidget->blockSignals(
false );
2829 mChangeColorButton->blockSignals(
true );
2831 mChangeColorButton->blockSignals(
false );
2832 mChangeStrokeColorButton->blockSignals(
true );
2834 mChangeStrokeColorButton->blockSignals(
false );
2835 mStrokeWidthSpinBox->blockSignals(
true );
2837 mStrokeWidthSpinBox->blockSignals(
false );
2861 void QgsSVGFillSymbolLayerWidget::mTextureWidthSpinBox_valueChanged(
double d )
2870 void QgsSVGFillSymbolLayerWidget::svgSourceChanged(
const QString &text )
2882 void QgsSVGFillSymbolLayerWidget::setFile(
const QString &name )
2885 whileBlocking( mSvgSelectorWidget->sourceLineEdit() )->setSource( name );
2891 void QgsSVGFillSymbolLayerWidget::setSvgParameters(
const QMap<QString, QgsProperty> ¶meters )
2894 whileBlocking( mSvgSelectorWidget )->setSvgParameters( parameters );
2901 void QgsSVGFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
2913 bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
2914 QColor defaultFill, defaultStroke;
2915 double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
2916 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
2918 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2919 hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
2920 hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
2921 hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
2924 QColor fill = mChangeColorButton->color();
2925 double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
2926 if ( hasDefaultFillColor )
2930 fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2931 mChangeColorButton->setColor( fill );
2933 mChangeColorButton->setEnabled( hasFillParam );
2934 mChangeColorButton->setAllowOpacity( hasFillOpacityParam );
2937 QColor stroke = mChangeStrokeColorButton->color();
2938 double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
2939 if ( hasDefaultStrokeColor )
2941 stroke = defaultStroke;
2943 stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
2944 mChangeStrokeColorButton->setColor( stroke );
2946 mChangeStrokeColorButton->setEnabled( hasStrokeParam );
2947 mChangeStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
2948 if ( hasDefaultStrokeWidth && resetValues )
2950 mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
2952 mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
2955 void QgsSVGFillSymbolLayerWidget::mChangeColorButton_colorChanged(
const QColor &color )
2966 void QgsSVGFillSymbolLayerWidget::mChangeStrokeColorButton_colorChanged(
const QColor &color )
2977 void QgsSVGFillSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
2986 void QgsSVGFillSymbolLayerWidget::mTextureWidthUnitWidget_changed()
2996 void QgsSVGFillSymbolLayerWidget::mSvgStrokeWidthUnitWidget_changed()
3012 connect( mAngleSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged );
3013 connect( mDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged );
3014 connect( mOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged );
3021 mOffsetSpinBox->setClearValue( 0 );
3022 mAngleSpinBox->setClearValue( 0 );
3027 if ( layer->
layerType() != QLatin1String(
"LinePatternFill" ) )
3036 mAngleSpinBox->blockSignals(
true );
3038 mAngleSpinBox->blockSignals(
false );
3039 mDistanceSpinBox->blockSignals(
true );
3041 mDistanceSpinBox->blockSignals(
false );
3042 mOffsetSpinBox->blockSignals(
true );
3044 mOffsetSpinBox->blockSignals(
false );
3047 mDistanceUnitWidget->blockSignals(
true );
3050 mDistanceUnitWidget->blockSignals(
false );
3051 mOffsetUnitWidget->blockSignals(
true );
3054 mOffsetUnitWidget->blockSignals(
false );
3066 void QgsLinePatternFillSymbolLayerWidget::mAngleSpinBox_valueChanged(
double d )
3075 void QgsLinePatternFillSymbolLayerWidget::mDistanceSpinBox_valueChanged(
double d )
3084 void QgsLinePatternFillSymbolLayerWidget::mOffsetSpinBox_valueChanged(
double d )
3093 void QgsLinePatternFillSymbolLayerWidget::mDistanceUnitWidget_changed()
3103 void QgsLinePatternFillSymbolLayerWidget::mOffsetUnitWidget_changed()
3119 connect( mHorizontalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged );
3120 connect( mVerticalDistanceSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged );
3121 connect( mHorizontalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged );
3122 connect( mVerticalDisplacementSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged );
3123 connect( mHorizontalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged );
3124 connect( mVerticalOffsetSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged );
3125 connect( mHorizontalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed );
3126 connect( mVerticalDistanceUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed );
3127 connect( mHorizontalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed );
3128 connect( mVerticalDisplacementUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed );
3129 connect( mHorizontalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed );
3130 connect( mVerticalOffsetUnitWidget, &
QgsUnitSelectionWidget::changed,
this, &QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed );
3148 if ( !layer || layer->
layerType() != QLatin1String(
"PointPatternFill" ) )
3161 mHorizontalDistanceUnitWidget->blockSignals(
true );
3164 mHorizontalDistanceUnitWidget->blockSignals(
false );
3165 mVerticalDistanceUnitWidget->blockSignals(
true );
3168 mVerticalDistanceUnitWidget->blockSignals(
false );
3169 mHorizontalDisplacementUnitWidget->blockSignals(
true );
3172 mHorizontalDisplacementUnitWidget->blockSignals(
false );
3173 mVerticalDisplacementUnitWidget->blockSignals(
true );
3176 mVerticalDisplacementUnitWidget->blockSignals(
false );
3177 mHorizontalOffsetUnitWidget->blockSignals(
true );
3180 mHorizontalOffsetUnitWidget->blockSignals(
false );
3181 mVerticalOffsetUnitWidget->blockSignals(
true );
3184 mVerticalOffsetUnitWidget->blockSignals(
false );
3199 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceSpinBox_valueChanged(
double d )
3208 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceSpinBox_valueChanged(
double d )
3217 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementSpinBox_valueChanged(
double d )
3226 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementSpinBox_valueChanged(
double d )
3235 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetSpinBox_valueChanged(
double d )
3244 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetSpinBox_valueChanged(
double d )
3253 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDistanceUnitWidget_changed()
3263 void QgsPointPatternFillSymbolLayerWidget::mVerticalDistanceUnitWidget_changed()
3273 void QgsPointPatternFillSymbolLayerWidget::mHorizontalDisplacementUnitWidget_changed()
3283 void QgsPointPatternFillSymbolLayerWidget::mVerticalDisplacementUnitWidget_changed()
3293 void QgsPointPatternFillSymbolLayerWidget::mHorizontalOffsetUnitWidget_changed()
3303 void QgsPointPatternFillSymbolLayerWidget::mVerticalOffsetUnitWidget_changed()
3324 connect( mStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged );
3325 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3326 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3336 scrollArea->setVerticalOnly(
true );
3338 btnColor->setAllowOpacity(
true );
3339 btnColor->setColorDialogTitle( tr(
"Select Symbol Fill Color" ) );
3340 btnColor->setContext( QStringLiteral(
"symbology" ) );
3341 btnStrokeColor->setAllowOpacity(
true );
3342 btnStrokeColor->setColorDialogTitle( tr(
"Select Symbol Stroke Color" ) );
3343 btnStrokeColor->setContext( QStringLiteral(
"symbology" ) );
3345 mColorDDBtn->registerLinkedWidget( btnColor );
3346 mStrokeColorDDBtn->registerLinkedWidget( btnStrokeColor );
3348 spinOffsetX->setClearValue( 0.0 );
3349 spinOffsetY->setClearValue( 0.0 );
3350 spinAngle->setClearValue( 0.0 );
3356 mSizeDDBtn->setSymbol( mAssistantPreviewSymbol );
3359 connect( mFontStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged );
3361 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3364 connect( cboJoinStyle,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged );
3366 connect( spinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3367 connect( spinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsFontMarkerSymbolLayerWidget::setOffset );
3376 if ( layer->
layerType() != QLatin1String(
"FontMarker" ) )
3385 mFontStyleComboBox->blockSignals(
true );
3386 populateFontStyleComboBox();
3387 mFontStyleComboBox->blockSignals(
false );
3405 mCharPreview->setFont( mRefFont );
3411 mSizeUnitWidget->blockSignals(
true );
3414 mSizeUnitWidget->blockSignals(
false );
3416 mStrokeWidthUnitWidget->blockSignals(
true );
3419 mStrokeWidthUnitWidget->blockSignals(
false );
3421 mOffsetUnitWidget->blockSignals(
true );
3424 mOffsetUnitWidget->blockSignals(
false );
3445 updateAssistantSymbol();
3458 mRefFont.setFamily( font.family() );
3460 mCharPreview->setFont( mRefFont );
3461 populateFontStyleComboBox();
3466 void QgsFontMarkerSymbolLayerWidget::setFontStyle(
const QString &style )
3473 mCharPreview->setFont( mRefFont );
3505 mCharPreview->setText( text );
3507 if ( text.isEmpty() )
3511 QString character = text;
3512 if ( text.contains( QRegularExpression( QStringLiteral(
"^0x[0-9a-fA-F]{1,4}$" ) ) ) )
3515 unsigned int value = text.toUInt( &ok, 0 );
3518 character = QChar( value );
3519 mCharPreview->setText( character );
3540 if (
mLayer->
character().length() > 1 || QGuiApplication::keyboardModifiers() & Qt::ControlModifier )
3542 mCharLineEdit->insert( chr );
3548 mCharPreview->setText( chr );
3552 void QgsFontMarkerSymbolLayerWidget::setOffset()
3554 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
3558 void QgsFontMarkerSymbolLayerWidget::penJoinStyleChanged()
3564 void QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3574 void QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3584 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
3594 void QgsFontMarkerSymbolLayerWidget::populateFontStyleComboBox()
3596 mFontStyleComboBox->clear();
3597 QStringList styles = mFontDB.styles( mRefFont.family() );
3598 const auto constStyles = styles;
3599 for (
const QString &style : constStyles )
3601 mFontStyleComboBox->addItem( style );
3604 QString targetStyle = mFontDB.styleString( mRefFont );
3605 if ( !styles.contains( targetStyle ) )
3607 QFont f = QFont( mRefFont.family() );
3608 targetStyle = QFontInfo( f ).styleName();
3609 mRefFont.setStyleName( targetStyle );
3612 int stylIndx = mFontStyleComboBox->findText( targetStyle );
3613 if ( stylIndx > -1 )
3618 mFontStyleComboBox->setCurrentIndex( curIndx );
3621 void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged(
int index )
3624 setFontStyle( mFontStyleComboBox->currentText() );
3627 void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3636 void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
3645 void QgsFontMarkerSymbolLayerWidget::mStrokeWidthSpinBox_valueChanged(
double d )
3654 void QgsFontMarkerSymbolLayerWidget::updateAssistantSymbol()
3656 for (
int i = mAssistantPreviewSymbol->symbolLayerCount() - 1 ; i >= 0; --i )
3658 mAssistantPreviewSymbol->deleteSymbolLayer( i );
3660 mAssistantPreviewSymbol->appendSymbolLayer(
mLayer->
clone() );
3663 mAssistantPreviewSymbol->setDataDefinedSize( ddSize );
3675 connect( mDrawInsideCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged );
3676 connect( mDrawAllPartsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged );
3677 connect( mClipPointsCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged );
3678 connect( mClipOnCurrentPartOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged );
3683 if ( layer->
layerType() != QLatin1String(
"CentroidFill" ) )
3701 void QgsCentroidFillSymbolLayerWidget::mDrawInsideCheckBox_stateChanged(
int state )
3707 void QgsCentroidFillSymbolLayerWidget::mDrawAllPartsCheckBox_stateChanged(
int state )
3713 void QgsCentroidFillSymbolLayerWidget::mClipPointsCheckBox_stateChanged(
int state )
3719 void QgsCentroidFillSymbolLayerWidget::mClipOnCurrentPartOnlyCheckBox_stateChanged(
int state )
3734 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
3738 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setAngle );
3740 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setWidth );
3741 connect( mHeightSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setHeight );
3749 mSpinOffsetX->setClearValue( 0.0 );
3750 mSpinOffsetY->setClearValue( 0.0 );
3751 mRotationSpinBox->setClearValue( 0.0 );
3753 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3754 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::setOffset );
3757 connect( mHorizontalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
3758 connect( mVerticalAnchorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged );
3768 if ( layer->
layerType() != QLatin1String(
"RasterMarker" ) )
3779 mHeightSpinBox->blockSignals(
true );
3780 if ( preservedAspectRatio )
3789 mHeightSpinBox->blockSignals(
false );
3790 whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
3798 mSizeUnitWidget->blockSignals(
true );
3801 mSizeUnitWidget->blockSignals(
false );
3802 mOffsetUnitWidget->blockSignals(
true );
3805 mOffsetUnitWidget->blockSignals(
false );
3820 updatePreviewImage();
3834 void QgsRasterMarkerSymbolLayerWidget::imageSourceChanged(
const QString &text )
3837 updatePreviewImage();
3841 void QgsRasterMarkerSymbolLayerWidget::updatePreviewImage()
3843 bool fitsInCache =
false;
3845 if ( image.isNull() )
3847 mLabelImagePreview->setPixmap( QPixmap() );
3851 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
3852 previewImage.fill( Qt::transparent );
3853 QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
3855 p.begin( &previewImage );
3857 uchar pixDataRGB[] = { 150, 150, 150, 150,
3862 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
3863 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
3864 QBrush checkerBrush;
3865 checkerBrush.setTexture( pix );
3866 p.fillRect( imageRect, checkerBrush );
3873 p.drawImage( imageRect.left(), imageRect.top(), image );
3875 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
3878 void QgsRasterMarkerSymbolLayerWidget::setWidth()
3881 double fixedAspectRatio = 0.0;
3882 mHeightSpinBox->blockSignals(
true );
3883 if ( defaultAspectRatio <= 0.0 )
3885 mHeightSpinBox->setValue( mWidthSpinBox->value() );
3887 else if ( mLockAspectRatio->locked() )
3889 mHeightSpinBox->setValue( mWidthSpinBox->value() * defaultAspectRatio );
3893 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3895 mHeightSpinBox->blockSignals(
false );
3901 void QgsRasterMarkerSymbolLayerWidget::setHeight()
3904 double fixedAspectRatio = 0.0;
3905 mWidthSpinBox->blockSignals(
true );
3906 if ( defaultAspectRatio <= 0.0 )
3908 mWidthSpinBox->setValue( mHeightSpinBox->value() );
3910 else if ( mLockAspectRatio->locked() )
3912 mWidthSpinBox->setValue( mHeightSpinBox->value() / defaultAspectRatio );
3916 fixedAspectRatio = mHeightSpinBox->value() / mWidthSpinBox->value();
3918 mWidthSpinBox->blockSignals(
false );
3924 void QgsRasterMarkerSymbolLayerWidget::setLockAspectRatio(
const bool locked )
3927 if ( defaultAspectRatio <= 0.0 )
3942 void QgsRasterMarkerSymbolLayerWidget::setAngle()
3948 void QgsRasterMarkerSymbolLayerWidget::setOpacity(
double value )
3952 updatePreviewImage();
3955 void QgsRasterMarkerSymbolLayerWidget::setOffset()
3957 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
3961 void QgsRasterMarkerSymbolLayerWidget::mSizeUnitWidget_changed()
3971 void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
3981 void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged(
int index )
3990 void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged(
int index )
4007 mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral(
"/UI/lastRasterMarkerImageDir" ) );
4011 connect( mRotationSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged );
4013 connect( mWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged );
4020 mSpinOffsetX->setClearValue( 0.0 );
4021 mSpinOffsetY->setClearValue( 0.0 );
4022 mRotationSpinBox->setClearValue( 0.0 );
4024 connect( cboCoordinateMode,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRasterFillSymbolLayerWidget::setCoordinateMode );
4025 connect( mSpinOffsetX,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4026 connect( mSpinOffsetY,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRasterFillSymbolLayerWidget::offsetChanged );
4038 if ( layer->
layerType() != QLatin1String(
"RasterFill" ) )
4051 cboCoordinateMode->blockSignals(
true );
4055 cboCoordinateMode->setCurrentIndex( 1 );
4059 cboCoordinateMode->setCurrentIndex( 0 );
4062 cboCoordinateMode->blockSignals(
false );
4068 mOffsetUnitWidget->blockSignals(
true );
4071 mOffsetUnitWidget->blockSignals(
false );
4074 mWidthUnitWidget->blockSignals(
true );
4077 mWidthUnitWidget->blockSignals(
false );
4079 updatePreviewImage();
4093 void QgsRasterFillSymbolLayerWidget::imageSourceChanged(
const QString &text )
4096 updatePreviewImage();
4100 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
4117 void QgsRasterFillSymbolLayerWidget::opacityChanged(
double value )
4126 updatePreviewImage();
4129 void QgsRasterFillSymbolLayerWidget::offsetChanged()
4131 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
4135 void QgsRasterFillSymbolLayerWidget::mOffsetUnitWidget_changed()
4146 void QgsRasterFillSymbolLayerWidget::mRotationSpinBox_valueChanged(
double d )
4155 void QgsRasterFillSymbolLayerWidget::mWidthUnitWidget_changed()
4166 void QgsRasterFillSymbolLayerWidget::mWidthSpinBox_valueChanged(
double d )
4176 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
4178 bool fitsInCache =
false;
4180 if ( image.isNull() )
4182 mLabelImagePreview->setPixmap( QPixmap() );
4186 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
4187 previewImage.fill( Qt::transparent );
4188 QRect imageRect( ( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
4190 p.begin( &previewImage );
4192 uchar pixDataRGB[] = { 150, 150, 150, 150,
4197 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
4198 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
4199 QBrush checkerBrush;
4200 checkerBrush.setTexture( pix );
4201 p.fillRect( imageRect, checkerBrush );
4208 p.drawImage( imageRect.left(), imageRect.top(), image );
4210 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
4219 modificationExpressionSelector->setMultiLine(
true );
4220 modificationExpressionSelector->setLayer(
const_cast<QgsVectorLayer *
>( vl ) );
4221 modificationExpressionSelector->registerExpressionContextGenerator(
this );
4226 connect( cbxGeometryType,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType );
4233 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData( mLayer->
symbolType() ) );
4241 void QgsGeometryGeneratorSymbolLayerWidget::updateExpression(
const QString &
string )
4248 void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
4268 mPointCountSpinBox->setShowClearButton(
true );
4269 mPointCountSpinBox->setClearValue( 100 );
4270 mSeedSpinBox->setShowClearButton(
true );
4271 mSeedSpinBox->setClearValue( 0 );
4273 connect( mCountMethodComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged );
4274 connect( mPointCountSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::countChanged );
4275 connect( mDensityAreaSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged );
4276 connect( mSeedSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsRandomMarkerFillSymbolLayerWidget::seedChanged );
4277 connect( mClipPointsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
4294 if ( !layer || layer->
layerType() != QLatin1String(
"RandomMarkerFill" ) )
4304 bool showDensityBasedCountWidgets =
false;
4308 showDensityBasedCountWidgets =
true;
4313 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4314 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4315 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4316 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4320 mDensityAreaUnitWidget->blockSignals(
true );
4323 mDensityAreaUnitWidget->blockSignals(
false );
4336 void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged(
int )
4339 bool showDensityBasedCountWidgets =
false;
4343 showDensityBasedCountWidgets =
true;
4348 mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
4349 mDensityAreaSpinBox->setVisible( showDensityBasedCountWidgets );
4350 mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
4351 mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
4360 void QgsRandomMarkerFillSymbolLayerWidget::countChanged(
int d )
4369 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaChanged(
double d )
4378 void QgsRandomMarkerFillSymbolLayerWidget::densityAreaUnitChanged()
4388 void QgsRandomMarkerFillSymbolLayerWidget::seedChanged(
int d )
static const double UI_SCALE_FACTOR
UI scaling factor.
void sourceChanged(const QString &source)
Emitted whenever the file source is changed in the widget.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
bool exists(const QgsPropertyDefinition &definition) const
Returns true if the property is stored in the layer already, false otherwise.
void setPointOnAllParts(bool pointOnAllParts)
Sets whether a point is drawn for all parts or only on the biggest part of multi-part features.
bool pointOnSurface() const
void setClipOnCurrentPartOnly(bool clipOnCurrentPartOnly)
Sets whether point markers should be clipped to the current part boundary only.
void setClipPoints(bool clipPoints)
Sets whether point markers should be clipped to the polygon boundary.
bool pointOnAllParts() const
Returns whether a point is drawn for all parts or only on the biggest part of multi-part features.
bool clipPoints() const
Returns true if point markers should be clipped to the polygon boundary.
bool clipOnCurrentPartOnly() const
Returns true if point markers should be clipped to the current part boundary only.
void setPointOnSurface(bool pointOnSurface)
Abstract base class for color ramps.
A dialog to enter a custom dash space pattern for lines.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
bool hasVariable(const QString &name) const
Check whether a variable is specified by any scope within the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
void expressionChanged(const QString &expression)
Emitted when the expression is changed.
void setAngle(double angle)
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
QgsFilledMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setStrokeColor(const QColor &color) override
Set stroke color.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
double strokeWidth() const
Returns the marker's stroke width.
void setFontStyle(const QString &style)
Sets the font style for the font which will be used to render the point.
QString fontStyle() const
Returns the font style for the associated font which will be used to render the point.
QColor strokeColor() const override
Gets stroke color.
QString fontFamily() const
Returns the font family name for the associated font which will be used to render the point.
void setCharacter(QString chr)
Sets the character(s) used when rendering points.
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the stroke width unit.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the stroke width unit.
void setFontFamily(const QString &family)
Sets the font family for the font which will be used to render the point.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
void setStrokeWidth(double width)
Set's the marker's stroke width.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the stroke join style.
QgsFontMarkerSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Qt::PenJoinStyle penJoinStyle() const
Returns the stroke join style.
QString character() const
Returns the character(s) used when rendering points.
static QString translateNamedStyle(const QString &namedStyle)
Returns the localized named style of a font, if such a translation is available.
static QString untranslateNamedStyle(const QString &namedStyle)
Returns the english named style of a font, if possible.
static bool updateFontViaStyle(QFont &f, const QString &fontstyle, bool fallback=false)
Updates font with named style and retain all font properties.
QString geometryExpression() const
Gets the expression to generate this geometry.
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
QgsSymbol::SymbolType symbolType() const
Access the symbol type.
void setSymbolType(QgsSymbol::SymbolType symbolType)
Set the type of symbol which should be created.
QgsColorRamp * colorRamp()
Returns the color ramp used for the gradient fill.
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp used for the gradient fill.
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient. Controls how the gradient stops are positioned.
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
void setGradientType(GradientType gradientType)
void setCoordinateMode(GradientCoordinateMode coordinateMode)
GradientSpread gradientSpread() const
Gradient spread mode. Controls how the gradient behaves outside of the predefined stops.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the fill's offset.
bool referencePoint2IsCentroid() const
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
void setGradientColorType(GradientColorType gradientColorType)
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
void setGradientSpread(GradientSpread gradientSpread)
void setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
void setReferencePoint1IsCentroid(bool isCentroid)
Sets the starting point of the gradient to be the feature centroid.
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
QPointF referencePoint1() const
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
QPointF offset() const
Returns the offset by which polygons will be translated during rendering.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
GradientType gradientType() const
Type of gradient, e.g., linear or radial.
bool referencePoint1IsCentroid() const
QPointF referencePoint2() const
void setColor2(const QColor &color2)
Line symbol layer type which draws repeating line sections along a line feature.
void setHashLength(double length)
Sets the length of hash symbols.
double hashAngle() const
Returns the angle to use when drawing the hashed lines sections, in degrees clockwise.
QgsUnitTypes::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
void setHashLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the length of hash symbols.
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
double hashLength() const
Returns the length of hash symbols.
void setHashAngle(double angle)
Sets the angle to use when drawing the hashed lines sections, in degrees clockwise.
QImage pathAsImage(const QString &path, const QSize size, const bool keepAspectRatio, const double opacity, bool &fitsInCache, bool blocking=false, bool *isMissing=nullptr)
Returns the specified path rendered as an image.
static QIcon iconPolygon()
A symbol fill consisting of repeated parallel lines.
void setMapUnitScale(const QgsMapUnitScale &scale) override
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the pattern's line offset.
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line distance.
double lineAngle() const
Returns the angle for the parallel lines used to fill the symbol.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line pattern's offset.
void setDistance(double d)
Sets the distance between lines in the fill pattern.
void setDistanceUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the distance between lines in the fill pattern.
void setLineAngle(double a)
Sets the angle for the parallel lines used to fill the symbol.
double offset() const
Returns the offset distance for lines within the fill, which is the distance to offset the parallel l...
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line pattern's offset.
double distance() const
Returns the distance between lines in the fill pattern.
QgsUnitTypes::RenderUnit distanceUnit() const
Returns the units for the distance between lines in the fill pattern.
void setOffset(double offset)
Sets the offset distance for lines within the fill, which is the distance to offset the parallel line...
const QgsMapUnitScale & distanceMapUnitScale() const
Returns the map unit scale for the pattern's line distance.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line offset.
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon's rings.
@ ExteriorRingOnly
Render the exterior ring only.
@ InteriorRingsOnly
Render the interior rings only.
@ AllRings
Render both exterior and interior rings.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line's offset.
virtual void setWidth(double width)
Sets the width of the line symbol layer.
RenderRingFilter ringFilter() const
Returns the line symbol layer's ring filter, which controls which rings are rendered when the line sy...
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the line's offset.
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
void setWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line's width.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line's offset.
void setOffset(double offset)
Sets the line's offset.
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the line's width.
virtual double width() const
Returns the estimated width for the line symbol layer.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale 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...
double offset() const
Returns the line's offset.
const QgsMapUnitScale & widthMapUnitScale() const
A line symbol type, for rendering LineString and MultiLineString geometries.
Line symbol layer type which draws repeating marker symbols along a line feature.
virtual void setSize(double size)
Sets the symbol size.
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
HorizontalAnchorPoint
Symbol horizontal anchor points.
void setAngle(double angle)
Sets the rotation angle for the marker.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's size.
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
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 symbol's offset.
double size() const
Returns the symbol size.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the symbol's offset.
VerticalAnchorPoint verticalAnchorPoint() const
Returns the vertical anchor point for positioning the symbol.
HorizontalAnchorPoint horizontalAnchorPoint() const
Returns the horizontal anchor point for positioning the symbol.
VerticalAnchorPoint
Symbol vertical anchor points.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's offset.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's offset.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
A marker symbol type, for rendering Point and MultiPoint geometries.
A dialog to create a new auxiliary field.
A dialog to create a new auxiliary layer.
void setDisplacementX(double d)
const QgsMapUnitScale & displacementYMapUnitScale() const
void setOffsetYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical offset for rows in the pattern.
void setOffsetX(double offset)
Sets the horizontal offset values for points in the pattern.
QgsUnitTypes::RenderUnit offsetYUnit() const
Returns the units for the vertical offset for rows in the pattern.
double displacementY() const
const QgsMapUnitScale & offsetYMapUnitScale() const
Returns the unit scale for the vertical offset between rows in the pattern.
QgsUnitTypes::RenderUnit displacementYUnit() const
Returns the units for the vertical displacement between rows in the pattern.
QgsUnitTypes::RenderUnit distanceYUnit() const
Returns the units for the vertical distance between points in the pattern.
double offsetY() const
Returns the vertical offset values for points in the pattern.
void setDisplacementY(double d)
const QgsMapUnitScale & distanceYMapUnitScale() const
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
void setOffsetY(double offset)
Sets the vertical offset values for points in the pattern.
QgsUnitTypes::RenderUnit offsetXUnit() const
Returns the units for the horizontal offset for rows in the pattern.
void setDistanceXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal distance between points in the pattern.
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
const QgsMapUnitScale & offsetXMapUnitScale() const
Returns the unit scale for the horizontal offset for rows in the pattern.
void setOffsetYMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the vertical offset for rows in the pattern.
void setDistanceY(double d)
void setDisplacementYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical displacement between rows in the pattern.
void setDistanceX(double d)
double offsetX() const
Returns the horizontal offset values for points in the pattern.
void setDisplacementXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal displacement between rows in the pattern.
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
QgsUnitTypes::RenderUnit displacementXUnit() const
Returns the units for the horizontal displacement between rows in the pattern.
double displacementX() const
void setOffsetXMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the horizontal offset for rows in the pattern.
void setOffsetXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal offset between rows in the pattern.
const QgsMapUnitScale & distanceXMapUnitScale() const
QgsUnitTypes::RenderUnit distanceXUnit() const
Returns the units for the horizontal distance between points in the pattern.
void setDistanceYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical distance between points in the pattern.
const QgsMapUnitScale & displacementXMapUnitScale() const
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
Definition for a property.