#include <qdebugstream.h>
Public Member Functions | |
| QDebugStream (std::ostream &stream) | |
| ~QDebugStream () | |
Protected Member Functions | |
| virtual int_type | overflow (int_type v) |
| virtual std::streamsize | xsputn (const char *p, std::streamsize n) |
It is faster, of course, to write directly to qDebug, but if you have existing code that uses iostream and want a cheap way of redirecting, this is it.
Usage: QApplication app(argc, argv);
these redirect both cout/cerr QDebugStream qdsOut(std::cout); QDebugStream qdsErr(std::cerr);
now start using cout and cerr normally std::cerr << "Oops"; // this goes to your QDebug handler
Original idea came from here: http://www.qtforum.org/thread.php?threadid=678
Definition at line 32 of file qdebugstream.h.
1.5.1