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

[REG: 5.2->5.14] Locale used by QString::localeAwareCompare() no longer changeable

    XMLWordPrintable

Details

    • 94de5f9b25e1816039885c765e2a5b312f7daa7e (qt/qtbase/dev) a1e694b641aeeb8731f50f22e9223ea57c827c7a (qt/qtbase/6.2)

    Description

      Due to this change, it is no longer possible to change collation locale used by QString::localeAwareCompare():
      https://codereview.qt-project.org/c/qt/qtbase/+/241737

      Before it was possible to use QLocale::setDefault(..) to do so. Unfortunately in addition to that, QTBUG-36149 made QString cache the used QCollator, which means it is no longer possible to dynamically change it after the first use and also that introduced a bug where different threads could have different behaviors if it was changed at runtime, but that is now masked off by this more recent change.

      I am guessing the right way would probably be to use QCollator directly instead of localeAwareCompare() when a specific collation is required, but it would be great if it was possible to change it.

      localeAwareCompare() is also used by QSortFilterProxyModel which would really be nice if it the change was possible without having to subclass it. Also item view widgets use localeAwareCompare by default and there is no way for user to change that.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thiago Thiago Macieira
              poikelin Joni Poikelin
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: