QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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
24#include "qgsgui.h"
25#include "qgis.h"
26#include <QDialogButtonBox>
27
28//
29// QgsBasicNumericFormatWidget
30//
32 : QgsNumericFormatWidget( parent )
33{
34 setupUi( this );
36
37 mDecimalsSpinBox->setClearValue( 6 );
38 mThousandsLineEdit->setShowClearButton( true );
39 mDecimalLineEdit->setShowClearButton( true );
40
41 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
42 {
43 mFormat->setShowPlusSign( checked );
44 if ( !mBlockSignals )
45 emit changed();
46 } );
47
48 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
49 {
50 mFormat->setShowTrailingZeros( checked );
51 if ( !mBlockSignals )
52 emit changed();
53 } );
54
55 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
56 {
57 mFormat->setShowThousandsSeparator( checked );
58 if ( !mBlockSignals )
59 emit changed();
60 } );
61
62 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
63 {
64 mFormat->setNumberDecimalPlaces( value );
65 if ( !mBlockSignals )
66 emit changed();
67 } );
68
69 connect( mRadDecimalPlaces, &QRadioButton::toggled, this, [ = ]( bool checked )
70 {
71 if ( !checked )
72 return;
73
74 mFormat->setRoundingType( QgsBasicNumericFormat::DecimalPlaces );
75 if ( !mBlockSignals )
76 emit changed();
77 } );
78
79 connect( mRadSignificantFigures, &QRadioButton::toggled, this, [ = ]( bool checked )
80 {
81 if ( !checked )
82 return;
83
84 mFormat->setRoundingType( QgsBasicNumericFormat::SignificantFigures );
85 if ( !mBlockSignals )
86 emit changed();
87 } );
88
89 connect( mThousandsLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
90 {
91 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
92 if ( !mBlockSignals )
93 emit changed();
94 } );
95
96 connect( mDecimalLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
97 {
98 mFormat->setDecimalSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
99 if ( !mBlockSignals )
100 emit changed();
101 } );
102}
103
105
107{
108 mFormat.reset( static_cast< QgsBasicNumericFormat * >( format ) );
109
110 mBlockSignals = true;
111 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
112 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
113 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
114 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
115 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
116 mDecimalLineEdit->setText( mFormat->decimalSeparator().isNull() ? QString() : mFormat->decimalSeparator() );
117 switch ( mFormat->roundingType() )
118 {
120 mRadDecimalPlaces->setChecked( true );
121 break;
122
124 mRadSignificantFigures->setChecked( true );
125 break;
126 }
127
128 mBlockSignals = false;
129}
130
132{
133 return mFormat->clone();
134}
135
136//
137// QgsBearingNumericFormatWidget
138//
139
141 : QgsNumericFormatWidget( parent )
142{
143 setupUi( this );
144
145 mDecimalsSpinBox->setClearValue( 6 );
146 mFormatComboBox->addItem( QObject::tr( "0 to 180°, with E/W suffix" ), QgsBearingNumericFormat::UseRange0To180WithEWDirectionalSuffix );
147 mFormatComboBox->addItem( QObject::tr( "-180 to +180°" ), QgsBearingNumericFormat::UseRangeNegative180ToPositive180 );
148 mFormatComboBox->addItem( QObject::tr( "0 to 360°" ), QgsBearingNumericFormat::UseRange0To360 );
149
150 setFormat( format->clone() );
151
152 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
153 {
154 mFormat->setShowTrailingZeros( checked );
155 if ( !mBlockSignals )
156 emit changed();
157 } );
158
159 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
160 {
161 mFormat->setNumberDecimalPlaces( value );
162 if ( !mBlockSignals )
163 emit changed();
164 } );
165
166 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [ = ]( int )
167 {
168 mFormat->setDirectionFormat( static_cast < QgsBearingNumericFormat::FormatDirectionOption >( mFormatComboBox->currentData().toInt() ) );
169 if ( !mBlockSignals )
170 emit changed();
171 } );
172}
173
175
177{
178 mFormat.reset( static_cast< QgsBearingNumericFormat * >( format ) );
179
180 mBlockSignals = true;
181 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
182 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
183 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( static_cast< int >( mFormat->directionFormat() ) ) );
184 mBlockSignals = false;
185}
186
188{
189 return mFormat->clone();
190}
191
192//
193// QgsBearingNumericFormatDialog
194//
195
197 : QDialog( parent )
198{
199 setLayout( new QVBoxLayout() );
200 mWidget = new QgsBearingNumericFormatWidget( format );
201 QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
202
203 connect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
204 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
205
206 layout()->addWidget( mWidget );
207 layout()->addWidget( buttonBox );
208
209 connect( mWidget, &QgsPanelWidget::panelAccepted, this, &QDialog::reject );
210
211 setObjectName( QStringLiteral( "QgsBearingNumericFormatDialog" ) );
213}
214
216{
217 return static_cast< QgsBearingNumericFormat * >( mWidget->format() );
218}
219
220
221
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 {
247 mFormat->setShowTrailingZeros( checked );
248 if ( !mBlockSignals )
249 emit changed();
250 } );
251
252 connect( mShowDirectionalSuffixCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
253 {
254 mFormat->setShowDirectionalSuffix( checked );
255 if ( !mBlockSignals )
256 emit changed();
257 } );
258
259 connect( mShowLeadingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
260 {
261 mFormat->setShowLeadingZeros( checked );
262 if ( !mBlockSignals )
263 emit changed();
264 } );
265
266 connect( mShowLeadingZerosForDegreesCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
267 {
268 mFormat->setShowDegreeLeadingZeros( checked );
269 if ( !mBlockSignals )
270 emit changed();
271 } );
272
273 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
274 {
275 mFormat->setNumberDecimalPlaces( value );
276 if ( !mBlockSignals )
277 emit changed();
278 } );
279
280 connect( mFormatComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [ = ]( int )
281 {
282 mFormat->setAngleFormat( static_cast < QgsGeographicCoordinateNumericFormat::AngleFormat >( mFormatComboBox->currentData().toInt() ) );
283 if ( !mBlockSignals )
284 emit changed();
285 } );
286}
287
289
291{
292 mFormat.reset( static_cast< QgsGeographicCoordinateNumericFormat * >( format ) );
293
294 mBlockSignals = true;
295 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
296 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
297 mShowDirectionalSuffixCheckBox->setChecked( mFormat->showDirectionalSuffix() );
298 mShowLeadingZerosCheckBox->setChecked( mFormat->showLeadingZeros() );
299 mShowLeadingZerosForDegreesCheckBox->setChecked( mFormat->showDegreeLeadingZeros() );
300 mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( static_cast< int >( mFormat->angleFormat() ) ) );
301 mBlockSignals = false;
302}
303
305{
306 return mFormat->clone();
307}
308
309//
310// QgsGeographicCoordinateNumericFormatDialog
311//
312
314 : QDialog( parent )
315{
316 setLayout( new QVBoxLayout() );
317 mWidget = new QgsGeographicCoordinateNumericFormatWidget( format, hidePrecisionControl );
318 QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
319
320 connect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
321 connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
322
323 layout()->addWidget( mWidget );
324 layout()->addWidget( buttonBox );
325
326 connect( mWidget, &QgsPanelWidget::panelAccepted, this, &QDialog::reject );
327
328 setObjectName( QStringLiteral( "QgsGeographicCoordinateNumericFormatDialog" ) );
330}
331
333{
334 return static_cast< QgsGeographicCoordinateNumericFormat * >( mWidget->format() );
335}
336
337
338
339
340//
341// QgsCurrencyNumericFormatWidget
342//
344 : QgsNumericFormatWidget( parent )
345{
346 setupUi( this );
347 mDecimalsSpinBox->setClearValue( 2 );
348 setFormat( format->clone() );
349
350 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
351 {
352 mFormat->setShowPlusSign( checked );
353 if ( !mBlockSignals )
354 emit changed();
355 } );
356
357 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
358 {
359 mFormat->setShowTrailingZeros( checked );
360 if ( !mBlockSignals )
361 emit changed();
362 } );
363
364 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
365 {
366 mFormat->setShowThousandsSeparator( checked );
367 if ( !mBlockSignals )
368 emit changed();
369 } );
370
371 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
372 {
373 mFormat->setNumberDecimalPlaces( value );
374 if ( !mBlockSignals )
375 emit changed();
376 } );
377
378 connect( mPrefixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
379 {
380 mFormat->setPrefix( text );
381 if ( !mBlockSignals )
382 emit changed();
383 } );
384
385 connect( mSuffixLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
386 {
387 mFormat->setSuffix( text );
388 if ( !mBlockSignals )
389 emit changed();
390 } );
391}
392
394
396{
397 mFormat.reset( static_cast< QgsCurrencyNumericFormat * >( format ) );
398
399 mBlockSignals = true;
400 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
401 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
402 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
403 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
404 mPrefixLineEdit->setText( mFormat->prefix() );
405 mSuffixLineEdit->setText( mFormat->suffix() );
406
407 mBlockSignals = false;
408}
409
411{
412 return mFormat->clone();
413}
414
415
416//
417// QgsPercentageNumericFormatWidget
418//
419
421 : QgsNumericFormatWidget( parent )
422{
423 setupUi( this );
424
425 mDecimalsSpinBox->setClearValue( 6 );
426 mScalingComboBox->addItem( QObject::tr( "Values are Percentages (e.g. 50)" ), QgsPercentageNumericFormat::ValuesArePercentage );
427 mScalingComboBox->addItem( QObject::tr( "Values are Fractions (e.g. 0.5)" ), QgsPercentageNumericFormat::ValuesAreFractions );
428
429 setFormat( format->clone() );
430
431 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
432 {
433 mFormat->setShowTrailingZeros( checked );
434 if ( !mBlockSignals )
435 emit changed();
436 } );
437
438 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
439 {
440 mFormat->setShowPlusSign( checked );
441 if ( !mBlockSignals )
442 emit changed();
443 } );
444
445 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
446 {
447 mFormat->setShowThousandsSeparator( checked );
448 if ( !mBlockSignals )
449 emit changed();
450 } );
451
452 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
453 {
454 mFormat->setNumberDecimalPlaces( value );
455 if ( !mBlockSignals )
456 emit changed();
457 } );
458
459 connect( mScalingComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, [ = ]( int )
460 {
461 mFormat->setInputValues( static_cast < QgsPercentageNumericFormat::InputValues >( mScalingComboBox->currentData().toInt() ) );
462 if ( !mBlockSignals )
463 emit changed();
464 } );
465}
466
468
470{
471 mFormat.reset( static_cast< QgsPercentageNumericFormat * >( format ) );
472
473 mBlockSignals = true;
474 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
475 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
476 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
477 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
478 mScalingComboBox->setCurrentIndex( mScalingComboBox->findData( static_cast< int >( mFormat->inputValues() ) ) );
479 mBlockSignals = false;
480}
481
483{
484 return mFormat->clone();
485}
486
487//
488// QgsScientificNumericFormatWidget
489//
491 : QgsNumericFormatWidget( parent )
492{
493 setupUi( this );
494 mDecimalsSpinBox->setClearValue( 6 );
495 setFormat( format->clone() );
496
497 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
498 {
499 mFormat->setShowPlusSign( checked );
500 if ( !mBlockSignals )
501 emit changed();
502 } );
503
504 connect( mShowTrailingZerosCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
505 {
506 mFormat->setShowTrailingZeros( checked );
507 if ( !mBlockSignals )
508 emit changed();
509 } );
510
511 connect( mDecimalsSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ]( int value )
512 {
513 mFormat->setNumberDecimalPlaces( value );
514 if ( !mBlockSignals )
515 emit changed();
516 } );
517}
518
520
522{
523 mFormat.reset( static_cast< QgsScientificNumericFormat * >( format ) );
524
525 mBlockSignals = true;
526 mDecimalsSpinBox->setValue( mFormat->numberDecimalPlaces() );
527 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
528 mShowTrailingZerosCheckBox->setChecked( mFormat->showTrailingZeros() );
529 mBlockSignals = false;
530}
531
533{
534 return mFormat->clone();
535}
536
537
538
539//
540// QgsFractionNumericFormatWidget
541//
543 : QgsNumericFormatWidget( parent )
544{
545 setupUi( this );
546 setFormat( format->clone() );
547
548 mThousandsLineEdit->setShowClearButton( true );
549
550 connect( mUseDedicatedUnicodeCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
551 {
552 mFormat->setUseDedicatedUnicodeCharacters( checked );
553 if ( !mBlockSignals )
554 emit changed();
555 } );
556
557 connect( mUseUnicodeSupersubscriptCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
558 {
559 mFormat->setUseUnicodeSuperSubscript( checked );
560 if ( !mBlockSignals )
561 emit changed();
562 } );
563
564 connect( mShowPlusCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
565 {
566 mFormat->setShowPlusSign( checked );
567 if ( !mBlockSignals )
568 emit changed();
569 } );
570
571 connect( mShowThousandsCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked )
572 {
573 mFormat->setShowThousandsSeparator( checked );
574 if ( !mBlockSignals )
575 emit changed();
576 } );
577
578 connect( mThousandsLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & text )
579 {
580 mFormat->setThousandsSeparator( text.isEmpty() ? QChar() : text.at( 0 ) );
581 if ( !mBlockSignals )
582 emit changed();
583 } );
584
585}
586
588
590{
591 mFormat.reset( static_cast< QgsFractionNumericFormat * >( format ) );
592
593 mBlockSignals = true;
594 mUseDedicatedUnicodeCheckBox->setChecked( mFormat->useDedicatedUnicodeCharacters() );
595 mUseUnicodeSupersubscriptCheckBox->setChecked( mFormat->useUnicodeSuperSubscript() );
596 mShowPlusCheckBox->setChecked( mFormat->showPlusSign() );
597 mShowThousandsCheckBox->setChecked( mFormat->showThousandsSeparator() );
598 mThousandsLineEdit->setText( mFormat->thousandsSeparator().isNull() ? QString() : mFormat->thousandsSeparator() );
599 mBlockSignals = false;
600}
601
603{
604 return mFormat->clone();
605}
void setFormat(QgsNumericFormat *format) override
Sets the format to show in the widget.
QgsBasicNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsBasicNumericFormatWidget, initially showing the specified format.
~QgsBasicNumericFormatWidget() override
QgsNumericFormat * format() override
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() override
Returns the format defined by the current settings in the widget.
~QgsBearingNumericFormatWidget() override
void setFormat(QgsNumericFormat *format) override
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.
QgsCurrencyNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsCurrencyNumericFormatWidget, initially showing the specified format.
void setFormat(QgsNumericFormat *format) override
Sets the format to show in the widget.
~QgsCurrencyNumericFormatWidget() override
QgsNumericFormat * format() override
Returns the format defined by the current settings in the widget.
A numeric formatter which returns a text representation of a currency value.
~QgsFractionNumericFormatWidget() override
void setFormat(QgsNumericFormat *format) override
Sets the format to show in the widget.
QgsFractionNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsFractionNumericFormatWidget, initially showing the specified format.
QgsNumericFormat * format() override
Returns the format defined by the current settings in the widget.
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.
void setFormat(QgsNumericFormat *format) override
Sets the format to show in the widget.
QgsNumericFormat * format() override
Returns the format defined by the current settings in the widget.
QgsGeographicCoordinateNumericFormatWidget(const QgsNumericFormat *format, bool hidePrecisionControl=false, QWidget *parent=nullptr)
Constructor for QgsGeographicCoordinateNumericFormatWidget, initially showing the specified format.
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:178
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.
QgsNumericFormat * format() override
Returns the format defined by the current settings in the widget.
QgsPercentageNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsPercentageNumericFormatWidget, initially showing the specified format.
void setFormat(QgsNumericFormat *format) override
Sets the format to show 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%)
QgsNumericFormat * format() override
Returns the format defined by the current settings in the widget.
void setFormat(QgsNumericFormat *format) override
Sets the format to show in the widget.
QgsScientificNumericFormatWidget(const QgsNumericFormat *format, QWidget *parent=nullptr)
Constructor for QgsScientificNumericFormatWidget, initially showing the specified format.
A numeric formatter which returns a scientific notation representation of a value.