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

Add a way to automatically use QStringLiteral for every "xxx" style string.

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.0.0 Beta 2
    • None

    Description

      I was trying out Qt5 beta2 these days. One thing troubles me a lot. When I use QJsonObject. I wrote the following:

      jsonObject["a"] = "b";

      surely it won't work, since QJsonValue requires "b" not to be confused with bool. One way to solve this is:

      jsonObject["a"] = QString("b");

      And another, which is more recommended (I suppose):

      jsonObject["a"] = QStringLiteral("b");

      Both of them work well, but require some coding.

      While some people may be against using QStringLiteral for every char * style string, I personally want to add QStringLiteral to every one of them after reading the blog related to QStringLiteral.

      So what I suggest is maybe adding a switch for compiling or a parameter in .pro file which will generate QStringLiteral for every char * style strings. This can largely simpify my code and do a lot of performance boost.

      Thank you for reading...

      Attachments

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

        Activity

          People

            biochimia João Abecasis
            kimi arthur Kimi Arthur
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes