25 #include <QDialogButtonBox>
36 mDecimalsSpinBox->setClearValue( 6 );
37 mThousandsLineEdit->setShowClearButton(
true );
38 mDecimalLineEdit->setShowClearButton(
true );
40 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
42 mFormat->setShowPlusSign( checked );
47 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
49 mFormat->setShowTrailingZeros( checked );
54 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
56 mFormat->setShowThousandsSeparator( checked );
61 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
63 mFormat->setNumberDecimalPlaces( value );
68 connect( mRadDecimalPlaces, &QRadioButton::toggled,
this, [ = ](
bool checked )
78 connect( mRadSignificantFigures, &QRadioButton::toggled,
this, [ = ](
bool checked )
88 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
90 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
95 connect( mDecimalLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
97 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
109 mBlockSignals =
true;
110 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
111 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
112 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
113 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
114 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
115 mDecimalLineEdit->setText( mFormat->decimalSeparator().isNull() ? QString() : mFormat->decimalSeparator() );
116 switch ( mFormat->roundingType() )
119 mRadDecimalPlaces->setChecked(
true );
123 mRadSignificantFigures->setChecked(
true );
127 mBlockSignals =
false;
132 return mFormat->clone();
144 mDecimalsSpinBox->setClearValue( 6 );
151 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
153 mFormat->setShowTrailingZeros( checked );
154 if ( !mBlockSignals )
158 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
160 mFormat->setNumberDecimalPlaces( value );
161 if ( !mBlockSignals )
165 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
168 if ( !mBlockSignals )
179 mBlockSignals =
true;
180 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
181 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
182 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->directionFormat() ) ) );
183 mBlockSignals =
false;
188 return mFormat->clone();
198 setLayout(
new QVBoxLayout() );
200 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
202 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
203 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
205 layout()->addWidget( mWidget );
206 layout()->addWidget( buttonBox );
210 setObjectName( QStringLiteral(
"QgsBearingNumericFormatDialog" ) );
228 mDecimalsSpinBox->setClearValue( 2 );
231 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
233 mFormat->setShowPlusSign( checked );
234 if ( !mBlockSignals )
238 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
240 mFormat->setShowTrailingZeros( checked );
241 if ( !mBlockSignals )
245 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
247 mFormat->setShowThousandsSeparator( checked );
248 if ( !mBlockSignals )
252 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
254 mFormat->setNumberDecimalPlaces( value );
255 if ( !mBlockSignals )
259 connect( mPrefixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
261 mFormat->setPrefix( text );
262 if ( !mBlockSignals )
266 connect( mSuffixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
268 mFormat->setSuffix( text );
269 if ( !mBlockSignals )
280 mBlockSignals =
true;
281 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
282 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
283 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
284 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
285 mPrefixLineEdit->setText( mFormat->prefix() );
286 mSuffixLineEdit->setText( mFormat->suffix() );
288 mBlockSignals =
false;
293 return mFormat->clone();
306 mDecimalsSpinBox->setClearValue( 6 );
312 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
314 mFormat->setShowTrailingZeros( checked );
315 if ( !mBlockSignals )
319 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
321 mFormat->setShowPlusSign( checked );
322 if ( !mBlockSignals )
326 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
328 mFormat->setShowThousandsSeparator( checked );
329 if ( !mBlockSignals )
333 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
335 mFormat->setNumberDecimalPlaces( value );
336 if ( !mBlockSignals )
340 connect( mScalingComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
343 if ( !mBlockSignals )
354 mBlockSignals =
true;
355 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
356 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
357 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
358 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
359 mScalingComboBox->setCurrentIndex( mScalingComboBox->findData(
static_cast< int >( mFormat->inputValues() ) ) );
360 mBlockSignals =
false;
365 return mFormat->clone();
375 mDecimalsSpinBox->setClearValue( 6 );
378 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
380 mFormat->setShowPlusSign( checked );
381 if ( !mBlockSignals )
385 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
387 mFormat->setShowTrailingZeros( checked );
388 if ( !mBlockSignals )
392 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
394 mFormat->setNumberDecimalPlaces( value );
395 if ( !mBlockSignals )
406 mBlockSignals =
true;
407 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
408 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
409 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
410 mBlockSignals =
false;
415 return mFormat->clone();
429 mThousandsLineEdit->setShowClearButton(
true );
431 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
433 mFormat->setUseDedicatedUnicodeCharacters( checked );
434 if ( !mBlockSignals )
438 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
440 mFormat->setUseUnicodeSuperSubscript( checked );
441 if ( !mBlockSignals )
445 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
447 mFormat->setShowPlusSign( checked );
448 if ( !mBlockSignals )
452 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
454 mFormat->setShowThousandsSeparator( checked );
455 if ( !mBlockSignals )
459 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
461 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
462 if ( !mBlockSignals )
474 mBlockSignals =
true;
475 mUseDedicatedUnicodeCheckBox->setChecked( mFormat->useDedicatedUnicodeCharacters() );
476 mUseUnicodeSupersubscriptCheckBox->setChecked( mFormat->useUnicodeSuperSubscript() );
477 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
478 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
479 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
480 mBlockSignals =
false;
485 return mFormat->clone();
static QgsGui * instance()
Returns a pointer to the singleton instance.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...