QLocale: add const version of formattedDataSize
QLocale::formattedDataSize() was not marked const when it was added although the function is const. Add a const overload and mark the non-const version as deprecated and remove it with Qt6 Fixes: QTBUG-71445 Change-Id: I56d051d9928b5e00cdaca7a874c543fed27a888d Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>bb10
parent
a5a1f338aa
commit
8b7a4b8dd8
|
|
@ -3881,6 +3881,19 @@ QString QLocale::toCurrencyString(double value, const QString &symbol, int preci
|
|||
\sa formattedDataSize()
|
||||
*/
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use the const version instead.
|
||||
*/
|
||||
QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats format)
|
||||
{
|
||||
const auto *that = this;
|
||||
return that->formattedDataSize(bytes, precision, format);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 5.10
|
||||
|
||||
|
|
@ -3897,7 +3910,7 @@ QString QLocale::toCurrencyString(double value, const QString &symbol, int preci
|
|||
whereas \c DataSizeSIFormat uses the older SI quantifiers k, M, etc., and
|
||||
\c DataSizeTraditionalFormat abuses them.
|
||||
*/
|
||||
QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats format)
|
||||
QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats format) const
|
||||
{
|
||||
int power, base = 1000;
|
||||
if (!bytes) {
|
||||
|
|
|
|||
|
|
@ -1066,7 +1066,10 @@ public:
|
|||
{ return toCurrencyString(double(i), symbol, precision); }
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QString formattedDataSize(qint64 bytes, int precision = 2, DataSizeFormats format = DataSizeIecFormat);
|
||||
#endif
|
||||
QString formattedDataSize(qint64 bytes, int precision = 2, DataSizeFormats format = DataSizeIecFormat) const;
|
||||
|
||||
QStringList uiLanguages() const;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue