I'm using the the C++/Qt print function qDebug, but sometimes I would like to control how ", space and newline is appended and not use the default qDebug.
Let's take a simple example:
QString var1("some string");
int var2 = 1;
qDebug() << var1 << "=" << var2;
This will print
"some string" = 1
But Let's say that I don't like the appended " and space and would like the print to look like
some string=1
How to I then call qDebug?
Note: There is a function in qDebug called nospace, but it will remove the spaces. But the " is still there.
If I use this:
qDebug().nospace() << var1 << "=" << var2;
I get:
"some string"=1
But please note that I have still not found a way to get rid of the ending newline.
/Thanks
The file $(QTDIR)/src/corelib/io/qdebug.h contains almost all definitions for the debug output methods. One of them is:
inline QDebug &operator<<(const QString & t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); }
So there is no "official" way to suppress the quotes, but you can of course change qdebug.h or use your own copy or a modified and renamed copy of the QDebug class.