Results 1 to 4 of 4

Thread: Get the qDebug() output to QString

  1. #1
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Get the qDebug() output to QString

    Hai

    I want get the screen output of qDebug() or printf or fprintf to a QString Variable

    how to do this?

    Qt Code:
    1. int a=0x3F4ccccd;
    2. QString hexA;
    3. qDebug("%x",a); // i want this output in a QString hexA Variable.
    To copy to clipboard, switch view to plain text mode 

    help please

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get the qDebug() output to QString

    Please avoid starting new threads for similar problems.

  3. #3
    Join Date
    Mar 2010
    Location
    Volcano, Big Island, Hawaii
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Get the qDebug() output to QString

    Why not start out with it in a QString, and then print it to screen:

    Qt Code:
    1. int a = 0x3F4ccccd;
    2. QString hexA = QString::number(a, 16);
    3. qDebug(hexA.toStdString().c_str());
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Get the qDebug() output to QString

    You might also be interested in:

    QtGlobal, particularly qInstallMsgHandler() if you want to globally redirect qDebug() and friends.

Similar Threads

  1. Problem with QT 4.6 qDebug and QString.
    By weaver4 in forum Newbie
    Replies: 7
    Last Post: 18th March 2013, 12:15
  2. Why am I not seeing qDebug() output?
    By Cruz in forum Newbie
    Replies: 3
    Last Post: 24th January 2009, 11:54
  3. qDebug() output from Kopete
    By Morea in forum KDE Forum
    Replies: 8
    Last Post: 5th January 2008, 22:30
  4. Disable qDebug output
    By the_bis in forum Qt Programming
    Replies: 7
    Last Post: 30th November 2006, 20:14
  5. qDebug() output
    By Doug Broadwell in forum Newbie
    Replies: 1
    Last Post: 1st November 2006, 21: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.