34 connect( mShapeComboBox, &QComboBox::currentTextChanged,
this, &QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged );
35 connect( mCornerRadiusSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged );
43 mainLayout->addWidget( mItemPropertiesWidget );
45 blockAllSignals(
true );
53 mRadiusUnitsComboBox->linkToWidget( mCornerRadiusSpinBox );
54 mRadiusUnitsComboBox->setConverter( &mShape->layout()->renderContext().measurementConverter() );
56 setGuiElementValues();
58 blockAllSignals(
false );
61 mShapeStyleButton->registerExpressionContextGenerator( mShape );
67 if ( mShape->layout() )
75 if ( mItemPropertiesWidget )
89 mShape = qobject_cast< QgsLayoutItemShape * >( item );
90 mItemPropertiesWidget->
setItem( mShape );
95 mShapeStyleButton->registerExpressionContextGenerator( mShape );
98 setGuiElementValues();
103void QgsLayoutShapeWidget::blockAllSignals(
bool block )
105 mShapeComboBox->blockSignals( block );
106 mCornerRadiusSpinBox->blockSignals( block );
107 mRadiusUnitsComboBox->blockSignals( block );
108 mShapeStyleButton->blockSignals( block );
111void QgsLayoutShapeWidget::setGuiElementValues()
118 blockAllSignals(
true );
120 mShapeStyleButton->setSymbol( mShape->symbol()->clone() );
122 mCornerRadiusSpinBox->setValue( mShape->cornerRadius().length() );
123 mRadiusUnitsComboBox->setUnit( mShape->cornerRadius().units() );
125 mShapeComboBox->setCurrentIndex( mShapeComboBox->findData( mShape->shapeType() ) );
126 toggleRadiusSpin( mShape->shapeType() );
128 blockAllSignals(
false );
131void QgsLayoutShapeWidget::symbolChanged()
137 mShape->setSymbol( mShapeStyleButton->clonedSymbol<
QgsFillSymbol>() );
138 mShape->layout()->undoStack()->endCommand();
141void QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged(
double val )
148 mShape->layout()->undoStack()->endCommand();
152void QgsLayoutShapeWidget::radiusUnitsChanged()
158 mShape->setCornerRadius(
QgsLayoutMeasurement( mCornerRadiusSpinBox->value(), mRadiusUnitsComboBox->unit() ) );
159 mShape->layout()->undoStack()->endCommand();
163void QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged(
const QString & )
170 mShape->layout()->undoStack()->beginCommand( mShape, tr(
"Change Shape Type" ) );
172 mShape->setShapeType( shape );
173 toggleRadiusSpin( shape );
175 mShape->layout()->undoStack()->endCommand();
185 mCornerRadiusSpinBox->setEnabled(
false );
190 mCornerRadiusSpinBox->setEnabled(
true );
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Layout item for basic filled shapes (e.g.
@ Rectangle
Rectangle shape.
@ Triangle
Triangle shape.
Base class for graphical items within a QgsLayout.
@ UndoShapeCornerRadius
Shape corner radius.
@ UndoShapeStyle
Shape symbol style.
int type() const override
Returns a unique graphics item type identifier.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
void changed()
Emitted when the object's properties change.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
void unitChanged(Qgis::LayoutUnit unit)
Emitted when the unit is changed.
Interface for master layout type objects, such as print layouts and reports.