25 #include <QPushButton>
28 : QDialog( parent, flags )
31 connect( mWidthSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutImageExportOptionsDialog::mWidthSpinBox_valueChanged );
32 connect( mHeightSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutImageExportOptionsDialog::mHeightSpinBox_valueChanged );
33 connect( mResolutionSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutImageExportOptionsDialog::mResolutionSpinBox_valueChanged );
35 connect( mClipToContentGroupBox, &QGroupBox::toggled,
this, &QgsLayoutImageExportOptionsDialog::clipToContentsToggled );
36 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsLayoutImageExportOptionsDialog::showHelp );
44 if ( mImageSize.isValid() )
46 mWidthSpinBox->blockSignals(
true );
47 mHeightSpinBox->blockSignals(
true );
48 if ( mClipToContentGroupBox->isChecked() )
50 mWidthSpinBox->setValue( 0 );
51 mHeightSpinBox->setValue( 0 );
55 mWidthSpinBox->setValue( mImageSize.width() *
resolution / 25.4 );
56 mHeightSpinBox->setValue( mImageSize.height() *
resolution / 25.4 );
58 mWidthSpinBox->blockSignals(
false );
59 mHeightSpinBox->blockSignals(
false );
65 return mResolutionSpinBox->value();
71 mWidthSpinBox->blockSignals(
true );
72 mHeightSpinBox->blockSignals(
true );
73 mWidthSpinBox->setValue( size.width() * mResolutionSpinBox->value() / 25.4 );
74 mHeightSpinBox->setValue( size.height() * mResolutionSpinBox->value() / 25.4 );
75 mWidthSpinBox->blockSignals(
false );
76 mHeightSpinBox->blockSignals(
false );
81 return mWidthSpinBox->value();
86 return mHeightSpinBox->value();
91 mClipToContentGroupBox->setChecked( crop );
96 return mClipToContentGroupBox->isChecked();
101 mGenerateWorldFile->setChecked( generate );
106 return mGenerateWorldFile->isChecked();
111 mAntialiasingCheckBox->setChecked( antialias );
116 return mAntialiasingCheckBox->isChecked();
121 topMargin = mTopMarginSpinBox->value();
122 rightMargin = mRightMarginSpinBox->value();
123 bottomMargin = mBottomMarginSpinBox->value();
124 leftMargin = mLeftMarginSpinBox->value();
129 mTopMarginSpinBox->setValue( topMargin );
130 mRightMarginSpinBox->setValue( rightMargin );
131 mBottomMarginSpinBox->setValue( bottomMargin );
132 mLeftMarginSpinBox->setValue( leftMargin );
135 void QgsLayoutImageExportOptionsDialog::mWidthSpinBox_valueChanged(
int value )
137 mHeightSpinBox->blockSignals(
true );
138 mResolutionSpinBox->blockSignals(
true );
139 mHeightSpinBox->setValue( mImageSize.height() * value / mImageSize.width() );
140 mResolutionSpinBox->setValue( value * 25.4 / mImageSize.width() );
141 mHeightSpinBox->blockSignals(
false );
142 mResolutionSpinBox->blockSignals(
false );
145 void QgsLayoutImageExportOptionsDialog::mHeightSpinBox_valueChanged(
int value )
147 mWidthSpinBox->blockSignals(
true );
148 mResolutionSpinBox->blockSignals(
true );
149 mWidthSpinBox->setValue( mImageSize.width() * value / mImageSize.height() );
150 mResolutionSpinBox->setValue( value * 25.4 / mImageSize.height() );
151 mWidthSpinBox->blockSignals(
false );
152 mResolutionSpinBox->blockSignals(
false );
155 void QgsLayoutImageExportOptionsDialog::mResolutionSpinBox_valueChanged(
int value )
157 mWidthSpinBox->blockSignals(
true );
158 mHeightSpinBox->blockSignals(
true );
159 if ( mClipToContentGroupBox->isChecked() )
161 mWidthSpinBox->setValue( 0 );
162 mHeightSpinBox->setValue( 0 );
166 mWidthSpinBox->setValue( mImageSize.width() * value / 25.4 );
167 mHeightSpinBox->setValue( mImageSize.height() * value / 25.4 );
169 mWidthSpinBox->blockSignals(
false );
170 mHeightSpinBox->blockSignals(
false );
173 void QgsLayoutImageExportOptionsDialog::clipToContentsToggled(
bool state )
175 mWidthSpinBox->setEnabled( !state );
176 mHeightSpinBox->setEnabled( !state );
185 whileBlocking( mWidthSpinBox )->setValue( mImageSize.width() * mResolutionSpinBox->value() / 25.4 );
186 whileBlocking( mHeightSpinBox )->setValue( mImageSize.height() * mResolutionSpinBox->value() / 25.4 );
190 void QgsLayoutImageExportOptionsDialog::showHelp()