37   mVariableEditor->setMinimumHeight( mVariableEditor->fontMetrics().height() * 15 );
 
   39   updateSnappingElements();
 
   41   mGridSpacingUnitsCombo->linkToWidget( mGridResolutionSpinBox );
 
   42   mGridOffsetUnitsComboBox->linkToWidget( mOffsetXSpinBox );
 
   43   mGridOffsetUnitsComboBox->linkToWidget( mOffsetYSpinBox );
 
   45   blockSignals( 
false );
 
   47   connect( mSnapToleranceSpinBox, 
static_cast < void ( QSpinBox::* )( 
int ) 
> ( &QSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::snapToleranceChanged );
 
   51   connect( mGridResolutionSpinBox, 
static_cast < void ( 
QgsDoubleSpinBox::* )( 
double ) 
> ( &QgsDoubleSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::gridResolutionChanged );
 
   52   connect( mOffsetXSpinBox, 
static_cast < void ( 
QgsDoubleSpinBox::* )( 
double ) 
> ( &QgsDoubleSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::gridOffsetXChanged );
 
   53   connect( mOffsetYSpinBox, 
static_cast < void ( 
QgsDoubleSpinBox::* )( 
double ) 
> ( &QgsDoubleSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::gridOffsetYChanged );
 
   55   const double leftMargin = mLayout->
customProperty( QStringLiteral( 
"resizeToContentsLeftMargin" ) ).toDouble();
 
   56   const double topMargin = mLayout->
customProperty( QStringLiteral( 
"resizeToContentsTopMargin" ) ).toDouble();
 
   57   const double bottomMargin = mLayout->
customProperty( QStringLiteral( 
"resizeToContentsBottomMargin" ) ).toDouble();
 
   58   const double rightMargin = mLayout->
customProperty( QStringLiteral( 
"resizeToContentsRightMargin" ) ).toDouble();
 
   62   const bool exportWorldFile = mLayout->
customProperty( QStringLiteral( 
"exportWorldFile" ), false ).toBool();
 
   63   mGenerateWorldFileCheckBox->setChecked( exportWorldFile );
 
   64   connect( mGenerateWorldFileCheckBox, &QCheckBox::toggled, 
this, &QgsLayoutPropertiesWidget::worldFileToggled );
 
   66   connect( mRasterizeCheckBox, &QCheckBox::toggled, 
this, &QgsLayoutPropertiesWidget::rasterizeToggled );
 
   67   connect( mForceVectorCheckBox, &QCheckBox::toggled, 
this, &QgsLayoutPropertiesWidget::forceVectorToggled );
 
   69   mTopMarginSpinBox->setValue( topMargin );
 
   70   mMarginUnitsComboBox->linkToWidget( mTopMarginSpinBox );
 
   71   mRightMarginSpinBox->setValue( rightMargin );
 
   72   mMarginUnitsComboBox->linkToWidget( mRightMarginSpinBox );
 
   73   mBottomMarginSpinBox->setValue( bottomMargin );
 
   74   mMarginUnitsComboBox->linkToWidget( mBottomMarginSpinBox );
 
   75   mLeftMarginSpinBox->setValue( leftMargin );
 
   76   mMarginUnitsComboBox->linkToWidget( mLeftMarginSpinBox );
 
   77   mMarginUnitsComboBox->setUnit( marginUnit );
 
   80   connect( mTopMarginSpinBox, 
static_cast < void ( QDoubleSpinBox::* )( 
double ) 
> ( &QDoubleSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
 
   81   connect( mRightMarginSpinBox, 
static_cast < void ( QDoubleSpinBox::* )( 
double ) 
> ( &QDoubleSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
 
   82   connect( mBottomMarginSpinBox, 
static_cast < void ( QDoubleSpinBox::* )( 
double ) 
> ( &QDoubleSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
 
   83   connect( mLeftMarginSpinBox, 
static_cast < void ( QDoubleSpinBox::* )( 
double ) 
> ( &QDoubleSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::resizeMarginsChanged );
 
   84   connect( mResizePageButton, &QPushButton::clicked, 
this, &QgsLayoutPropertiesWidget::resizeToContents );
 
   86   connect( mResolutionSpinBox, 
static_cast < void ( QSpinBox::* )( 
int ) 
> ( &QSpinBox::valueChanged ), 
this, &QgsLayoutPropertiesWidget::dpiChanged );
 
   88   mReferenceMapComboBox->setCurrentLayout( mLayout );
 
  121   const bool rasterize = mLayout->
customProperty( QStringLiteral( 
"rasterize" ), 
false ).toBool();
 
  122   whileBlocking( mRasterizeCheckBox )->setChecked( rasterize );
 
  124   const bool forceVectors = mLayout->
customProperty( QStringLiteral( 
"forceVector" ), 
false ).toBool();
 
  125   whileBlocking( mForceVectorCheckBox )->setChecked( forceVectors );
 
  129     mForceVectorCheckBox->setChecked( 
false );
 
  130     mForceVectorCheckBox->setEnabled( 
false );
 
  134     mForceVectorCheckBox->setEnabled( 
true );
 
  138 void QgsLayoutPropertiesWidget::updateSnappingElements()
 
  150 void QgsLayoutPropertiesWidget::gridResolutionChanged( 
double d )
 
  166 void QgsLayoutPropertiesWidget::gridOffsetXChanged( 
double d )
 
  174 void QgsLayoutPropertiesWidget::gridOffsetYChanged( 
double d )
 
  190 void QgsLayoutPropertiesWidget::snapToleranceChanged( 
int tolerance )
 
  195 void QgsLayoutPropertiesWidget::resizeMarginsChanged()
 
  197   mLayout->
setCustomProperty( QStringLiteral( 
"resizeToContentsLeftMargin" ), mLeftMarginSpinBox->value() );
 
  198   mLayout->
setCustomProperty( QStringLiteral( 
"resizeToContentsTopMargin" ), mTopMarginSpinBox->value() );
 
  199   mLayout->
setCustomProperty( QStringLiteral( 
"resizeToContentsBottomMargin" ), mBottomMarginSpinBox->value() );
 
  200   mLayout->
setCustomProperty( QStringLiteral( 
"resizeToContentsRightMargin" ), mRightMarginSpinBox->value() );
 
  201   mLayout->
setCustomProperty( QStringLiteral( 
"imageCropMarginUnit" ), mMarginUnitsComboBox->unit() );
 
  204 void QgsLayoutPropertiesWidget::resizeToContents()
 
  209       mTopMarginSpinBox->value(),
 
  210       mRightMarginSpinBox->value(),
 
  211       mBottomMarginSpinBox->value() ),
 
  212       mMarginUnitsComboBox->unit() );
 
  217 void QgsLayoutPropertiesWidget::referenceMapChanged( 
QgsLayoutItem *item )
 
  225 void QgsLayoutPropertiesWidget::dpiChanged( 
int value )
 
  234 void QgsLayoutPropertiesWidget::worldFileToggled()
 
  236   mLayout->
setCustomProperty( QStringLiteral( 
"exportWorldFile" ), mGenerateWorldFileCheckBox->isChecked() );
 
  239 void QgsLayoutPropertiesWidget::rasterizeToggled()
 
  241   mLayout->
setCustomProperty( QStringLiteral( 
"rasterize" ), mRasterizeCheckBox->isChecked() );
 
  243   if ( mRasterizeCheckBox->isChecked() )
 
  245     mForceVectorCheckBox->setChecked( 
false );
 
  246     mForceVectorCheckBox->setEnabled( 
false );
 
  250     mForceVectorCheckBox->setEnabled( 
true );
 
  254 void QgsLayoutPropertiesWidget::forceVectorToggled()
 
  256   mLayout->
setCustomProperty( QStringLiteral( 
"forceVector" ), mForceVectorCheckBox->isChecked() );
 
  259 void QgsLayoutPropertiesWidget::variablesChanged()
 
  261   mBlockVariableUpdates = 
true;
 
  263   mBlockVariableUpdates = 
false;
 
  266 void QgsLayoutPropertiesWidget::updateVariables()
 
  268   if ( mBlockVariableUpdates )
 
  275   mVariableEditor->setContext( &context );
 
  276   mVariableEditor->setEditableScopeIndex( 2 );
 
  279 void QgsLayoutPropertiesWidget::blockSignals( 
bool block )
 
  281   mGridResolutionSpinBox->blockSignals( block );
 
  282   mOffsetXSpinBox->blockSignals( block );
 
  283   mOffsetYSpinBox->blockSignals( block );
 
  284   mSnapToleranceSpinBox->blockSignals( block );