26 #include <QDialogButtonBox>
37 mDecimalsSpinBox->setClearValue( 6 );
38 mThousandsLineEdit->setShowClearButton(
true );
39 mDecimalLineEdit->setShowClearButton(
true );
41 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
43 mFormat->setShowPlusSign( checked );
48 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
50 mFormat->setShowTrailingZeros( checked );
55 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
57 mFormat->setShowThousandsSeparator( checked );
62 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
64 mFormat->setNumberDecimalPlaces( value );
69 connect( mRadDecimalPlaces, &QRadioButton::toggled,
this, [ = ](
bool checked )
79 connect( mRadSignificantFigures, &QRadioButton::toggled,
this, [ = ](
bool checked )
89 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
91 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
96 connect( mDecimalLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
98 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
110 mBlockSignals =
true;
111 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
112 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
113 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
114 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
115 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
116 mDecimalLineEdit->setText( mFormat->decimalSeparator().isNull() ? QString() : mFormat->decimalSeparator() );
117 switch ( mFormat->roundingType() )
120 mRadDecimalPlaces->setChecked(
true );
124 mRadSignificantFigures->setChecked(
true );
128 mBlockSignals =
false;
133 return mFormat->clone();
145 mDecimalsSpinBox->setClearValue( 6 );
152 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
154 mFormat->setShowTrailingZeros( checked );
155 if ( !mBlockSignals )
159 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
161 mFormat->setNumberDecimalPlaces( value );
162 if ( !mBlockSignals )
166 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
169 if ( !mBlockSignals )
180 mBlockSignals =
true;
181 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
182 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
183 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->directionFormat() ) ) );
184 mBlockSignals =
false;
189 return mFormat->clone();
199 setLayout(
new QVBoxLayout() );
201 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
203 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
204 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
206 layout()->addWidget( mWidget );
207 layout()->addWidget( buttonBox );
211 setObjectName( QStringLiteral(
"QgsBearingNumericFormatDialog" ) );
233 mDecimalsSpinBox->setClearValue( 6 );
238 if ( hidePrecisionControl )
240 mLabelDecimalPlaces->hide();
241 mDecimalsSpinBox->hide();
245 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
247 mFormat->setShowTrailingZeros( checked );
248 if ( !mBlockSignals )
252 connect( mShowDirectionalSuffixCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
254 mFormat->setShowDirectionalSuffix( checked );
255 if ( !mBlockSignals )
259 connect( mShowLeadingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
261 mFormat->setShowLeadingZeros( checked );
262 if ( !mBlockSignals )
266 connect( mShowLeadingZerosForDegreesCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
268 mFormat->setShowDegreeLeadingZeros( checked );
269 if ( !mBlockSignals )
273 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
275 mFormat->setNumberDecimalPlaces( value );
276 if ( !mBlockSignals )
280 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
283 if ( !mBlockSignals )
294 mBlockSignals =
true;
295 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
296 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
297 mShowDirectionalSuffixCheckBox->setChecked( mFormat->showDirectionalSuffix() );
298 mShowLeadingZerosCheckBox->setChecked( mFormat->showLeadingZeros() );
299 mShowLeadingZerosForDegreesCheckBox->setChecked( mFormat->showDegreeLeadingZeros() );
300 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->angleFormat() ) ) );
301 mBlockSignals =
false;
306 return mFormat->clone();
316 setLayout(
new QVBoxLayout() );
318 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
320 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
321 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
323 layout()->addWidget( mWidget );
324 layout()->addWidget( buttonBox );
328 setObjectName( QStringLiteral(
"QgsGeographicCoordinateNumericFormatDialog" ) );
347 mDecimalsSpinBox->setClearValue( 2 );
350 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
352 mFormat->setShowPlusSign( checked );
353 if ( !mBlockSignals )
357 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
359 mFormat->setShowTrailingZeros( checked );
360 if ( !mBlockSignals )
364 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
366 mFormat->setShowThousandsSeparator( checked );
367 if ( !mBlockSignals )
371 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
373 mFormat->setNumberDecimalPlaces( value );
374 if ( !mBlockSignals )
378 connect( mPrefixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
380 mFormat->setPrefix( text );
381 if ( !mBlockSignals )
385 connect( mSuffixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
387 mFormat->setSuffix( text );
388 if ( !mBlockSignals )
399 mBlockSignals =
true;
400 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
401 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
402 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
403 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
404 mPrefixLineEdit->setText( mFormat->prefix() );
405 mSuffixLineEdit->setText( mFormat->suffix() );
407 mBlockSignals =
false;
412 return mFormat->clone();
425 mDecimalsSpinBox->setClearValue( 6 );
431 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
433 mFormat->setShowTrailingZeros( checked );
434 if ( !mBlockSignals )
438 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
440 mFormat->setShowPlusSign( checked );
441 if ( !mBlockSignals )
445 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
447 mFormat->setShowThousandsSeparator( checked );
448 if ( !mBlockSignals )
452 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
454 mFormat->setNumberDecimalPlaces( value );
455 if ( !mBlockSignals )
459 connect( mScalingComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
462 if ( !mBlockSignals )
473 mBlockSignals =
true;
474 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
475 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
476 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
477 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
478 mScalingComboBox->setCurrentIndex( mScalingComboBox->findData(
static_cast< int >( mFormat->inputValues() ) ) );
479 mBlockSignals =
false;
484 return mFormat->clone();
494 mDecimalsSpinBox->setClearValue( 6 );
497 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
499 mFormat->setShowPlusSign( checked );
500 if ( !mBlockSignals )
504 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
506 mFormat->setShowTrailingZeros( checked );
507 if ( !mBlockSignals )
511 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
513 mFormat->setNumberDecimalPlaces( value );
514 if ( !mBlockSignals )
525 mBlockSignals =
true;
526 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
527 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
528 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
529 mBlockSignals =
false;
534 return mFormat->clone();
548 mThousandsLineEdit->setShowClearButton(
true );
550 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
552 mFormat->setUseDedicatedUnicodeCharacters( checked );
553 if ( !mBlockSignals )
557 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
559 mFormat->setUseUnicodeSuperSubscript( checked );
560 if ( !mBlockSignals )
564 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
566 mFormat->setShowPlusSign( checked );
567 if ( !mBlockSignals )
571 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
573 mFormat->setShowThousandsSeparator( checked );
574 if ( !mBlockSignals )
578 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
580 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
581 if ( !mBlockSignals )
593 mBlockSignals =
true;
594 mUseDedicatedUnicodeCheckBox->setChecked( mFormat->useDedicatedUnicodeCharacters() );
595 mUseUnicodeSupersubscriptCheckBox->setChecked( mFormat->useUnicodeSuperSubscript() );
596 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
597 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
598 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
599 mBlockSignals =
false;
604 return mFormat->clone();