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

Extend QML String object with one-pass equivalent of QString::arg()

    XMLWordPrintable

Details

    Description

      The overload of QString::arg() in C++ that gives possibility to substitute arguments in one pass is very useful.
      See https://doc.qt.io/qt-5/qstring.html#arg-14 for motivation.

      Unfortunately this isn't supported in QML.

      Simple,

      readonly property string text: '%1, %2'.arg('Hello', 'world!')
      

      in Qt 6.3.0 generates error

      Error: String.arg(): Invalid arguments 
      

      So the suggestion is to make it available in QML as well.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              studiosus Vladimir Belyavsky
              Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes