QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
numericformats
qgsexpressionbasednumericformat.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsexpressionbasednumericformat.h
3
--------------------------
4
begin : August 2024
5
copyright : (C) 2024 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 QGSEXPRESSIONBASEDNUMERICFORMAT_H
16
#define QGSEXPRESSIONBASEDNUMERICFORMAT_H
17
18
#include "qgis_core.h"
19
#include "
qgis_sip.h
"
20
#include "
qgsexpression.h
"
21
#include "
qgsnumericformat.h
"
22
29
class
CORE_EXPORT
QgsExpressionBasedNumericFormat
:
public
QgsNumericFormat
30
{
31
public
:
32
QgsExpressionBasedNumericFormat
();
33
34
QString
id
()
const override
;
35
QString
visibleName
()
const override
;
36
int
sortKey
()
override
;
37
QString
formatDouble
(
double
value,
const
QgsNumericFormatContext
&context )
const override
;
38
QgsNumericFormat
*
clone
()
const
override
SIP_FACTORY
;
39
QgsNumericFormat
*
create
(
const
QVariantMap &
configuration
,
const
QgsReadWriteContext
&context )
const
override
SIP_FACTORY
;
40
QVariantMap
configuration
(
const
QgsReadWriteContext
&context )
const override
;
41
49
void
setExpression
(
const
QString &
expression
);
// cppcheck-suppress functionConst
50
56
QString
expression
()
const
{
return
mExpression.expression(); }
57
58
private
:
59
mutable
QgsExpression
mExpression;
60
};
61
62
#endif
// QGSEXPRESSIONBASEDNUMERICFORMAT_H
QgsExpressionBasedNumericFormat::expression
QString expression() const
Returns the expression used to calculate the text representation of a value.
Definition
qgsexpressionbasednumericformat.h:56
QgsExpressionBasedNumericFormat::configuration
QVariantMap configuration(const QgsReadWriteContext &context) const override
Returns the current configuration of the formatter.
Definition
qgsexpressionbasednumericformat.cpp:64
QgsExpressionBasedNumericFormat::QgsExpressionBasedNumericFormat
QgsExpressionBasedNumericFormat()
Definition
qgsexpressionbasednumericformat.cpp:24
QgsExpressionBasedNumericFormat::setExpression
void setExpression(const QString &expression)
Sets the expression used to calculate the text representation of a value.
Definition
qgsexpressionbasednumericformat.cpp:71
QgsExpression
Handles parsing and evaluation of expressions (formerly called "search strings").
Definition
qgsexpression.h:197
QgsNumericFormatContext
A context for numeric formats.
Definition
qgsnumericformat.h:35
QgsNumericFormat::create
virtual QgsNumericFormat * create(const QVariantMap &configuration, const QgsReadWriteContext &context) const =0
Creates a new copy of the format, using the supplied configuration.
QgsNumericFormat::formatDouble
virtual QString formatDouble(double value, const QgsNumericFormatContext &context) const =0
Returns a formatted string representation of a numeric double value.
QgsNumericFormat::clone
virtual QgsNumericFormat * clone() const =0
Clones the format, returning a new object.
QgsNumericFormat::sortKey
virtual int sortKey()
Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists.
Definition
qgsnumericformat.cpp:54
QgsNumericFormat::QgsNumericFormat
QgsNumericFormat()=default
QgsNumericFormat::visibleName
virtual QString visibleName() const =0
Returns the translated, user-visible name for this format.
QgsNumericFormat::id
virtual QString id() const =0
Returns a unique id for this numeric format.
QgsNumericFormat::configuration
virtual QVariantMap configuration(const QgsReadWriteContext &context) const =0
Returns the current configuration of the formatter.
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
qgis_sip.h
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
qgsexpression.h
qgsnumericformat.h
Generated on
for QGIS API Documentation by
1.17.0