[Qt-interest] QString doesn't print anything with qDebug

Samuel Gaist samuel.gaist at edeltech.ch
Thu Dec 2 12:38:30 CET 2010


On 2 déc. 2010, at 12:12, Anisha Kaul wrote:

>> Well, I think you're just making it too complicated for yourself. Why
>> not a simple: qDebug() << "---" << s << "---";
>> No need for a .toAscii().data() at all.
>> André
> 
> André,
> 
> Thanks for that simple example (*It finally solved the issue*), I added
> that in my code, and it resulted in a declaration error, so I looked up
> QDebug documentation only to find out that I had not mentioned "#include
> <QDebug>" in my code! :doh:
> 
> But I am surprised that no errors or warnings were shown when I used
> QDebug like this: "qDebug("--- %s ---",s2.toAscii().data());"
> 
Hi,
IIRC the doc says qDebug("Something") doesn't print anything when QT_NO_DEBUG_OUTPUT is defined.

Is it possible that you have this defined somewhere ?

Hope this helps
Samuel
>> Use QXmlStreamReader::name() to get the name of the 
>> tag when you encounter a start element.
>> Sean
> 
> Thanks for the reminder, Sean.
> 
>> My guess is it's printing the whitespace characters inside each element,
>> before the next element start tag is encountered. If you did more
>> readNext() calls, you'd probably eventually see some non-whitespace,
>> non-text elements.
> 
>> Elliot
> 
> Thanks to you too :) ".data()" shows only one character, not the whole string,
> I think you were right, it was showing up the white spaces. and thanks for that 
> small code :)
> 
> and both the following statements result in the same output.
> "qDebug() << objQXmlReader.name().toString();"
> "qDebug() << objQXmlReader.name();"
> 
> Thanks again to all of you for taking interest in my problem.
> -Anisha
> 
> 
> -------------------------------------
> Hi-Tech Gears Limited, Gurgaon, India
> 
> 
> 
> 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest





More information about the Qt-interest-old mailing list