Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.1
-
None
-
Linux 4.18.0-amd64, Debian testing
-
-
8b7a4b8dd8ffd4c55fd013179242ecd42441d6a9 (qt/qtbase/dev)
Description
QLocale::formattedDataSize is marked as mutable, meaning in places like item delegates where it may be useful one needs to make a const_cast to strip the qualifier. Example follows:
class MyDelegate : public QStyledItemDelegate { public: QString displayText(const QVariant &, const QLocale &) const override; };
QString MyDelegate::displayText(const QVariant & value, const QLocale & locale) const { return locale.formattedDataSize(value.toDouble()); // error: passing 'const QLocale' as 'this' argument discards qualifiers [-fpermissive] }