33 connect( mShapeComboBox, &QComboBox::currentTextChanged,
this, &QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged );
34 connect( mCornerRadiusSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged );
42 mainLayout->addWidget( mItemPropertiesWidget );
44 blockAllSignals(
true );
52 mRadiusUnitsComboBox->linkToWidget( mCornerRadiusSpinBox );
53 mRadiusUnitsComboBox->setConverter( &mShape->layout()->renderContext().measurementConverter() );
55 setGuiElementValues();
57 blockAllSignals(
false );
60 mShapeStyleButton->registerExpressionContextGenerator( mShape );
66 if ( mShape->layout() )
74 if ( mItemPropertiesWidget )
88 mShape = qobject_cast< QgsLayoutItemShape * >( item );
89 mItemPropertiesWidget->
setItem( mShape );
94 mShapeStyleButton->registerExpressionContextGenerator( mShape );
97 setGuiElementValues();
102 void QgsLayoutShapeWidget::blockAllSignals(
bool block )
104 mShapeComboBox->blockSignals( block );
105 mCornerRadiusSpinBox->blockSignals( block );
106 mRadiusUnitsComboBox->blockSignals( block );
107 mShapeStyleButton->blockSignals( block );
110 void QgsLayoutShapeWidget::setGuiElementValues()
117 blockAllSignals(
true );
119 mShapeStyleButton->setSymbol( mShape->symbol()->clone() );
121 mCornerRadiusSpinBox->setValue( mShape->cornerRadius().length() );
122 mRadiusUnitsComboBox->setUnit( mShape->cornerRadius().units() );
124 mShapeComboBox->setCurrentIndex( mShapeComboBox->findData( mShape->shapeType() ) );
125 toggleRadiusSpin( mShape->shapeType() );
127 blockAllSignals(
false );
130 void QgsLayoutShapeWidget::symbolChanged()
136 mShape->setSymbol( mShapeStyleButton->clonedSymbol<
QgsFillSymbol>() );
137 mShape->layout()->undoStack()->endCommand();
140 void QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged(
double val )
147 mShape->layout()->undoStack()->endCommand();
151 void QgsLayoutShapeWidget::radiusUnitsChanged()
157 mShape->setCornerRadius(
QgsLayoutMeasurement( mCornerRadiusSpinBox->value(), mRadiusUnitsComboBox->unit() ) );
158 mShape->layout()->undoStack()->endCommand();
162 void QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged(
const QString & )
169 mShape->layout()->undoStack()->beginCommand( mShape, tr(
"Change Shape Type" ) );
171 mShape->setShapeType( shape );
172 toggleRadiusSpin( shape );
174 mShape->layout()->undoStack()->endCommand();
184 mCornerRadiusSpinBox->setEnabled(
false );
189 mCornerRadiusSpinBox->setEnabled(
true );