25 #include <QDialogButtonBox>
36 mThousandsLineEdit->setShowClearButton(
true );
37 mDecimalLineEdit->setShowClearButton(
true );
39 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
41 mFormat->setShowPlusSign( checked );
46 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
48 mFormat->setShowTrailingZeros( checked );
53 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
55 mFormat->setShowThousandsSeparator( checked );
60 connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ),
this, [ = ](
int value )
62 mFormat->setNumberDecimalPlaces( value );
67 connect( mRadDecimalPlaces, &QRadioButton::toggled,
this, [ = ](
bool checked )
77 connect( mRadSignificantFigures, &QRadioButton::toggled,
this, [ = ](
bool checked )
87 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
89 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
94 connect( mDecimalLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
96 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
108 mBlockSignals =
true;
109 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
110 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
111 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
112 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
113 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
114 mDecimalLineEdit->setText( mFormat->decimalSeparator().isNull() ? QString() : mFormat->decimalSeparator() );
115 switch ( mFormat->roundingType() )
118 mRadDecimalPlaces->setChecked(
true );
122 mRadSignificantFigures->setChecked(
true );
126 mBlockSignals =
false;
131 return mFormat->clone();
149 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
151 mFormat->setShowTrailingZeros( checked );
152 if ( !mBlockSignals )
156 connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ),
this, [ = ](
int value )
158 mFormat->setNumberDecimalPlaces( value );
159 if ( !mBlockSignals )
163 connect( mFormatComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
166 if ( !mBlockSignals )
177 mBlockSignals =
true;
178 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
179 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
180 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->directionFormat() ) ) );
181 mBlockSignals =
false;
186 return mFormat->clone();
196 setLayout(
new QVBoxLayout() );
198 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
200 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
201 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
203 layout()->addWidget( mWidget );
204 layout()->addWidget( buttonBox );
208 setObjectName( QStringLiteral(
"QgsBearingNumericFormatDialog" ) );
228 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
230 mFormat->setShowPlusSign( checked );
231 if ( !mBlockSignals )
235 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
237 mFormat->setShowTrailingZeros( checked );
238 if ( !mBlockSignals )
242 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
244 mFormat->setShowThousandsSeparator( checked );
245 if ( !mBlockSignals )
249 connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ),
this, [ = ](
int value )
251 mFormat->setNumberDecimalPlaces( value );
252 if ( !mBlockSignals )
256 connect( mPrefixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
258 mFormat->setPrefix( text );
259 if ( !mBlockSignals )
263 connect( mSuffixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
265 mFormat->setSuffix( text );
266 if ( !mBlockSignals )
277 mBlockSignals =
true;
278 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
279 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
280 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
281 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
282 mPrefixLineEdit->setText( mFormat->prefix() );
283 mSuffixLineEdit->setText( mFormat->suffix() );
285 mBlockSignals =
false;
290 return mFormat->clone();
308 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
310 mFormat->setShowTrailingZeros( checked );
311 if ( !mBlockSignals )
315 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
317 mFormat->setShowPlusSign( checked );
318 if ( !mBlockSignals )
322 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
324 mFormat->setShowThousandsSeparator( checked );
325 if ( !mBlockSignals )
329 connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ),
this, [ = ](
int value )
331 mFormat->setNumberDecimalPlaces( value );
332 if ( !mBlockSignals )
336 connect( mScalingComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
339 if ( !mBlockSignals )
350 mBlockSignals =
true;
351 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
352 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
353 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
354 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
355 mScalingComboBox->setCurrentIndex( mScalingComboBox->findData(
static_cast< int >( mFormat->inputValues() ) ) );
356 mBlockSignals =
false;
361 return mFormat->clone();
373 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
375 mFormat->setShowPlusSign( checked );
376 if ( !mBlockSignals )
380 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
382 mFormat->setShowTrailingZeros( checked );
383 if ( !mBlockSignals )
387 connect( mDecimalsSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ),
this, [ = ](
int value )
389 mFormat->setNumberDecimalPlaces( value );
390 if ( !mBlockSignals )
401 mBlockSignals =
true;
402 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
403 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
404 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
405 mBlockSignals =
false;
410 return mFormat->clone();
424 mThousandsLineEdit->setShowClearButton(
true );
426 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
428 mFormat->setUseDedicatedUnicodeCharacters( checked );
429 if ( !mBlockSignals )
433 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
435 mFormat->setUseUnicodeSuperSubscript( checked );
436 if ( !mBlockSignals )
440 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
442 mFormat->setShowPlusSign( checked );
443 if ( !mBlockSignals )
447 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
449 mFormat->setShowThousandsSeparator( checked );
450 if ( !mBlockSignals )
454 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
456 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
457 if ( !mBlockSignals )
469 mBlockSignals =
true;
470 mUseDedicatedUnicodeCheckBox->setChecked( mFormat->useDedicatedUnicodeCharacters() );
471 mUseUnicodeSupersubscriptCheckBox->setChecked( mFormat->useUnicodeSuperSubscript() );
472 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
473 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
474 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
475 mBlockSignals =
false;
480 return mFormat->clone();