27#include <QDialogButtonBox>
38 mDecimalsSpinBox->setClearValue( 6 );
39 mThousandsLineEdit->setShowClearButton(
true );
40 mDecimalLineEdit->setShowClearButton(
true );
42 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
44 mFormat->setShowPlusSign( checked );
49 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
51 mFormat->setShowTrailingZeros( checked );
56 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
58 mFormat->setShowThousandsSeparator( checked );
63 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
65 mFormat->setNumberDecimalPlaces( value );
70 connect( mRadDecimalPlaces, &QRadioButton::toggled,
this, [ = ](
bool checked )
80 connect( mRadSignificantFigures, &QRadioButton::toggled,
this, [ = ](
bool checked )
90 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
92 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
97 connect( mDecimalLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
99 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
100 if ( !mBlockSignals )
111 mBlockSignals =
true;
112 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
113 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
114 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
115 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
116 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
117 mDecimalLineEdit->setText( mFormat->decimalSeparator().isNull() ? QString() : mFormat->decimalSeparator() );
118 switch ( mFormat->roundingType() )
121 mRadDecimalPlaces->setChecked(
true );
125 mRadSignificantFigures->setChecked(
true );
129 mBlockSignals =
false;
134 return mFormat->clone();
146 mDecimalsSpinBox->setClearValue( 6 );
153 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
155 mFormat->setShowTrailingZeros( checked );
156 if ( !mBlockSignals )
160 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
162 mFormat->setNumberDecimalPlaces( value );
163 if ( !mBlockSignals )
167 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
170 if ( !mBlockSignals )
181 mBlockSignals =
true;
182 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
183 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
184 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->directionFormat() ) ) );
185 mBlockSignals =
false;
190 return mFormat->clone();
200 setLayout(
new QVBoxLayout() );
202 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
204 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
205 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
207 layout()->addWidget( mWidget );
208 layout()->addWidget( buttonBox );
212 setObjectName( QStringLiteral(
"QgsBearingNumericFormatDialog" ) );
234 mDecimalsSpinBox->setClearValue( 6 );
239 if ( hidePrecisionControl )
241 mLabelDecimalPlaces->hide();
242 mDecimalsSpinBox->hide();
246 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
248 mFormat->setShowTrailingZeros( checked );
249 if ( !mBlockSignals )
253 connect( mShowDirectionalSuffixCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
255 mFormat->setShowDirectionalSuffix( checked );
256 if ( !mBlockSignals )
260 connect( mShowLeadingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
262 mFormat->setShowLeadingZeros( checked );
263 if ( !mBlockSignals )
267 connect( mShowLeadingZerosForDegreesCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
269 mFormat->setShowDegreeLeadingZeros( checked );
270 if ( !mBlockSignals )
274 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
276 mFormat->setNumberDecimalPlaces( value );
277 if ( !mBlockSignals )
281 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
284 if ( !mBlockSignals )
295 mBlockSignals =
true;
296 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
297 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
298 mShowDirectionalSuffixCheckBox->setChecked( mFormat->showDirectionalSuffix() );
299 mShowLeadingZerosCheckBox->setChecked( mFormat->showLeadingZeros() );
300 mShowLeadingZerosForDegreesCheckBox->setChecked( mFormat->showDegreeLeadingZeros() );
301 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData(
static_cast< int >( mFormat->angleFormat() ) ) );
302 mBlockSignals =
false;
307 return mFormat->clone();
317 setLayout(
new QVBoxLayout() );
319 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
321 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
322 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
324 layout()->addWidget( mWidget );
325 layout()->addWidget( buttonBox );
329 setObjectName( QStringLiteral(
"QgsGeographicCoordinateNumericFormatDialog" ) );
348 mDecimalsSpinBox->setClearValue( 2 );
351 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
353 mFormat->setShowPlusSign( checked );
354 if ( !mBlockSignals )
358 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
360 mFormat->setShowTrailingZeros( checked );
361 if ( !mBlockSignals )
365 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
367 mFormat->setShowThousandsSeparator( checked );
368 if ( !mBlockSignals )
372 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
374 mFormat->setNumberDecimalPlaces( value );
375 if ( !mBlockSignals )
379 connect( mPrefixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
381 mFormat->setPrefix( text );
382 if ( !mBlockSignals )
386 connect( mSuffixLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
388 mFormat->setSuffix( text );
389 if ( !mBlockSignals )
400 mBlockSignals =
true;
401 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
402 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
403 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
404 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
405 mPrefixLineEdit->setText( mFormat->prefix() );
406 mSuffixLineEdit->setText( mFormat->suffix() );
408 mBlockSignals =
false;
413 return mFormat->clone();
426 mDecimalsSpinBox->setClearValue( 6 );
432 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
434 mFormat->setShowTrailingZeros( checked );
435 if ( !mBlockSignals )
439 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
441 mFormat->setShowPlusSign( checked );
442 if ( !mBlockSignals )
446 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
448 mFormat->setShowThousandsSeparator( checked );
449 if ( !mBlockSignals )
453 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
455 mFormat->setNumberDecimalPlaces( value );
456 if ( !mBlockSignals )
460 connect( mScalingComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int )
463 if ( !mBlockSignals )
474 mBlockSignals =
true;
475 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
476 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
477 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
478 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
479 mScalingComboBox->setCurrentIndex( mScalingComboBox->findData(
static_cast< int >( mFormat->inputValues() ) ) );
480 mBlockSignals =
false;
485 return mFormat->clone();
495 mDecimalsSpinBox->setClearValue( 6 );
498 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
500 mFormat->setShowPlusSign( checked );
501 if ( !mBlockSignals )
505 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
507 mFormat->setShowTrailingZeros( checked );
508 if ( !mBlockSignals )
512 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ),
this, [ = ](
int value )
514 mFormat->setNumberDecimalPlaces( value );
515 if ( !mBlockSignals )
526 mBlockSignals =
true;
527 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
528 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
529 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
530 mBlockSignals =
false;
535 return mFormat->clone();
549 mThousandsLineEdit->setShowClearButton(
true );
551 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
553 mFormat->setUseDedicatedUnicodeCharacters( checked );
554 if ( !mBlockSignals )
558 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
560 mFormat->setUseUnicodeSuperSubscript( checked );
561 if ( !mBlockSignals )
565 connect( mShowPlusCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
567 mFormat->setShowPlusSign( checked );
568 if ( !mBlockSignals )
572 connect( mShowThousandsCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
574 mFormat->setShowThousandsSeparator( checked );
575 if ( !mBlockSignals )
579 connect( mThousandsLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString & text )
581 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
582 if ( !mBlockSignals )
594 mBlockSignals =
true;
595 mUseDedicatedUnicodeCheckBox->setChecked( mFormat->useDedicatedUnicodeCharacters() );
596 mUseUnicodeSupersubscriptCheckBox->setChecked( mFormat->useUnicodeSuperSubscript() );
597 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
598 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
599 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
600 mBlockSignals =
false;
605 return mFormat->clone();
618 mExpressionSelector->setMultiLine(
true );
619 mExpressionSelector->registerExpressionContextGenerator(
this );
623 mFormat->setExpression( text );
624 if ( !mBlockSignals )
647 mBlockSignals =
true;
648 mExpressionSelector->setExpression( mFormat->expression() );
649 mBlockSignals =
false;
654 return mFormat->clone();
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.