KCoreAddons
kformat.h
Go to the documentation of this file.
188 FoldHours = 0x8, ///< Fold the hours into the minutes, e.g. 83:45 or 83m45s, overrides HideSeconds
189 AbbreviatedDuration = 0x10, ///< Use abbreviated units (e.g. 1 hr 23 min), as a middle ground between just unit initials (InitialDuration) and fully
202 LocaleDistanceUnits = 0x0, ///< Automatically select metric or imperial units based on the current locale
272 QString formatDuration(quint64 msecs, KFormat::DurationFormatOptions options = KFormat::DefaultDuration) const;
340 * * Monday, 7 September, 2021 at 7:00 PM : date formatted @p format + " at " + time formatted with @p format
342 * With @p format LongFormat, time format used is set to ShortFormat (to omit timezone and seconds).
409 QString formatValue(double value, const QString &unit, int precision = 1, KFormat::UnitPrefix prefix = KFormat::UnitPrefix::AutoAdjust) const;
417 * iec = format.formatValue(1024, QStringLiteral("B/s"), 1, KFormat::UnitPrefix::AutoAdjust, KFormat::IECBinaryDialect);
418 * jedec = format.formatValue(1024, QStringLiteral("B/s"), 1, KFormat::UnitPrefix::AutoAdjust, KFormat::JEDECBinaryDialect);
419 * metric = format.formatValue(1000, QStringLiteral("B/s"), 1, KFormat::UnitPrefix::AutoAdjust, KFormat::MetricBinaryDialect);
436 QString formatValue(double value, const QString &unit, int precision, KFormat::UnitPrefix prefix, KFormat::BinaryUnitDialect dialect) const;
451 [[nodiscard]] QString formatDistance(double distance, KFormat::DistanceFormatOptions = LocaleDistanceUnits) const;
KFormat provides support for formatting numbers and datetimes in formats that are not supported by QL...
Definition kformat.h:59
@ LocaleDistanceUnits
Automatically select metric or imperial units based on the current locale.
Definition kformat.h:202
@ MetricDistanceUnits
Force the use of metric unites regardless of the current locale.
Definition kformat.h:203
@ FoldHours
Fold the hours into the minutes, e.g. 83:45 or 83m45s, overrides HideSeconds.
Definition kformat.h:188
@ HideSeconds
Hide the seconds, e.g. 1:23 or 1h23m, overrides ShowMilliseconds.
Definition kformat.h:187
QFlags< DurationFormatOption > DurationFormatOptions
Stores a combination of DurationFormatOption values.
Definition kformat.h:195
@ AutoAdjust
Auto-choose a unit such that the result is in the range [0, 1000 or 1024)
Definition kformat.h:128
BinarySizeUnits
These binary units are used in KDE by the formatByteSize() function.
Definition kformat.h:84
@ DefaultBinaryUnits
Auto-choose a unit such that the result is in the range [0, 1000 or 1024)
Definition kformat.h:86
FormatType
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:55:52 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:55:52 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.