Results 1 to 14 of 14

Thread: Some questions about qdebug, a custom debug and const approach

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Some questions about qdebug, a custom debug and const approach

    frankly, I have no idea what you are after, and why you make it so complicated.
    So far I have seen nothing in what you have posted, that qDebug() does not give you since you only output strings.
    Its your job to convert what ever other types to strings, and then you can just feed the strings to qDebug().
    You are over complicating a non existing problem (in my view).
    gives me :
    123456
    and I'd want
    123
    456
    Well, then put a line break where you need it!
    qDebug() will output any string you give it, so just create the string you want the way you want it.
    Perhaps this can hellp :
    Cout needs to receive and endl because if not there is no line feed.
    cout<<"hello"<<"how are you"<<endl;
    But qDebug NOT :
    qDebug()<<"hello"<<"how are you";
    SO ..... what kind of magic is there in qDebug ?
    Thats is true, qDebug() adds a line break after every srting, it not magic, just the way it was conceived.
    As the qDebug() docs states:
    With this syntax, the function returns a QDebug object that is configured to use the QtDebugMsg message type. It automatically puts a single space between each item, and outputs a newline at the end. It supports many C++ and Qt types.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  2. #2
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Some questions about qdebug, a custom debug and const approach

    My job is not to convert all to strings ....

    As you has written :
    .... and outputs a newline at the end.
    This is the main question, How qDebug do it ? How it knows that there is an end ?
    Thanks

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Some questions about qdebug, a custom debug and const approach

    My job is not to convert all to strings
    Ok, if you say so.

    How qDebug do it ?
    It just appends an '\n' to any string it gets as input.

    You can look in the qDebug() code to see exactly how.

    You might want to read the QDebug docs.
    Last edited by high_flyer; 6th May 2011 at 10:00.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Some questions about qdebug, a custom debug and const approach

    Solved.
    The way is to do it at destructor.....

Similar Threads

  1. Questions on using custom widgets in a QTableView
    By d_stranz in forum Qt Programming
    Replies: 0
    Last Post: 25th October 2010, 22:23
  2. custom QColumnView, some questions
    By Mystical Groovy in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2009, 14:03
  3. Replies: 0
    Last Post: 9th September 2009, 02:35
  4. questions re: inline implementation, const
    By Urthas in forum Newbie
    Replies: 1
    Last Post: 2nd May 2009, 22:41
  5. Some questions about custom style
    By charlse in forum Qt Programming
    Replies: 0
    Last Post: 2nd April 2009, 09:54

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.