Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. displaying QString variable in Application Output
Forum Updated to NodeBB v4.3 + New Features

displaying QString variable in Application Output

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 549 Views
  • 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.
  • S Offline
    S Offline
    Swati777999
    wrote on 29 Oct 2021, 02:33 last edited by
    #1

    Hi All,

    I just want to know how to get rid of the double quotation mark in the output , if I want to display a QString variable as follows;
    QString myWord = " show this" ;
    qDebug() <<myWord;

    This gives me output as "show this" when I am interested to get the output as show this.
    Can someone help me with this?

    “ In order to be irreplaceable, one must always be different” – Coco Chanel

    J J 2 Replies Last reply 29 Oct 2021, 04:15
    0
    • S Swati777999
      29 Oct 2021, 02:33

      Hi All,

      I just want to know how to get rid of the double quotation mark in the output , if I want to display a QString variable as follows;
      QString myWord = " show this" ;
      qDebug() <<myWord;

      This gives me output as "show this" when I am interested to get the output as show this.
      Can someone help me with this?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 29 Oct 2021, 04:15 last edited by
      #2

      @Swati777999 said in displaying QString variable in Application Output:

      I just want to know how to get rid of the double quotation mark in the output

      Don't use qDebug() then.
      qDebug is for debug output.
      Either use std::cout or

      QString x{"Some string"};
      QTextStream out(stdout);
      out << x << endl;
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 15 Nov 2021, 08:30
      2
      • S Swati777999
        29 Oct 2021, 02:33

        Hi All,

        I just want to know how to get rid of the double quotation mark in the output , if I want to display a QString variable as follows;
        QString myWord = " show this" ;
        qDebug() <<myWord;

        This gives me output as "show this" when I am interested to get the output as show this.
        Can someone help me with this?

        J Offline
        J Offline
        JonB
        wrote on 29 Oct 2021, 05:53 last edited by JonB
        #3

        @Swati777999
        For qDebug() you can achieve this via

        qDebug().noquote() << myWord;
        
        S 1 Reply Last reply 17 Nov 2021, 02:06
        1
        • J jsulm
          29 Oct 2021, 04:15

          @Swati777999 said in displaying QString variable in Application Output:

          I just want to know how to get rid of the double quotation mark in the output

          Don't use qDebug() then.
          qDebug is for debug output.
          Either use std::cout or

          QString x{"Some string"};
          QTextStream out(stdout);
          out << x << endl;
          
          S Offline
          S Offline
          Swati777999
          wrote on 15 Nov 2021, 08:30 last edited by
          #4

          @jsulm Thanks. :)

          “ In order to be irreplaceable, one must always be different” – Coco Chanel

          1 Reply Last reply
          0
          • J JonB
            29 Oct 2021, 05:53

            @Swati777999
            For qDebug() you can achieve this via

            qDebug().noquote() << myWord;
            
            S Offline
            S Offline
            Swati777999
            wrote on 17 Nov 2021, 02:06 last edited by
            #5

            @JonB It worked for me too. Thanks.

            “ In order to be irreplaceable, one must always be different” – Coco Chanel

            1 Reply Last reply
            0

            • Login

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