QGIS API Documentation
3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
src
core
numericformats
qgspercentagenumericformat.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgspercentagenumericformat.h
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
#ifndef QGSPERCENTAGENUMERICFORMAT_H
16
#define QGSPERCENTAGENUMERICFORMAT_H
17
18
#include "qgis_core.h"
19
#include "
qgis_sip.h
"
20
#include "
qgsbasicnumericformat.h
"
21
28
class
CORE_EXPORT
QgsPercentageNumericFormat
:
public
QgsBasicNumericFormat
29
{
30
public
:
31
33
enum
InputValues
34
{
35
ValuesArePercentage
,
36
ValuesAreFractions
,
37
};
38
42
QgsPercentageNumericFormat
();
43
44
QString
id
()
const override
;
45
QString
visibleName
()
const override
;
46
int
sortKey
()
override
;
47
double
suggestSampleValue
()
const override
;
48
QString
formatDouble
(
double
value,
const
QgsNumericFormatContext
&context )
const override
;
49
QgsNumericFormat
*
clone
() const override
SIP_FACTORY
;
50
QgsNumericFormat
*create( const QVariantMap &configuration, const
QgsReadWriteContext
&context ) const override
SIP_FACTORY
;
51
QVariantMap configuration( const
QgsReadWriteContext
&context ) const override;
52
58
InputValues inputValues() const;
59
65
void
setInputValues( InputValues format );
66
67
private:
68
69
InputValues mInputValues = ValuesArePercentage;
70
71
};
72
73
#endif
// QGSPERCENTAGENUMERICFORMAT_H
QgsBasicNumericFormat
A numeric formatter which returns a simple text representation of a value.
Definition
qgsbasicnumericformat.h:32
QgsBasicNumericFormat::id
QString id() const override
Returns a unique id for this numeric format.
Definition
qgsbasicnumericformat.cpp:47
QgsBasicNumericFormat::visibleName
QString visibleName() const override
Returns the translated, user-visible name for this format.
Definition
qgsbasicnumericformat.cpp:52
QgsBasicNumericFormat::sortKey
int sortKey() override
Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists.
Definition
qgsbasicnumericformat.cpp:57
QgsBasicNumericFormat::clone
QgsNumericFormat * clone() const override
Clones the format, returning a new object.
Definition
qgsbasicnumericformat.cpp:141
QgsBasicNumericFormat::formatDouble
QString formatDouble(double value, const QgsNumericFormatContext &context) const override
Returns a formatted string representation of a numeric double value.
Definition
qgsbasicnumericformat.cpp:62
QgsNumericFormatContext
A context for numeric formats.
Definition
qgsnumericformat.h:36
QgsNumericFormat
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
Definition
qgsnumericformat.h:279
QgsNumericFormat::suggestSampleValue
virtual double suggestSampleValue() const
Returns a suggested sample value which nicely represents the current format configuration.
Definition
qgsnumericformat.cpp:64
QgsPercentageNumericFormat
A numeric formatter which returns a text representation of a percentage value.
Definition
qgspercentagenumericformat.h:29
QgsPercentageNumericFormat::InputValues
InputValues
Input value format, which specifies the format of the incoming values.
Definition
qgspercentagenumericformat.h:34
QgsPercentageNumericFormat::ValuesAreFractions
@ ValuesAreFractions
Incoming values are numeric fractions (e.g. 0.5 for 50%)
Definition
qgspercentagenumericformat.h:36
QgsPercentageNumericFormat::ValuesArePercentage
@ ValuesArePercentage
Incoming values are percentage values (e.g. 50 for 50%)
Definition
qgspercentagenumericformat.h:35
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition
qgsreadwritecontext.h:34
qgis_sip.h
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:76
qgsbasicnumericformat.h
Generated on Sat Dec 7 2024 03:46:51 for QGIS API Documentation by
1.9.8