Results 1 to 4 of 4

Thread: How does qDebug() print a line break?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,349
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: How does qDebug() print a line break?

    This sounds like a "How long is a piece of string?" question

    qDebug() returns an instance of the QDebug class. Each of the operator<< calls return a reference to the QDebug instance, which allows you to chain together << calls. When the code reaches the end of the statement (";"), the QDebug instance goes out of scope. The destructor is called, it pushes the CRLF onto the stream, flushes the stream, and closes it. That's how it "knows".
    Last edited by d_stranz; 9th August 2021 at 23:08.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. The following user says thank you to d_stranz for this useful post:

    Cruz (11th August 2021)

Similar Threads

  1. QXmlQuery::evaluateTo(QString) adds a line break
    By mentalmushroom in forum Qt Programming
    Replies: 3
    Last Post: 5th June 2018, 23:45
  2. QPrinter print QWebView content without any any page break.
    By Cupidvogel in forum Qt Programming
    Replies: 6
    Last Post: 21st May 2018, 00:51
  3. Replies: 1
    Last Post: 24th November 2017, 18:36
  4. how to print filename and linenumber using qDebug
    By dpatel in forum Qt Programming
    Replies: 3
    Last Post: 24th May 2010, 12:36
  5. How to print variables with qDebug?
    By ricardo in forum Qt Programming
    Replies: 7
    Last Post: 12th July 2009, 23:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.