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();
102void QgsLayoutShapeWidget::blockAllSignals(
bool block )
104 mShapeComboBox->blockSignals( block );
105 mCornerRadiusSpinBox->blockSignals( block );
106 mRadiusUnitsComboBox->blockSignals( block );
107 mShapeStyleButton->blockSignals( block );
110void 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 );
130void QgsLayoutShapeWidget::symbolChanged()
136 mShape->setSymbol( mShapeStyleButton->clonedSymbol<
QgsFillSymbol>() );
137 mShape->layout()->undoStack()->endCommand();
140void QgsLayoutShapeWidget::mCornerRadiusSpinBox_valueChanged(
double val )
147 mShape->layout()->undoStack()->endCommand();
151void QgsLayoutShapeWidget::radiusUnitsChanged()
157 mShape->setCornerRadius(
QgsLayoutMeasurement( mCornerRadiusSpinBox->value(), mRadiusUnitsComboBox->unit() ) );
158 mShape->layout()->undoStack()->endCommand();
162void 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 );
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.