mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-19 00:04:52 -04:00
Merge pull request #31734 from elpaso/bugfix-gh31428-text-formatting-enable-disable
Update bg and buffer status in text format widget
This commit is contained in:
commit
4f9e4f121a
@ -472,6 +472,17 @@ void QgsTextFormatWidget::initWidget()
|
|||||||
|
|
||||||
connect( mQuadrantBtnGrp, static_cast<void ( QButtonGroup::* )( int )>( &QButtonGroup::buttonClicked ), this, &QgsTextFormatWidget::updatePreview );
|
connect( mQuadrantBtnGrp, static_cast<void ( QButtonGroup::* )( int )>( &QButtonGroup::buttonClicked ), this, &QgsTextFormatWidget::updatePreview );
|
||||||
|
|
||||||
|
connect( mBufferDrawDDBtn, &QgsPropertyOverrideButton::activated, this, &QgsTextFormatWidget::updateBufferFrameStatus );
|
||||||
|
connect( mBufferDrawChkBx, &QCheckBox::stateChanged, [ = ]( int )
|
||||||
|
{
|
||||||
|
updateBufferFrameStatus();
|
||||||
|
} );
|
||||||
|
connect( mShapeDrawDDBtn, &QgsPropertyOverrideButton::activated, this, &QgsTextFormatWidget::updateShapeFrameStatus );
|
||||||
|
connect( mShapeDrawChkBx, &QCheckBox::stateChanged, [ = ]( int )
|
||||||
|
{
|
||||||
|
updateShapeFrameStatus();
|
||||||
|
} );
|
||||||
|
|
||||||
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPolygonLayer.svg" ) ), tr( "Polygon / MultiPolygon" ), QgsWkbTypes::GeometryType::PolygonGeometry );
|
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPolygonLayer.svg" ) ), tr( "Polygon / MultiPolygon" ), QgsWkbTypes::GeometryType::PolygonGeometry );
|
||||||
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconLineLayer.svg" ) ), tr( "LineString / MultiLineString" ), QgsWkbTypes::GeometryType::LineGeometry );
|
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconLineLayer.svg" ) ), tr( "LineString / MultiLineString" ), QgsWkbTypes::GeometryType::LineGeometry );
|
||||||
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPointLayer.svg" ) ), tr( "Point / MultiPoint" ), QgsWkbTypes::GeometryType::PointGeometry );
|
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPointLayer.svg" ) ), tr( "Point / MultiPoint" ), QgsWkbTypes::GeometryType::PointGeometry );
|
||||||
@ -791,6 +802,7 @@ void QgsTextFormatWidget::updateWidgetForFormat( const QgsTextFormat &format )
|
|||||||
|
|
||||||
// buffer
|
// buffer
|
||||||
mBufferDrawChkBx->setChecked( buffer.enabled() );
|
mBufferDrawChkBx->setChecked( buffer.enabled() );
|
||||||
|
mBufferFrame->setEnabled( buffer.enabled() );
|
||||||
spinBufferSize->setValue( buffer.size() );
|
spinBufferSize->setValue( buffer.size() );
|
||||||
mBufferUnitWidget->setUnit( buffer.sizeUnit() );
|
mBufferUnitWidget->setUnit( buffer.sizeUnit() );
|
||||||
mBufferUnitWidget->setMapUnitScale( buffer.sizeMapUnitScale() );
|
mBufferUnitWidget->setMapUnitScale( buffer.sizeMapUnitScale() );
|
||||||
@ -843,6 +855,7 @@ void QgsTextFormatWidget::updateWidgetForFormat( const QgsTextFormat &format )
|
|||||||
|
|
||||||
// shape background
|
// shape background
|
||||||
mShapeDrawChkBx->setChecked( background.enabled() );
|
mShapeDrawChkBx->setChecked( background.enabled() );
|
||||||
|
mShapeFrame->setEnabled( background.enabled() || mBufferDrawDDBtn->isActive() );
|
||||||
mShapeTypeCmbBx->blockSignals( true );
|
mShapeTypeCmbBx->blockSignals( true );
|
||||||
mShapeTypeCmbBx->setCurrentIndex( mShapeTypeCmbBx->findData( background.type() ) );
|
mShapeTypeCmbBx->setCurrentIndex( mShapeTypeCmbBx->findData( background.type() ) );
|
||||||
mShapeTypeCmbBx->blockSignals( false );
|
mShapeTypeCmbBx->blockSignals( false );
|
||||||
@ -962,11 +975,11 @@ QgsTextFormat QgsTextFormatWidget::format( bool includeDataDefinedProperties ) c
|
|||||||
background.setEnabled( mShapeDrawChkBx->isChecked() );
|
background.setEnabled( mShapeDrawChkBx->isChecked() );
|
||||||
background.setType( static_cast< QgsTextBackgroundSettings::ShapeType >( mShapeTypeCmbBx->currentData().toInt() ) );
|
background.setType( static_cast< QgsTextBackgroundSettings::ShapeType >( mShapeTypeCmbBx->currentData().toInt() ) );
|
||||||
background.setSvgFile( mShapeSVGPathLineEdit->text() );
|
background.setSvgFile( mShapeSVGPathLineEdit->text() );
|
||||||
background.setSizeType( ( QgsTextBackgroundSettings::SizeType )mShapeSizeCmbBx->currentIndex() );
|
background.setSizeType( static_cast< QgsTextBackgroundSettings::SizeType >( mShapeSizeCmbBx->currentIndex() ) );
|
||||||
background.setSize( QSizeF( mShapeSizeXSpnBx->value(), mShapeSizeYSpnBx->value() ) );
|
background.setSize( QSizeF( mShapeSizeXSpnBx->value(), mShapeSizeYSpnBx->value() ) );
|
||||||
background.setSizeUnit( mShapeSizeUnitWidget->unit() );
|
background.setSizeUnit( mShapeSizeUnitWidget->unit() );
|
||||||
background.setSizeMapUnitScale( mShapeSizeUnitWidget->getMapUnitScale() );
|
background.setSizeMapUnitScale( mShapeSizeUnitWidget->getMapUnitScale() );
|
||||||
background.setRotationType( ( QgsTextBackgroundSettings::RotationType )( mShapeRotationCmbBx->currentIndex() ) );
|
background.setRotationType( static_cast< QgsTextBackgroundSettings::RotationType >( mShapeRotationCmbBx->currentIndex() ) );
|
||||||
background.setRotation( mShapeRotationDblSpnBx->value() );
|
background.setRotation( mShapeRotationDblSpnBx->value() );
|
||||||
background.setOffset( QPointF( mShapeOffsetXSpnBx->value(), mShapeOffsetYSpnBx->value() ) );
|
background.setOffset( QPointF( mShapeOffsetXSpnBx->value(), mShapeOffsetYSpnBx->value() ) );
|
||||||
background.setOffsetUnit( mShapeOffsetUnitWidget->unit() );
|
background.setOffsetUnit( mShapeOffsetUnitWidget->unit() );
|
||||||
@ -1117,7 +1130,7 @@ void QgsTextFormatWidget::updateFont( const QFont &font )
|
|||||||
blockFontChangeSignals( true );
|
blockFontChangeSignals( true );
|
||||||
mFontFamilyCmbBx->setCurrentFont( mRefFont );
|
mFontFamilyCmbBx->setCurrentFont( mRefFont );
|
||||||
populateFontStyleComboBox();
|
populateFontStyleComboBox();
|
||||||
int idx = mFontCapitalsComboBox->findData( QVariant( ( unsigned int ) mRefFont.capitalization() ) );
|
int idx = mFontCapitalsComboBox->findData( QVariant( static_cast< unsigned int >( mRefFont.capitalization() ) ) );
|
||||||
mFontCapitalsComboBox->setCurrentIndex( idx == -1 ? 0 : idx );
|
mFontCapitalsComboBox->setCurrentIndex( idx == -1 ? 0 : idx );
|
||||||
mFontUnderlineBtn->setChecked( mRefFont.underline() );
|
mFontUnderlineBtn->setChecked( mRefFont.underline() );
|
||||||
mFontStrikethroughBtn->setChecked( mRefFont.strikeOut() );
|
mFontStrikethroughBtn->setChecked( mRefFont.strikeOut() );
|
||||||
@ -1304,7 +1317,7 @@ void QgsTextFormatWidget::mFontSizeSpinBox_valueChanged( double d )
|
|||||||
void QgsTextFormatWidget::mFontCapitalsComboBox_currentIndexChanged( int index )
|
void QgsTextFormatWidget::mFontCapitalsComboBox_currentIndexChanged( int index )
|
||||||
{
|
{
|
||||||
int capitalsindex = mFontCapitalsComboBox->itemData( index ).toInt();
|
int capitalsindex = mFontCapitalsComboBox->itemData( index ).toInt();
|
||||||
mRefFont.setCapitalization( ( QFont::Capitalization ) capitalsindex );
|
mRefFont.setCapitalization( static_cast< QFont::Capitalization >( capitalsindex ) );
|
||||||
updateFont( mRefFont );
|
updateFont( mRefFont );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1628,6 +1641,18 @@ void QgsTextFormatWidget::createAuxiliaryField()
|
|||||||
emit auxiliaryFieldCreated();
|
emit auxiliaryFieldCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QgsTextFormatWidget::updateShapeFrameStatus()
|
||||||
|
{
|
||||||
|
mShapeFrame->setEnabled( mShapeDrawDDBtn->isActive() || mShapeDrawChkBx->isChecked() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsTextFormatWidget::updateBufferFrameStatus()
|
||||||
|
{
|
||||||
|
mBufferFrame->setEnabled( mBufferDrawDDBtn->isActive() || mBufferDrawChkBx->isChecked() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QgsTextFormatWidget::setFormatFromStyle( const QString &name, QgsStyle::StyleEntity type )
|
void QgsTextFormatWidget::setFormatFromStyle( const QString &name, QgsStyle::StyleEntity type )
|
||||||
{
|
{
|
||||||
switch ( type )
|
switch ( type )
|
||||||
@ -1722,8 +1747,8 @@ void QgsTextFormatWidget::mShapeSVGParamsBtn_clicked()
|
|||||||
|
|
||||||
void QgsTextFormatWidget::mShapeRotationCmbBx_currentIndexChanged( int index )
|
void QgsTextFormatWidget::mShapeRotationCmbBx_currentIndexChanged( int index )
|
||||||
{
|
{
|
||||||
mShapeRotationDblSpnBx->setEnabled( ( QgsTextBackgroundSettings::RotationType )index != QgsTextBackgroundSettings::RotationSync );
|
mShapeRotationDblSpnBx->setEnabled( static_cast< QgsTextBackgroundSettings::RotationType >( index ) != QgsTextBackgroundSettings::RotationSync );
|
||||||
mShapeRotationDDBtn->setEnabled( ( QgsTextBackgroundSettings::RotationType )index != QgsTextBackgroundSettings::RotationSync );
|
mShapeRotationDDBtn->setEnabled( static_cast< QgsTextBackgroundSettings::RotationType >( index ) != QgsTextBackgroundSettings::RotationSync );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsTextFormatWidget::mPreviewTextEdit_textChanged( const QString &text )
|
void QgsTextFormatWidget::mPreviewTextEdit_textChanged( const QString &text )
|
||||||
|
@ -297,6 +297,8 @@ class GUI_EXPORT QgsTextFormatWidget : public QWidget, public QgsExpressionConte
|
|||||||
void updateAvailableShadowPositions();
|
void updateAvailableShadowPositions();
|
||||||
void updateProperty();
|
void updateProperty();
|
||||||
void createAuxiliaryField();
|
void createAuxiliaryField();
|
||||||
|
void updateShapeFrameStatus();
|
||||||
|
void updateBufferFrameStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user