kDebug formatting

Thiago Macieira thiago at kde.org
Sun Aug 5 23:24:51 BST 2007

David Jarvie wrote:
>Is there an easy way to omit spaces between parameters as output by
> kDebug?


> There are a number of kDebug and kWarning statements where I 
> quote things like file names, and the quotes really shouldn't include
> extra spaces inside them. Another case where spaces are not wanted is
> when outputting a string between delimiters. Especially if the string
> already starts or ends with spaces, having kDebug add its own
> inter-parameter spaces is confusing. A simple example is:
>kWarning() << "Error reading file '" << fileName << "'" << endl;
>Generally, the I like the new kDebug, since spaces will typically be
> wanted between parameters. But there are cases where this is not
> wanted. qDebug has an option to suppress spaces between parameters - is
> there an equivalent for kDebug? If not, I think there should be.

kDebug and qDebug are now the same. What is valid for one is valid for the 
other and vice-versa.

Anyways, the line above should now be:
	kWarning() << "Error reading file" << fileName;
since fileName is a QString, QDebug will automatically add the quotes.

  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070805/840d5eed/attachment.sig>

More information about the kde-core-devel mailing list