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. How to use __LINE__ macro as QString parameter ?
Forum Updated to NodeBB v4.3 + New Features

How to use __LINE__ macro as QString parameter ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 541 Views 2 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    This is driving me nuts - how use LINE macro (int) as QString parameter ?
    The compiler likes it but the result is wrong.

    
        QString label = QString(__LINE__ );   //current code line 
        ui->chat_2->append(label);  //  no good 
    
    JKSHJ 1 Reply Last reply
    0
    • nageshN Offline
      nageshN Offline
      nagesh
      wrote on last edited by nagesh
      #4

      @AnneRanch said in How to use __LINE__ macro as QString parameter ?:

      QString label = QString(LINE ); //current code line

      use QString::number
      QString label = QString::number(__LINE__ );

      1 Reply Last reply
      0
      • A Anonymous_Banned275

        This is driving me nuts - how use LINE macro (int) as QString parameter ?
        The compiler likes it but the result is wrong.

        
            QString label = QString(__LINE__ );   //current code line 
            ui->chat_2->append(label);  //  no good 
        
        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #2

        @AnneRanch said in How to use __LINE__ macro as QString parameter ?:

        how use... (int) as QString parameter ?

        https://doc.qt.io/qt-5/qstring.html#number

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        4
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by JKSH
          #3

          P.S. This thread is about how to use a Qt-specific class (QString), so it does not belong in the "C++ Gurus" subforum (which is for questions about C++ concepts and techniques).

          Moved to the "General and Desktop" subforum.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • nageshN Offline
            nageshN Offline
            nagesh
            wrote on last edited by nagesh
            #4

            @AnneRanch said in How to use __LINE__ macro as QString parameter ?:

            QString label = QString(LINE ); //current code line

            use QString::number
            QString label = QString::number(__LINE__ );

            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