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 562 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.
  • Swati777999S Offline
    Swati777999S Offline
    Swati777999
    wrote on 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

    jsulmJ JonBJ 2 Replies Last reply
    0
    • Swati777999S Swati777999

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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

      Swati777999S 1 Reply Last reply
      2
      • Swati777999S Swati777999

        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?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @Swati777999
        For qDebug() you can achieve this via

        qDebug().noquote() << myWord;
        
        Swati777999S 1 Reply Last reply
        1
        • jsulmJ jsulm

          @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;
          
          Swati777999S Offline
          Swati777999S Offline
          Swati777999
          wrote on last edited by
          #4

          @jsulm Thanks. :)

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

          1 Reply Last reply
          0
          • JonBJ JonB

            @Swati777999
            For qDebug() you can achieve this via

            qDebug().noquote() << myWord;
            
            Swati777999S Offline
            Swati777999S Offline
            Swati777999
            wrote on 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