QGIS API Documentation 3.39.0-Master (9ea1ddbe645)
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
25#include "qgsgui.h"
26#include "qgis.h"
27#include <QDialogButtonBox>
28
29//
30// QgsBasicNumericFormatWidget
31//
33 : QgsNumericFormatWidget( parent )
34{
35 setupUi( this );
37
38 mDecimalsSpinBox->setClearValue( 6 );
39 mThousandsLineEdit->setShowClearButton( true );
40 mDecimalLineEdit->setShowClearButton( true );
41
42 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
43 {
44 mFormat->setShowPlusSign( checked );
45 if ( !mBlockSignals )
46 emit changed();
47 } );
48
49 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
50 {
51 mFormat->setShowTrailingZeros( checked );
52 if ( !mBlockSignals )
53 emit changed();
54 } );
55
56 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
57 {
58 mFormat->setShowThousandsSeparator( checked );
59 if ( !mBlockSignals )
60 emit changed();
61 } );
62
63 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
64 {
65 mFormat->setNumberDecimalPlaces( value );
66 if ( !mBlockSignals )
67 emit changed();
68 } );
69
70 connect( mRadDecimalPlaces, &QRadioButton::toggled, this, [ = ]( bool checked )
71 {
72 if ( !checked )
73 return;
74
75 mFormat->setRoundingType( QgsBasicNumericFormat::DecimalPlaces );
76 if ( !mBlockSignals )
77 emit changed();
78 } );
79
80 connect( mRadSignificantFigures, &QRadioButton::toggled, this, [ = ]( bool checked )
81 {
82 if ( !checked )
83 return;
84
85 mFormat->setRoundingType( QgsBasicNumericFormat::SignificantFigures );
86 if ( !mBlockSignals )
87 emit changed();
88 } );
89
90 connect( mThousandsLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
91 {
92 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
93 if ( !mBlockSignals )
94 emit changed();
95 } );
96
97 connect( mDecimalLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
98 {
99 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
100 if ( !mBlockSignals )
101 emit changed();
102 } );
103}
104
106
108{
109 mFormat.reset( static_cast< QgsBasicNumericFormat * >( format ) );
110
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() )
119 {
121 mRadDecimalPlaces->setChecked( true );
122 break;
123
125 mRadSignificantFigures->setChecked( true );
126 break;
127 }
128
129 mBlockSignals = false;
130}
131
133{
134 return mFormat->clone();
135}
136
137//
138// QgsBearingNumericFormatWidget
139//
140
142 : QgsNumericFormatWidget( parent )
143{
144 setupUi( this );
145
146 mDecimalsSpinBox->setClearValue( 6 );
147 mFormatComboBox->addItem( QObject::tr( "0 to 180°, with E/W suffix" ), QgsBearingNumericFormat::UseRange0To180WithEWDirectionalSuffix );
148 mFormatComboBox->addItem( QObject::tr( "-180 to +180°" ), QgsBearingNumericFormat::UseRangeNegative180ToPositive180 );
149 mFormatComboBox->addItem( QObject::tr( "0 to 360°" ), QgsBearingNumericFormat::UseRange0To360 );
150
151 setFormat( format->clone() );
152
153 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
154 {
155 mFormat->setShowTrailingZeros( checked );
156 if ( !mBlockSignals )
157 emit changed();
158 } );
159
160 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
161 {
162 mFormat->setNumberDecimalPlaces( value );
163 if ( !mBlockSignals )
164 emit changed();
165 } );
166
167 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [ = ]( int )
168 {
169 mFormat->setDirectionFormat( static_cast < QgsBearingNumericFormat::FormatDirectionOption >( mFormatComboBox->currentData().toInt() ) );
170 if ( !mBlockSignals )
171 emit changed();
172 } );
173}
174
176
178{
179 mFormat.reset( static_cast< QgsBearingNumericFormat * >( format ) );
180
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;
186}
187
189{
190 return mFormat->clone();
191}
192
193//
194// QgsBearingNumericFormatDialog
195//
196
198 : QDialog( parent )
199{
200 setLayout( new QVBoxLayout() );
201 mWidget = new QgsBearingNumericFormatWidget( format );
202 QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
203
204 connect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
205 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
206
207 layout()->addWidget( mWidget );
208 layout()->addWidget( buttonBox );
209
210 connect( mWidget, &QgsPanelWidget::panelAccepted, this, &QDialog::reject );
211
212 setObjectName( QStringLiteral( "QgsBearingNumericFormatDialog" ) );
214}
215
220
221
222
223
224
225//
226// QgsGeographicCoordinateNumericFormatWidget
227//
228
230 : QgsNumericFormatWidget( parent )
231{
232 setupUi( this );
233
234 mDecimalsSpinBox->setClearValue( 6 );
235 mFormatComboBox->addItem( QObject::tr( "Decimal Degrees" ), static_cast< int >( QgsGeographicCoordinateNumericFormat::AngleFormat::DecimalDegrees ) );
236 mFormatComboBox->addItem( QObject::tr( "Degrees, Minutes" ), static_cast< int >( QgsGeographicCoordinateNumericFormat::AngleFormat::DegreesMinutes ) );
237 mFormatComboBox->addItem( QObject::tr( "Degrees, Minutes, Seconds" ), static_cast< int >( QgsGeographicCoordinateNumericFormat::AngleFormat::DegreesMinutesSeconds ) );
238
239 if ( hidePrecisionControl )
240 {
241 mLabelDecimalPlaces->hide();
242 mDecimalsSpinBox->hide();
243 }
244 setFormat( format->clone() );
245
246 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
247 {
248 mFormat->setShowTrailingZeros( checked );
249 if ( !mBlockSignals )
250 emit changed();
251 } );
252
253 connect( mShowDirectionalSuffixCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
254 {
255 mFormat->setShowDirectionalSuffix( checked );
256 if ( !mBlockSignals )
257 emit changed();
258 } );
259
260 connect( mShowLeadingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
261 {
262 mFormat->setShowLeadingZeros( checked );
263 if ( !mBlockSignals )
264 emit changed();
265 } );
266
267 connect( mShowLeadingZerosForDegreesCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
268 {
269 mFormat->setShowDegreeLeadingZeros( checked );
270 if ( !mBlockSignals )
271 emit changed();
272 } );
273
274 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
275 {
276 mFormat->setNumberDecimalPlaces( value );
277 if ( !mBlockSignals )
278 emit changed();
279 } );
280
281 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [ = ]( int )
282 {
283 mFormat->setAngleFormat( static_cast < QgsGeographicCoordinateNumericFormat::AngleFormat >( mFormatComboBox->currentData().toInt() ) );
284 if ( !mBlockSignals )
285 emit changed();
286 } );
287}
288
290
292{
293 mFormat.reset( static_cast< QgsGeographicCoordinateNumericFormat * >( format ) );
294
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;
303}
304
309
310//
311// QgsGeographicCoordinateNumericFormatDialog
312//
313
315 : QDialog( parent )
316{
317 setLayout( new QVBoxLayout() );
318 mWidget = new QgsGeographicCoordinateNumericFormatWidget( format, hidePrecisionControl );
319 QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
320
321 connect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
322 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
323
324 layout()->addWidget( mWidget );
325 layout()->addWidget( buttonBox );
326
327 connect( mWidget, &QgsPanelWidget::panelAccepted, this, &QDialog::reject );
328
329 setObjectName( QStringLiteral( "QgsGeographicCoordinateNumericFormatDialog" ) );
331}
332
337
338
339
340
341//
342// QgsCurrencyNumericFormatWidget
343//
345 : QgsNumericFormatWidget( parent )
346{
347 setupUi( this );
348 mDecimalsSpinBox->setClearValue( 2 );
349 setFormat( format->clone() );
350
351 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
352 {
353 mFormat->setShowPlusSign( checked );
354 if ( !mBlockSignals )
355 emit changed();
356 } );
357
358 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
359 {
360 mFormat->setShowTrailingZeros( checked );
361 if ( !mBlockSignals )
362 emit changed();
363 } );
364
365 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
366 {
367 mFormat->setShowThousandsSeparator( checked );
368 if ( !mBlockSignals )
369 emit changed();
370 } );
371
372 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
373 {
374 mFormat->setNumberDecimalPlaces( value );
375 if ( !mBlockSignals )
376 emit changed();
377 } );
378
379 connect( mPrefixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
380 {
381 mFormat->setPrefix( text );
382 if ( !mBlockSignals )
383 emit changed();
384 } );
385
386 connect( mSuffixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
387 {
388 mFormat->setSuffix( text );
389 if ( !mBlockSignals )
390 emit changed();
391 } );
392}
393
395
397{
398 mFormat.reset( static_cast< QgsCurrencyNumericFormat * >( format ) );
399
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() );
407
408 mBlockSignals = false;
409}
410
412{
413 return mFormat->clone();
414}
415
416
417//
418// QgsPercentageNumericFormatWidget
419//
420
422 : QgsNumericFormatWidget( parent )
423{
424 setupUi( this );
425
426 mDecimalsSpinBox->setClearValue( 6 );
427 mScalingComboBox->addItem( QObject::tr( "Values are Percentages (e.g. 50)" ), QgsPercentageNumericFormat::ValuesArePercentage );
428 mScalingComboBox->addItem( QObject::tr( "Values are Fractions (e.g. 0.5)" ), QgsPercentageNumericFormat::ValuesAreFractions );
429
430 setFormat( format->clone() );
431
432 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
433 {
434 mFormat->setShowTrailingZeros( checked );
435 if ( !mBlockSignals )
436 emit changed();
437 } );
438
439 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
440 {
441 mFormat->setShowPlusSign( checked );
442 if ( !mBlockSignals )
443 emit changed();
444 } );
445
446 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
447 {
448 mFormat->setShowThousandsSeparator( checked );
449 if ( !mBlockSignals )
450 emit changed();
451 } );
452
453 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
454 {
455 mFormat->setNumberDecimalPlaces( value );
456 if ( !mBlockSignals )
457 emit changed();
458 } );
459
460 connect( mScalingComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [ = ]( int )
461 {
462 mFormat->setInputValues( static_cast < QgsPercentageNumericFormat::InputValues >( mScalingComboBox->currentData().toInt() ) );
463 if ( !mBlockSignals )
464 emit changed();
465 } );
466}
467
469
471{
472 mFormat.reset( static_cast< QgsPercentageNumericFormat * >( format ) );
473
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;
481}
482
484{
485 return mFormat->clone();
486}
487
488//
489// QgsScientificNumericFormatWidget
490//
492 : QgsNumericFormatWidget( parent )
493{
494 setupUi( this );
495 mDecimalsSpinBox->setClearValue( 6 );
496 setFormat( format->clone() );
497
498 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
499 {
500 mFormat->setShowPlusSign( checked );
501 if ( !mBlockSignals )
502 emit changed();
503 } );
504
505 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
506 {
507 mFormat->setShowTrailingZeros( checked );
508 if ( !mBlockSignals )
509 emit changed();
510 } );
511
512 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
513 {
514 mFormat->setNumberDecimalPlaces( value );
515 if ( !mBlockSignals )
516 emit changed();
517 } );
518}
519
521
523{
524 mFormat.reset( static_cast< QgsScientificNumericFormat * >( format ) );
525
526 mBlockSignals = true;
527 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
528 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
529 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
530 mBlockSignals = false;
531}
532
534{
535 return mFormat->clone();
536}
537
538
539
540//
541// QgsFractionNumericFormatWidget
542//
544 : QgsNumericFormatWidget( parent )
545{
546 setupUi( this );
547 setFormat( format->clone() );
548
549 mThousandsLineEdit->setShowClearButton( true );
550
551 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
552 {
553 mFormat->setUseDedicatedUnicodeCharacters( checked );
554 if ( !mBlockSignals )
555 emit changed();
556 } );
557
558 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
559 {
560 mFormat->setUseUnicodeSuperSubscript( checked );
561 if ( !mBlockSignals )
562 emit changed();
563 } );
564
565 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
566 {
567 mFormat->setShowPlusSign( checked );
568 if ( !mBlockSignals )
569 emit changed();
570 } );
571
572 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
573 {
574 mFormat->setShowThousandsSeparator( checked );
575 if ( !mBlockSignals )
576 emit changed();
577 } );
578
579 connect( mThousandsLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
580 {
581 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
582 if ( !mBlockSignals )
583 emit changed();
584 } );
585
586}
587
589
591{
592 mFormat.reset( static_cast< QgsFractionNumericFormat * >( format ) );
593
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;
601}
602
604{
605 return mFormat->clone();
606}
607
608
609//
610// QgsExpressionBasedNumericFormatWidget
611//
613 : QgsNumericFormatWidget( parent )
614{
615 setupUi( this );
616 setFormat( format->clone() );
617
618 mExpressionSelector->setMultiLine( true );
619 mExpressionSelector->registerExpressionContextGenerator( this );
620
621 connect( mExpressionSelector, &QgsExpressionLineEdit::expressionChanged, this, [ = ]( const QString & text )
622 {
623 mFormat->setExpression( text );
624 if ( !mBlockSignals )
625 emit changed();
626 } );
627
628}
629
631{
632 QgsExpressionContext context;
633
635 scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "value" ), 1234.5678 ) );
636 context.appendScope( scope );
637 context.setHighlightedVariables( { QStringLiteral( "value" )} );
638 return context;
639}
640
642
644{
645 mFormat.reset( static_cast< QgsExpressionBasedNumericFormat * >( format ) );
646
647 mBlockSignals = true;
648 mExpressionSelector->setExpression( mFormat->expression() );
649 mBlockSignals = false;
650}
651
653{
654 return mFormat->clone();
655}
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.
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:208
Base class for widgets which allow control over the properties of QgsNumericFormat subclasses.
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.