QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsnumericformatwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsnumericformatwidget.cpp
3 --------------------------
4 begin : January 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17#include "moc_qgsnumericformatwidget.cpp"
26#include "qgsgui.h"
27#include "qgis.h"
28#include <QDialogButtonBox>
29
31{
32 mExpressionContextGenerator = generator;
33}
34
36{
37 if ( mExpressionContextGenerator )
38 return mExpressionContextGenerator->createExpressionContext();
39 return QgsExpressionContext();
40}
41
42//
43// QgsBasicNumericFormatWidget
44//
46 : QgsNumericFormatWidget( parent )
47{
48 setupUi( this );
50
51 mDecimalsSpinBox->setClearValue( 6 );
52 mThousandsLineEdit->setShowClearButton( true );
53 mDecimalLineEdit->setShowClearButton( true );
54
55 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
56 mFormat->setShowPlusSign( checked );
57 if ( !mBlockSignals )
58 emit changed();
59 } );
60
61 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
62 mFormat->setShowTrailingZeros( checked );
63 if ( !mBlockSignals )
64 emit changed();
65 } );
66
67 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
68 mFormat->setShowThousandsSeparator( checked );
69 if ( !mBlockSignals )
70 emit changed();
71 } );
72
73 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [=]( int value ) {
74 mFormat->setNumberDecimalPlaces( value );
75 if ( !mBlockSignals )
76 emit changed();
77 } );
78
79 connect( mRadDecimalPlaces, &QRadioButton::toggled, this, [=]( bool checked ) {
80 if ( !checked )
81 return;
82
83 mFormat->setRoundingType( QgsBasicNumericFormat::DecimalPlaces );
84 if ( !mBlockSignals )
85 emit changed();
86 } );
87
88 connect( mRadSignificantFigures, &QRadioButton::toggled, this, [=]( bool checked ) {
89 if ( !checked )
90 return;
91
92 mFormat->setRoundingType( QgsBasicNumericFormat::SignificantFigures );
93 if ( !mBlockSignals )
94 emit changed();
95 } );
96
97 connect( mThousandsLineEdit, &QLineEdit::textChanged, this, [=]( const QString &text ) {
98 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
99 if ( !mBlockSignals )
100 emit changed();
101 } );
102
103 connect( mDecimalLineEdit, &QLineEdit::textChanged, this, [=]( const QString &text ) {
104 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
105 if ( !mBlockSignals )
106 emit changed();
107 } );
108}
109
111
113{
114 mFormat.reset( static_cast<QgsBasicNumericFormat *>( format ) );
115
116 mBlockSignals = true;
117 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
118 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
119 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
120 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
121 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
122 mDecimalLineEdit->setText( mFormat->decimalSeparator().isNull() ? QString() : mFormat->decimalSeparator() );
123 switch ( mFormat->roundingType() )
124 {
126 mRadDecimalPlaces->setChecked( true );
127 break;
128
130 mRadSignificantFigures->setChecked( true );
131 break;
132 }
133
134 mBlockSignals = false;
135}
136
138{
139 return mFormat->clone();
140}
141
142//
143// QgsBearingNumericFormatWidget
144//
145
147 : QgsNumericFormatWidget( parent )
148{
149 setupUi( this );
150
151 mDecimalsSpinBox->setClearValue( 6 );
152 mFormatComboBox->addItem( QObject::tr( "0 to 180°, with E/W suffix" ), QgsBearingNumericFormat::UseRange0To180WithEWDirectionalSuffix );
153 mFormatComboBox->addItem( QObject::tr( "-180 to +180°" ), QgsBearingNumericFormat::UseRangeNegative180ToPositive180 );
154 mFormatComboBox->addItem( QObject::tr( "0 to 360°" ), QgsBearingNumericFormat::UseRange0To360 );
155
156 setFormat( format->clone() );
157
158 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
159 mFormat->setShowTrailingZeros( checked );
160 if ( !mBlockSignals )
161 emit changed();
162 } );
163
164 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [=]( int value ) {
165 mFormat->setNumberDecimalPlaces( value );
166 if ( !mBlockSignals )
167 emit changed();
168 } );
169
170 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [=]( int ) {
171 mFormat->setDirectionFormat( static_cast<QgsBearingNumericFormat::FormatDirectionOption>( mFormatComboBox->currentData().toInt() ) );
172 if ( !mBlockSignals )
173 emit changed();
174 } );
175}
176
178
180{
181 mFormat.reset( static_cast<QgsBearingNumericFormat *>( format ) );
182
183 mBlockSignals = true;
184 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
185 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
186 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( static_cast<int>( mFormat->directionFormat() ) ) );
187 mBlockSignals = false;
188}
189
191{
192 return mFormat->clone();
193}
194
195//
196// QgsBearingNumericFormatDialog
197//
198
200 : QDialog( parent )
201{
202 setLayout( new QVBoxLayout() );
203 mWidget = new QgsBearingNumericFormatWidget( format );
204 QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
205
206 connect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
207 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
208
209 layout()->addWidget( mWidget );
210 layout()->addWidget( buttonBox );
211
212 connect( mWidget, &QgsPanelWidget::panelAccepted, this, &QDialog::reject );
213
214 setObjectName( QStringLiteral( "QgsBearingNumericFormatDialog" ) );
216}
217
222
223
224//
225// QgsGeographicCoordinateNumericFormatWidget
226//
227
229 : QgsNumericFormatWidget( parent )
230{
231 setupUi( this );
232
233 mDecimalsSpinBox->setClearValue( 6 );
234 mFormatComboBox->addItem( QObject::tr( "Decimal Degrees" ), static_cast<int>( QgsGeographicCoordinateNumericFormat::AngleFormat::DecimalDegrees ) );
235 mFormatComboBox->addItem( QObject::tr( "Degrees, Minutes" ), static_cast<int>( QgsGeographicCoordinateNumericFormat::AngleFormat::DegreesMinutes ) );
236 mFormatComboBox->addItem( QObject::tr( "Degrees, Minutes, Seconds" ), static_cast<int>( QgsGeographicCoordinateNumericFormat::AngleFormat::DegreesMinutesSeconds ) );
237
238 if ( hidePrecisionControl )
239 {
240 mLabelDecimalPlaces->hide();
241 mDecimalsSpinBox->hide();
242 }
243 setFormat( format->clone() );
244
245 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
246 mFormat->setShowTrailingZeros( checked );
247 if ( !mBlockSignals )
248 emit changed();
249 } );
250
251 connect( mShowDirectionalSuffixCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
252 mFormat->setShowDirectionalSuffix( checked );
253 if ( !mBlockSignals )
254 emit changed();
255 } );
256
257 connect( mShowLeadingZerosCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
258 mFormat->setShowLeadingZeros( checked );
259 if ( !mBlockSignals )
260 emit changed();
261 } );
262
263 connect( mShowLeadingZerosForDegreesCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
264 mFormat->setShowDegreeLeadingZeros( checked );
265 if ( !mBlockSignals )
266 emit changed();
267 } );
268
269 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [=]( int value ) {
270 mFormat->setNumberDecimalPlaces( value );
271 if ( !mBlockSignals )
272 emit changed();
273 } );
274
275 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [=]( int ) {
276 mFormat->setAngleFormat( static_cast<QgsGeographicCoordinateNumericFormat::AngleFormat>( mFormatComboBox->currentData().toInt() ) );
277 if ( !mBlockSignals )
278 emit changed();
279 } );
280}
281
283
285{
286 mFormat.reset( static_cast<QgsGeographicCoordinateNumericFormat *>( format ) );
287
288 mBlockSignals = true;
289 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
290 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
291 mShowDirectionalSuffixCheckBox->setChecked( mFormat->showDirectionalSuffix() );
292 mShowLeadingZerosCheckBox->setChecked( mFormat->showLeadingZeros() );
293 mShowLeadingZerosForDegreesCheckBox->setChecked( mFormat->showDegreeLeadingZeros() );
294 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( static_cast<int>( mFormat->angleFormat() ) ) );
295 mBlockSignals = false;
296}
297
302
303//
304// QgsGeographicCoordinateNumericFormatDialog
305//
306
308 : QDialog( parent )
309{
310 setLayout( new QVBoxLayout() );
311 mWidget = new QgsGeographicCoordinateNumericFormatWidget( format, hidePrecisionControl );
312 QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
313
314 connect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
315 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
316
317 layout()->addWidget( mWidget );
318 layout()->addWidget( buttonBox );
319
320 connect( mWidget, &QgsPanelWidget::panelAccepted, this, &QDialog::reject );
321
322 setObjectName( QStringLiteral( "QgsGeographicCoordinateNumericFormatDialog" ) );
324}
325
330
331
332//
333// QgsCurrencyNumericFormatWidget
334//
336 : QgsNumericFormatWidget( parent )
337{
338 setupUi( this );
339 mDecimalsSpinBox->setClearValue( 2 );
340 setFormat( format->clone() );
341
342 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
343 mFormat->setShowPlusSign( checked );
344 if ( !mBlockSignals )
345 emit changed();
346 } );
347
348 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
349 mFormat->setShowTrailingZeros( checked );
350 if ( !mBlockSignals )
351 emit changed();
352 } );
353
354 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
355 mFormat->setShowThousandsSeparator( checked );
356 if ( !mBlockSignals )
357 emit changed();
358 } );
359
360 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [=]( int value ) {
361 mFormat->setNumberDecimalPlaces( value );
362 if ( !mBlockSignals )
363 emit changed();
364 } );
365
366 connect( mPrefixLineEdit, &QLineEdit::textChanged, this, [=]( const QString &text ) {
367 mFormat->setPrefix( text );
368 if ( !mBlockSignals )
369 emit changed();
370 } );
371
372 connect( mSuffixLineEdit, &QLineEdit::textChanged, this, [=]( const QString &text ) {
373 mFormat->setSuffix( text );
374 if ( !mBlockSignals )
375 emit changed();
376 } );
377}
378
380
382{
383 mFormat.reset( static_cast<QgsCurrencyNumericFormat *>( format ) );
384
385 mBlockSignals = true;
386 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
387 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
388 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
389 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
390 mPrefixLineEdit->setText( mFormat->prefix() );
391 mSuffixLineEdit->setText( mFormat->suffix() );
392
393 mBlockSignals = false;
394}
395
397{
398 return mFormat->clone();
399}
400
401
402//
403// QgsPercentageNumericFormatWidget
404//
405
407 : QgsNumericFormatWidget( parent )
408{
409 setupUi( this );
410
411 mDecimalsSpinBox->setClearValue( 6 );
412 mScalingComboBox->addItem( QObject::tr( "Values are Percentages (e.g. 50)" ), QgsPercentageNumericFormat::ValuesArePercentage );
413 mScalingComboBox->addItem( QObject::tr( "Values are Fractions (e.g. 0.5)" ), QgsPercentageNumericFormat::ValuesAreFractions );
414
415 setFormat( format->clone() );
416
417 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
418 mFormat->setShowTrailingZeros( checked );
419 if ( !mBlockSignals )
420 emit changed();
421 } );
422
423 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
424 mFormat->setShowPlusSign( checked );
425 if ( !mBlockSignals )
426 emit changed();
427 } );
428
429 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
430 mFormat->setShowThousandsSeparator( checked );
431 if ( !mBlockSignals )
432 emit changed();
433 } );
434
435 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [=]( int value ) {
436 mFormat->setNumberDecimalPlaces( value );
437 if ( !mBlockSignals )
438 emit changed();
439 } );
440
441 connect( mScalingComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [=]( int ) {
442 mFormat->setInputValues( static_cast<QgsPercentageNumericFormat::InputValues>( mScalingComboBox->currentData().toInt() ) );
443 if ( !mBlockSignals )
444 emit changed();
445 } );
446}
447
449
451{
452 mFormat.reset( static_cast<QgsPercentageNumericFormat *>( format ) );
453
454 mBlockSignals = true;
455 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
456 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
457 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
458 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
459 mScalingComboBox->setCurrentIndex( mScalingComboBox->findData( static_cast<int>( mFormat->inputValues() ) ) );
460 mBlockSignals = false;
461}
462
464{
465 return mFormat->clone();
466}
467
468//
469// QgsScientificNumericFormatWidget
470//
472 : QgsNumericFormatWidget( parent )
473{
474 setupUi( this );
475 mDecimalsSpinBox->setClearValue( 6 );
476 setFormat( format->clone() );
477
478 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
479 mFormat->setShowPlusSign( checked );
480 if ( !mBlockSignals )
481 emit changed();
482 } );
483
484 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
485 mFormat->setShowTrailingZeros( checked );
486 if ( !mBlockSignals )
487 emit changed();
488 } );
489
490 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [=]( int value ) {
491 mFormat->setNumberDecimalPlaces( value );
492 if ( !mBlockSignals )
493 emit changed();
494 } );
495}
496
498
500{
501 mFormat.reset( static_cast<QgsScientificNumericFormat *>( format ) );
502
503 mBlockSignals = true;
504 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
505 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
506 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
507 mBlockSignals = false;
508}
509
511{
512 return mFormat->clone();
513}
514
515
516//
517// QgsFractionNumericFormatWidget
518//
520 : QgsNumericFormatWidget( parent )
521{
522 setupUi( this );
523 setFormat( format->clone() );
524
525 mThousandsLineEdit->setShowClearButton( true );
526
527 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
528 mFormat->setUseDedicatedUnicodeCharacters( checked );
529 if ( !mBlockSignals )
530 emit changed();
531 } );
532
533 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
534 mFormat->setUseUnicodeSuperSubscript( checked );
535 if ( !mBlockSignals )
536 emit changed();
537 } );
538
539 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
540 mFormat->setShowPlusSign( checked );
541 if ( !mBlockSignals )
542 emit changed();
543 } );
544
545 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [=]( bool checked ) {
546 mFormat->setShowThousandsSeparator( checked );
547 if ( !mBlockSignals )
548 emit changed();
549 } );
550
551 connect( mThousandsLineEdit, &QLineEdit::textChanged, this, [=]( const QString &text ) {
552 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
553 if ( !mBlockSignals )
554 emit changed();
555 } );
556}
557
559
561{
562 mFormat.reset( static_cast<QgsFractionNumericFormat *>( format ) );
563
564 mBlockSignals = true;
565 mUseDedicatedUnicodeCheckBox->setChecked( mFormat->useDedicatedUnicodeCharacters() );
566 mUseUnicodeSupersubscriptCheckBox->setChecked( mFormat->useUnicodeSuperSubscript() );
567 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
568 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
569 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
570 mBlockSignals = false;
571}
572
574{
575 return mFormat->clone();
576}
577
578
579//
580// QgsExpressionBasedNumericFormatWidget
581//
583 : QgsNumericFormatWidget( parent )
584{
585 setupUi( this );
586 setFormat( format->clone() );
587
588 mExpressionSelector->setMultiLine( true );
589 mExpressionSelector->registerExpressionContextGenerator( this );
590
591 connect( mExpressionSelector, &QgsExpressionLineEdit::expressionChanged, this, [=]( const QString &text ) {
592 mFormat->setExpression( text );
593 if ( !mBlockSignals )
594 emit changed();
595 } );
596}
597
599{
601
603 scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "value" ), 1234.5678 ) );
604 context.appendScope( scope );
605 context.setHighlightedVariables( { QStringLiteral( "value" ) } );
606 return context;
607}
608
610
612{
613 mFormat.reset( static_cast<QgsExpressionBasedNumericFormat *>( format ) );
614
615 mBlockSignals = true;
616 mExpressionSelector->setExpression( mFormat->expression() );
617 mBlockSignals = false;
618}
619
621{
622 return mFormat->clone();
623}
QgsBasicNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsBasicNumericFormatWidget, initially showing the specified format.
~QgsBasicNumericFormatWidget() override
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
A numeric formatter which returns a simple text representation of a value.
@ DecimalPlaces
Maximum number of decimal places.
@ SignificantFigures
Maximum number of significant figures.
QgsBearingNumericFormatDialog(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsBearingNumericFormatDialog, initially showing the specified format.
QgsBearingNumericFormat * format()
Returns the format defined by the current settings in the dialog.
A widget which allow control over the properties of a QgsBearingNumericFormat.
QgsBearingNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsBearingNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
~QgsBearingNumericFormatWidget() override
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
A numeric formatter which returns a text representation of a direction/bearing.
FormatDirectionOption
Directional formatting option, which controls how bearing direction is described in the returned stri...
@ UseRange0To180WithEWDirectionalSuffix
Return values between 0 and 180, with a E or W directional suffix.
@ UseRange0To360
Return values between 0 to 360.
@ UseRangeNegative180ToPositive180
Return values between -180 and 180.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsCurrencyNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsCurrencyNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
~QgsCurrencyNumericFormatWidget() override
A numeric formatter which returns a text representation of a currency value.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
QgsExpressionBasedNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsExpressionBasedNumericFormatWidget, initially showing the specified format.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsExpressionContext createExpressionContext() const final
This method needs to be reimplemented in all classes which implement this interface and return an exp...
A numeric formatter which uses a QgsExpression to calculate the text representation of a value.
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.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
~QgsFractionNumericFormatWidget() override
QgsFractionNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsFractionNumericFormatWidget, initially showing the specified format.
A numeric formatter which returns a vulgar fractional representation of a decimal value (e....
QgsGeographicCoordinateNumericFormatDialog(const QgsNumericFormat *format, bool hidePrecisionControl=false, QWidget *parent=nullptr)
Constructor for QgsGeographicCoordinateNumericFormatDialog, initially showing the specified format.
QgsGeographicCoordinateNumericFormat * format()
Returns the format defined by the current settings in the dialog.
A widget which allow control over the properties of a QgsGeographicCoordinateNumericFormat.
QgsGeographicCoordinateNumericFormatWidget(const QgsNumericFormat *format, bool hidePrecisionControl=false, QWidget *parent=nullptr)
Constructor for QgsGeographicCoordinateNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
A numeric formatter which returns a text representation of a geographic coordinate (latitude or longi...
@ DegreesMinutes
Degrees and decimal minutes, eg 30 degrees 45.55'.
@ DecimalDegrees
Decimal degrees, eg 30.7555 degrees.
@ DegreesMinutesSeconds
Degrees, minutes and seconds, eg 30 degrees 45'30.
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...
Definition qgsgui.cpp:210
Base class for widgets which allow control over the properties of QgsNumericFormat subclasses.
void registerExpressionContextGenerator(QgsExpressionContextGenerator *generator)
Register an expression context generator class that will be used to retrieve an expression context fo...
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void changed()
Emitted whenever the configuration of the numeric format is changed.
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
virtual QgsNumericFormat * clone() const =0
Clones the format, returning a new object.
void panelAccepted(QgsPanelWidget *panel)
Emitted when the panel is accepted by the user.
QgsPercentageNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsPercentageNumericFormatWidget, initially showing the specified format.
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
A numeric formatter which returns a text representation of a percentage value.
InputValues
Input value format, which specifies the format of the incoming values.
@ ValuesAreFractions
Incoming values are numeric fractions (e.g. 0.5 for 50%)
@ ValuesArePercentage
Incoming values are percentage values (e.g. 50 for 50%)
void setFormat(QgsNumericFormat *format) final
Sets the format to show in the widget.
QgsScientificNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsScientificNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() final
Returns the format defined by the current settings in the widget.
A numeric formatter which returns a scientific notation representation of a value.
Single variable definition for use within a QgsExpressionContextScope.