KSysGuard::Formatter
#include <Formatter.h>
Static Public Member Functions | |
| static QString | formatValue (const QVariant &value, Unit unit, MetricPrefix targetPrefix=MetricPrefixAutoAdjust, FormatOptions options=FormatOptionNone, int precision=-1) |
| static KLocalizedString | localizedString (const QVariant &value, Unit unit, MetricPrefix targetPrefix=MetricPrefixAutoAdjust) |
| static qreal | maximumLength (Unit unit, const QFont &font) |
| static qreal | scaleDownFactor (const QVariant &value, Unit unit, MetricPrefix targetPrefix=MetricPrefixAutoAdjust) |
| static QString | symbol (Unit unit) |
Detailed Description
A class for formatting sensor values.
- See also
- FormatterWrapper, for using it from Qml
Definition at line 35 of file Formatter.h.
Member Function Documentation
◆ formatValue()
|
static |
Converts value to the appropriate displayable string.
The returned string is localized.
- Parameters
-
value The value to be converted. unit The unit of the value. targetPrefix Preferred metric prefix. options precision The precision to use. If < 0, use a default value.
Definition at line 517 of file Formatter.cpp.
◆ localizedString()
|
static |
Returns localized string that is suitable for display.
- Parameters
-
value The maximum output value. unit The unit of the value. targetPrefix Preferred metric prefix.
Definition at line 511 of file Formatter.cpp.
◆ maximumLength()
|
static |
Return the maximum length of a formatted string for the specified unit and font.
- Parameters
-
unit The unit to use. font The font to use.
Definition at line 717 of file Formatter.cpp.
◆ scaleDownFactor()
|
static |
Returns the scale factor suitable for display.
- Parameters
-
value The maximum output value. unit The unit of the value. targetPrefix Preferred metric prefix.
Definition at line 501 of file Formatter.cpp.
◆ symbol()
|
static |
Returns a symbol that corresponds to the given unit.
The returned unit symbol is localized.
Definition at line 590 of file Formatter.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 12:05:59 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.