Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Wiki Discussion
  4. QString::arg Documentation Confusion
Forum Updated to NodeBB v4.3 + New Features

QString::arg Documentation Confusion

Scheduled Pinned Locked Moved Solved Wiki Discussion
8 Posts 4 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ResistorInTheDark
    wrote on 4 Sept 2018, 14:26 last edited by ResistorInTheDark 9 Apr 2018, 14:30
    #1

    This post has to do with my confusion (and potentially the confusion of others) over a particular QString::arg documentation.

    I'm not sure where to put this post so I decided to throw it in wiki discussion.

    The last example of the section states

    QString str;
    str = "%1%2%3";
    str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020"
    

    I'm rather confused. Shouldn't it either be
    str = "%1%3%2"; (line 2)
    or
    // returns "Hello2050" (line 3)?

    I'm sort of inferring that it's supposed to be str = "%1%3%2"; from the point its trying to make. I'm hoping that someone can clarify this for me and perhaps fix it.

    Thanks for any clarifications.

    G A 2 Replies Last reply 4 Sept 2018, 14:43
    0
    • R ResistorInTheDark
      4 Sept 2018, 14:26

      This post has to do with my confusion (and potentially the confusion of others) over a particular QString::arg documentation.

      I'm not sure where to put this post so I decided to throw it in wiki discussion.

      The last example of the section states

      QString str;
      str = "%1%2%3";
      str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020"
      

      I'm rather confused. Shouldn't it either be
      str = "%1%3%2"; (line 2)
      or
      // returns "Hello2050" (line 3)?

      I'm sort of inferring that it's supposed to be str = "%1%3%2"; from the point its trying to make. I'm hoping that someone can clarify this for me and perhaps fix it.

      Thanks for any clarifications.

      G Offline
      G Offline
      Gojir4
      wrote on 4 Sept 2018, 14:43 last edited by
      #2

      @ResistorInTheDark Hi,

      It looks like a mistake in the documentation. From the context, we can guess that it should be:

      String str;
      str = "%1%3%2";
      str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020"
      
      J 1 Reply Last reply 4 Sept 2018, 17:29
      4
      • R Offline
        R Offline
        ResistorInTheDark
        wrote on 4 Sept 2018, 15:37 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • G Gojir4
          4 Sept 2018, 14:43

          @ResistorInTheDark Hi,

          It looks like a mistake in the documentation. From the context, we can guess that it should be:

          String str;
          str = "%1%3%2";
          str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020"
          
          J Offline
          J Offline
          JonB
          wrote on 4 Sept 2018, 17:29 last edited by
          #4

          @Gojir4
          I believe the format string was correct/intended, and the comment for the output is what was incorrect.... :)

          G 1 Reply Last reply 4 Sept 2018, 20:54
          0
          • J JonB
            4 Sept 2018, 17:29

            @Gojir4
            I believe the format string was correct/intended, and the comment for the output is what was incorrect.... :)

            G Offline
            G Offline
            Gojir4
            wrote on 4 Sept 2018, 20:54 last edited by
            #5

            @JonB I don't think so. They are demonstrating why you need to be careful when using disordered arguments. See the full chapter. So I stay on my position.

            1 Reply Last reply
            3
            • R ResistorInTheDark
              4 Sept 2018, 14:26

              This post has to do with my confusion (and potentially the confusion of others) over a particular QString::arg documentation.

              I'm not sure where to put this post so I decided to throw it in wiki discussion.

              The last example of the section states

              QString str;
              str = "%1%2%3";
              str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020"
              

              I'm rather confused. Shouldn't it either be
              str = "%1%3%2"; (line 2)
              or
              // returns "Hello2050" (line 3)?

              I'm sort of inferring that it's supposed to be str = "%1%3%2"; from the point its trying to make. I'm hoping that someone can clarify this for me and perhaps fix it.

              Thanks for any clarifications.

              A Offline
              A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on 5 Sept 2018, 18:57 last edited by
              #6

              Hi @ResistorInTheDark and @Gojir4

              thanks for your findings and conclusions. I've prepared a patch to fix the documentation: https://codereview.qt-project.org/238951

              Please note that in future you can do discussions about (assumed) bugs here, but the final report should be at bugreports.qt.io, so they are not lost.

              Thanks and regards.

              Qt has to stay free or it will die.

              A 1 Reply Last reply 6 Sept 2018, 19:47
              3
              • A aha_1980
                5 Sept 2018, 18:57

                Hi @ResistorInTheDark and @Gojir4

                thanks for your findings and conclusions. I've prepared a patch to fix the documentation: https://codereview.qt-project.org/238951

                Please note that in future you can do discussions about (assumed) bugs here, but the final report should be at bugreports.qt.io, so they are not lost.

                Thanks and regards.

                A Offline
                A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on 6 Sept 2018, 19:47 last edited by
                #7

                so, the patch got merged and will be in 5.11.2 or 5.12.

                So we can close this topic.

                Qt has to stay free or it will die.

                G 1 Reply Last reply 7 Sept 2018, 05:36
                1
                • A aha_1980
                  6 Sept 2018, 19:47

                  so, the patch got merged and will be in 5.11.2 or 5.12.

                  So we can close this topic.

                  G Offline
                  G Offline
                  Gojir4
                  wrote on 7 Sept 2018, 05:36 last edited by
                  #8

                  @aha_1980 Thanks for haviing handling this. Good job

                  1 Reply Last reply
                  2

                  8/8

                  7 Sept 2018, 05:36

                  • Login

                  • Login or register to search.
                  8 out of 8
                  • First post
                    8/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved