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 );
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 changed(QgsUnitTypes::LayoutUnit unit)
Emitted when the unit is changed.
Interface for master layout type objects, such as print layouts and reports.