32 connect( mShapeComboBox, &QComboBox::currentTextChanged,
this, &QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged );
33 connect( mCornerRadiusSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged );
41 mainLayout->addWidget( mItemPropertiesWidget );
43 blockAllSignals(
true );
51 mRadiusUnitsComboBox->linkToWidget( mCornerRadiusSpinBox );
52 mRadiusUnitsComboBox->setConverter( &mShape->layout()->renderContext().measurementConverter() );
54 setGuiElementValues();
56 blockAllSignals(
false );
59 mShapeStyleButton->registerExpressionContextGenerator( mShape );
65 if ( mShape->layout() )
73 if ( mItemPropertiesWidget )
87 mShape = qobject_cast< QgsLayoutItemShape * >( item );
88 mItemPropertiesWidget->
setItem( mShape );
93 mShapeStyleButton->registerExpressionContextGenerator( mShape );
96 setGuiElementValues();
101 void QgsLayoutShapeWidget::blockAllSignals(
bool block )
103 mShapeComboBox->blockSignals( block );
104 mCornerRadiusSpinBox->blockSignals( block );
105 mRadiusUnitsComboBox->blockSignals( block );
106 mShapeStyleButton->blockSignals( block );
109 void QgsLayoutShapeWidget::setGuiElementValues()
116 blockAllSignals(
true );
118 mShapeStyleButton->setSymbol( mShape->symbol()->clone() );
120 mCornerRadiusSpinBox->setValue( mShape->cornerRadius().length() );
121 mRadiusUnitsComboBox->setUnit( mShape->cornerRadius().units() );
123 mShapeComboBox->setCurrentIndex( mShapeComboBox->findData( mShape->shapeType() ) );
124 toggleRadiusSpin( mShape->shapeType() );
126 blockAllSignals(
false );
129 void QgsLayoutShapeWidget::symbolChanged()
135 mShape->setSymbol( mShapeStyleButton->clonedSymbol<
QgsFillSymbol>() );
136 mShape->layout()->undoStack()->endCommand();
139 void QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged(
double val )
146 mShape->layout()->undoStack()->endCommand();
150 void QgsLayoutShapeWidget::radiusUnitsChanged()
156 mShape->setCornerRadius(
QgsLayoutMeasurement( mCornerRadiusSpinBox->value(), mRadiusUnitsComboBox->unit() ) );
157 mShape->layout()->undoStack()->endCommand();
161 void QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged(
const QString & )
168 mShape->layout()->undoStack()->beginCommand( mShape, tr(
"Change Shape Type" ) );
170 mShape->setShapeType( shape );
171 toggleRadiusSpin( shape );
173 mShape->layout()->undoStack()->endCommand();
183 mCornerRadiusSpinBox->setEnabled(
false );
188 mCornerRadiusSpinBox->setEnabled(
true );