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

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

XMLWordPrintable

      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.

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

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

              Created:
              Updated:

                There are no open Gerrit changes