KDeclarative

formats.h
1 /*
2  SPDX-FileCopyrightText: 2014 Bhushan Shah <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5 */
6 
7 #ifndef FORMATS_H
8 #define FORMATS_H
9 
10 #include <KFormat>
11 
12 class Formats : public QObject
13 {
14  Q_OBJECT
15 
16  public:
17 
18  explicit Formats (QObject* parent = nullptr);
19 
23  Q_INVOKABLE QString formatByteSize(double size, int precision = 1) const;
24 
29  Q_INVOKABLE QString formatDuration(quint64 msecs, KFormat::DurationFormatOptions options = KFormat::DefaultDuration) const;
30 
31  Q_DECLARE_FLAGS(DurationFormatOptions, KFormat::DurationFormatOption)
32 
33 
40  Q_INVOKABLE QString formatDuration(quint64 msecs, int options) const;
41 
48  Q_INVOKABLE QString formatDecimalDuration(quint64 msecs, int decimalPlaces = 2) const;
49 
63  Q_INVOKABLE QString formatSpelloutDuration(quint64 msecs) const;
64 
78  Q_INVOKABLE QString formatRelativeDate(const QDate &date, QLocale::FormatType format) const;
79 
93  Q_INVOKABLE QString formatRelativeDateTime(const QDateTime &dateTime, QLocale::FormatType format) const;
94 
95  private:
96 
97  KFormat m_format;
98 };
99 
100 Q_DECLARE_METATYPE(QLocale::FormatType)
101 
102 #endif
DurationFormatOption
Q_OBJECTQ_OBJECT
Q_INVOKABLEQ_INVOKABLE
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:44:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.