QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsScientificNumericFormat Class Reference

A numeric formatter which returns a scientific notation representation of a value. More...

#include <qgsscientificnumericformat.h>

Inheritance diagram for QgsScientificNumericFormat:
Inheritance graph
[legend]

Public Member Functions

 QgsScientificNumericFormat ()
 Default constructor.
 
QgsNumericFormatclone () const override
 Clones the format, returning a new object.
 
QVariantMap configuration (const QgsReadWriteContext &context) const override
 Returns the current configuration of the formatter.
 
QgsNumericFormatcreate (const QVariantMap &configuration, const QgsReadWriteContext &context) const override
 Creates a new copy of the format, using the supplied configuration.
 
QString formatDouble (double value, const QgsNumericFormatContext &context) const override
 Returns a formatted string representation of a numeric double value.
 
QString id () const override
 Returns a unique id for this numeric format.
 
void setNumberDecimalPlaces (int places) override
 Sets the maximum number of decimal places to show.
 
int sortKey () override
 Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists.
 
QString visibleName () const override
 Returns the translated, user-visible name for this format.
 
- Public Member Functions inherited from QgsBasicNumericFormat
 QgsBasicNumericFormat ()
 Default constructor.
 
QChar decimalSeparator () const
 Returns any override for the decimal separator character.
 
int numberDecimalPlaces () const
 Returns the maximum number of decimal places to show.
 
RoundingType roundingType () const
 Returns the rounding type, which controls the behavior of the numberDecimalPlaces() setting.
 
void setDecimalSeparator (QChar character)
 Sets an override character for the decimal separator character.
 
void setRoundingType (RoundingType type)
 Sets the rounding type, which controls the behavior of the numberDecimalPlaces() setting.
 
void setShowPlusSign (bool show)
 Sets whether a leading plus sign will be shown for positive values.
 
void setShowThousandsSeparator (bool show)
 Sets whether the thousands grouping separator will be shown.
 
void setShowTrailingZeros (bool show)
 Sets whether trailing zeros will be shown (up to the specified numberDecimalPlaces()).
 
void setThousandsSeparator (QChar character)
 Sets an override character for the thousands separator character.
 
bool showPlusSign () const
 Returns true if a leading plus sign will be shown for positive values.
 
bool showThousandsSeparator () const
 Returns true if the thousands grouping separator will be shown.
 
bool showTrailingZeros () const
 Returns true if trailing zeros will be shown (up to the specified numberDecimalPlaces()).
 
QChar thousandsSeparator () const
 Returns any override for the thousands separator character.
 
- Public Member Functions inherited from QgsNumericFormat
 QgsNumericFormat ()=default
 
virtual ~QgsNumericFormat ()=default
 
bool operator!= (const QgsNumericFormat &other) const
 
bool operator== (const QgsNumericFormat &other) const
 
virtual double suggestSampleValue () const
 Returns a suggested sample value which nicely represents the current format configuration.
 
void writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
 Writes the format to an XML element.
 

Additional Inherited Members

- Public Types inherited from QgsBasicNumericFormat
enum  RoundingType { DecimalPlaces , SignificantFigures }
 Sets rounding type and behavior of the numberDecimalPlaces() setting. More...
 
- Protected Member Functions inherited from QgsBasicNumericFormat
virtual void setConfiguration (const QVariantMap &configuration, const QgsReadWriteContext &context)
 Sets the format's configuration.
 
- Protected Attributes inherited from QgsBasicNumericFormat
bool mUseScientific = false
 
- Static Protected Attributes inherited from QgsNumericFormat
static constexpr int DEFAULT_SORT_KEY = 100
 

Detailed Description

A numeric formatter which returns a scientific notation representation of a value.

Since
QGIS 3.12

Definition at line 28 of file qgsscientificnumericformat.h.

Constructor & Destructor Documentation

◆ QgsScientificNumericFormat()

QgsScientificNumericFormat::QgsScientificNumericFormat ( )

Default constructor.

Definition at line 21 of file qgsscientificnumericformat.cpp.

Member Function Documentation

◆ clone()

QgsNumericFormat * QgsScientificNumericFormat::clone ( ) const
overridevirtual

Clones the format, returning a new object.

The caller takes ownership of the returned object.

Reimplemented from QgsBasicNumericFormat.

Definition at line 46 of file qgsscientificnumericformat.cpp.

◆ configuration()

QVariantMap QgsScientificNumericFormat::configuration ( const QgsReadWriteContext context) const
overridevirtual

Returns the current configuration of the formatter.

This value can be used in a call to create() in order to recreate this formatter in its current state.

Reimplemented from QgsBasicNumericFormat.

Definition at line 59 of file qgsscientificnumericformat.cpp.

◆ create()

QgsNumericFormat * QgsScientificNumericFormat::create ( const QVariantMap &  configuration,
const QgsReadWriteContext context 
) const
overridevirtual

Creates a new copy of the format, using the supplied configuration.

The caller takes ownership of the returned object.

Reimplemented from QgsBasicNumericFormat.

Definition at line 51 of file qgsscientificnumericformat.cpp.

◆ formatDouble()

QString QgsScientificNumericFormat::formatDouble ( double  value,
const QgsNumericFormatContext context 
) const
overridevirtual

Returns a formatted string representation of a numeric double value.

Reimplemented from QgsBasicNumericFormat.

Definition at line 41 of file qgsscientificnumericformat.cpp.

◆ id()

QString QgsScientificNumericFormat::id ( ) const
overridevirtual

Returns a unique id for this numeric format.

This id is used to identify this numeric format in the registry with QgsNumericFormatRegistry::format().

Reimplemented from QgsBasicNumericFormat.

Definition at line 26 of file qgsscientificnumericformat.cpp.

◆ setNumberDecimalPlaces()

void QgsScientificNumericFormat::setNumberDecimalPlaces ( int  places)
overridevirtual

Sets the maximum number of decimal places to show.

The places argument must be at least 1.

See also
numberDecimalPlaces()
setShowTrailingZeros()

Reimplemented from QgsBasicNumericFormat.

Definition at line 65 of file qgsscientificnumericformat.cpp.

◆ sortKey()

int QgsScientificNumericFormat::sortKey ( )
overridevirtual

Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists.

Generally, subclasses should return QgsNumericFormat::sortKey() as their sorting key.

Reimplemented from QgsBasicNumericFormat.

Definition at line 36 of file qgsscientificnumericformat.cpp.

◆ visibleName()

QString QgsScientificNumericFormat::visibleName ( ) const
overridevirtual

Returns the translated, user-visible name for this format.

Reimplemented from QgsBasicNumericFormat.

Definition at line 31 of file qgsscientificnumericformat.cpp.


The documentation for this class was generated from the following files: