Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-71445

QLocale::formattedDataSize should be const

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.13.0 Alpha 1
    • 5.11.1
    • Core: Locales (i18n)
    • None
    • Linux 4.18.0-amd64, Debian testing
    • All
    • 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]
      }

       

      Attachments

        For Gerrit Dashboard: QTBUG-71445
        # Subject Branch Project Status CR V

        Activity

          People

            chehrlic Christian Ehrlicher
            kshegunov Konstantin Shegunov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes