27#include <QDialogButtonBox>
31 mExpressionContextGenerator = generator;
36 if ( mExpressionContextGenerator )
50 mDecimalsSpinBox->setClearValue( 6 );
51 mThousandsLineEdit->setShowClearButton(
true );
52 mDecimalLineEdit->setShowClearButton(
true );
54 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
56 mFormat->setShowPlusSign( checked );
61 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
63 mFormat->setShowTrailingZeros( checked );
68 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
70 mFormat->setShowThousandsSeparator( checked );
75 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
77 mFormat->setNumberDecimalPlaces( value );
82 connect( mRadDecimalPlaces, &QRadioButton::toggled,
this, [ = ](
bool checked )
92 connect( mRadSignificantFigures, &QRadioButton::toggled,
this, [ = ](
bool checked )
102 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
104 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
105 if ( !mBlockSignals )
109 connect( mDecimalLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
111 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
112 if ( !mBlockSignals )
123 mBlockSignals =
true;
124 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
125 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
126 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
127 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
128 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
129 mDecimalLineEdit->setText( mFormat->decimalSeparator().isNull() ? QString() : mFormat->decimalSeparator() );
130 switch ( mFormat->roundingType() )
133 mRadDecimalPlaces->setChecked(
true );
137 mRadSignificantFigures->setChecked(
true );
141 mBlockSignals =
false;
146 return mFormat->clone();
158 mDecimalsSpinBox->setClearValue( 6 );
165 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
167 mFormat->setShowTrailingZeros( checked );
168 if ( !mBlockSignals )
172 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
174 mFormat->setNumberDecimalPlaces( value );
175 if ( !mBlockSignals )
179 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
182 if ( !mBlockSignals )
193 mBlockSignals =
true;
194 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
195 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
196 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->directionFormat() ) ) );
197 mBlockSignals =
false;
202 return mFormat->clone();
212 setLayout(
new QVBoxLayout() );
214 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
216 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
217 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
219 layout()->addWidget( mWidget );
220 layout()->addWidget( buttonBox );
224 setObjectName( QStringLiteral(
"QgsBearingNumericFormatDialog" ) );
246 mDecimalsSpinBox->setClearValue( 6 );
251 if ( hidePrecisionControl )
253 mLabelDecimalPlaces->hide();
254 mDecimalsSpinBox->hide();
258 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
260 mFormat->setShowTrailingZeros( checked );
261 if ( !mBlockSignals )
265 connect( mShowDirectionalSuffixCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
267 mFormat->setShowDirectionalSuffix( checked );
268 if ( !mBlockSignals )
272 connect( mShowLeadingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
274 mFormat->setShowLeadingZeros( checked );
275 if ( !mBlockSignals )
279 connect( mShowLeadingZerosForDegreesCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
281 mFormat->setShowDegreeLeadingZeros( checked );
282 if ( !mBlockSignals )
286 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
288 mFormat->setNumberDecimalPlaces( value );
289 if ( !mBlockSignals )
293 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
296 if ( !mBlockSignals )
307 mBlockSignals =
true;
308 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
309 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
310 mShowDirectionalSuffixCheckBox->setChecked( mFormat->showDirectionalSuffix() );
311 mShowLeadingZerosCheckBox->setChecked( mFormat->showLeadingZeros() );
312 mShowLeadingZerosForDegreesCheckBox->setChecked( mFormat->showDegreeLeadingZeros() );
313 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->angleFormat() ) ) );
314 mBlockSignals =
false;
319 return mFormat->clone();
329 setLayout(
new QVBoxLayout() );
331 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
333 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
334 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
336 layout()->addWidget( mWidget );
337 layout()->addWidget( buttonBox );
341 setObjectName( QStringLiteral(
"QgsGeographicCoordinateNumericFormatDialog" ) );
360 mDecimalsSpinBox->setClearValue( 2 );
363 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
365 mFormat->setShowPlusSign( checked );
366 if ( !mBlockSignals )
370 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
372 mFormat->setShowTrailingZeros( checked );
373 if ( !mBlockSignals )
377 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
379 mFormat->setShowThousandsSeparator( checked );
380 if ( !mBlockSignals )
384 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
386 mFormat->setNumberDecimalPlaces( value );
387 if ( !mBlockSignals )
391 connect( mPrefixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
393 mFormat->setPrefix( text );
394 if ( !mBlockSignals )
398 connect( mSuffixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
400 mFormat->setSuffix( text );
401 if ( !mBlockSignals )
412 mBlockSignals =
true;
413 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
414 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
415 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
416 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
417 mPrefixLineEdit->setText( mFormat->prefix() );
418 mSuffixLineEdit->setText( mFormat->suffix() );
420 mBlockSignals =
false;
425 return mFormat->clone();
438 mDecimalsSpinBox->setClearValue( 6 );
444 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
446 mFormat->setShowTrailingZeros( checked );
447 if ( !mBlockSignals )
451 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
453 mFormat->setShowPlusSign( checked );
454 if ( !mBlockSignals )
458 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
460 mFormat->setShowThousandsSeparator( checked );
461 if ( !mBlockSignals )
465 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
467 mFormat->setNumberDecimalPlaces( value );
468 if ( !mBlockSignals )
472 connect( mScalingComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
475 if ( !mBlockSignals )
486 mBlockSignals =
true;
487 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
488 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
489 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
490 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
491 mScalingComboBox->setCurrentIndex( mScalingComboBox->findData(
static_cast< int >( mFormat->inputValues() ) ) );
492 mBlockSignals =
false;
497 return mFormat->clone();
507 mDecimalsSpinBox->setClearValue( 6 );
510 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
512 mFormat->setShowPlusSign( checked );
513 if ( !mBlockSignals )
517 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
519 mFormat->setShowTrailingZeros( checked );
520 if ( !mBlockSignals )
524 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
526 mFormat->setNumberDecimalPlaces( value );
527 if ( !mBlockSignals )
538 mBlockSignals =
true;
539 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
540 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
541 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
542 mBlockSignals =
false;
547 return mFormat->clone();
561 mThousandsLineEdit->setShowClearButton(
true );
563 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
565 mFormat->setUseDedicatedUnicodeCharacters( checked );
566 if ( !mBlockSignals )
570 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
572 mFormat->setUseUnicodeSuperSubscript( checked );
573 if ( !mBlockSignals )
577 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
579 mFormat->setShowPlusSign( checked );
580 if ( !mBlockSignals )
584 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
586 mFormat->setShowThousandsSeparator( checked );
587 if ( !mBlockSignals )
591 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
593 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
594 if ( !mBlockSignals )
606 mBlockSignals =
true;
607 mUseDedicatedUnicodeCheckBox->setChecked( mFormat->useDedicatedUnicodeCharacters() );
608 mUseUnicodeSupersubscriptCheckBox->setChecked( mFormat->useUnicodeSuperSubscript() );
609 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
610 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
611 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
612 mBlockSignals =
false;
617 return mFormat->clone();
630 mExpressionSelector->setMultiLine(
true );
631 mExpressionSelector->registerExpressionContextGenerator(
this );
635 mFormat->setExpression( text );
636 if ( !mBlockSignals )
659 mBlockSignals =
true;
660 mExpressionSelector->setExpression( mFormat->expression() );
661 mBlockSignals =
false;
666 return mFormat->clone();
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Single scope for storing variables and functions for use within a QgsExpressionContext.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
void expressionChanged(const QString &expression)
Emitted when the expression is changed.
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...
Single variable definition for use within a QgsExpressionContextScope.