19#include "moc_qgslayoutshapewidget.cpp"
35 connect( mShapeComboBox, &QComboBox::currentTextChanged,
this, &QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged );
36 connect( mCornerRadiusSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged );
44 mainLayout->addWidget( mItemPropertiesWidget );
46 blockAllSignals(
true );
54 mRadiusUnitsComboBox->linkToWidget( mCornerRadiusSpinBox );
55 mRadiusUnitsComboBox->setConverter( &mShape->layout()->renderContext().measurementConverter() );
57 setGuiElementValues();
59 blockAllSignals(
false );
62 mShapeStyleButton->registerExpressionContextGenerator( mShape );
68 if ( mShape->layout() )
76 if ( mItemPropertiesWidget )
90 mShape = qobject_cast<QgsLayoutItemShape *>( item );
91 mItemPropertiesWidget->
setItem( mShape );
96 mShapeStyleButton->registerExpressionContextGenerator( mShape );
99 setGuiElementValues();
104void QgsLayoutShapeWidget::blockAllSignals(
bool block )
106 mShapeComboBox->blockSignals( block );
107 mCornerRadiusSpinBox->blockSignals( block );
108 mRadiusUnitsComboBox->blockSignals( block );
109 mShapeStyleButton->blockSignals( block );
112void QgsLayoutShapeWidget::setGuiElementValues()
119 blockAllSignals(
true );
121 mShapeStyleButton->setSymbol( mShape->symbol()->clone() );
123 mCornerRadiusSpinBox->setValue( mShape->cornerRadius().length() );
124 mRadiusUnitsComboBox->setUnit( mShape->cornerRadius().units() );
126 mShapeComboBox->setCurrentIndex( mShapeComboBox->findData( mShape->shapeType() ) );
127 toggleRadiusSpin( mShape->shapeType() );
129 blockAllSignals(
false );
132void QgsLayoutShapeWidget::symbolChanged()
138 mShape->setSymbol( mShapeStyleButton->clonedSymbol<
QgsFillSymbol>() );
139 mShape->layout()->undoStack()->endCommand();
142void QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged(
double val )
149 mShape->layout()->undoStack()->endCommand();
153void QgsLayoutShapeWidget::radiusUnitsChanged()
159 mShape->setCornerRadius(
QgsLayoutMeasurement( mCornerRadiusSpinBox->value(), mRadiusUnitsComboBox->unit() ) );
160 mShape->layout()->undoStack()->endCommand();
164void QgsLayoutShapeWidget::mShapeComboBox_currentIndexChanged(
const QString & )
171 mShape->layout()->undoStack()->beginCommand( mShape, tr(
"Change Shape Type" ) );
173 mShape->setShapeType( shape );
174 toggleRadiusSpin( shape );
176 mShape->layout()->undoStack()->endCommand();
186 mCornerRadiusSpinBox->setEnabled(
false );
191 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.