[Development] RFC: [Logging] Add quote(), noquote() stream modifiers to QDebug

Koehne Kai Kai.Koehne at digia.com
Tue Mar 4 12:33:37 CET 2014


> From: development-bounces+kai.koehne=digia.com at qt-project.org [development-bounces+kai.koehne=digia.com at qt-
> 
> Hi,
>
> how about omitting quotes automatically for anything else but Q[C]Debug?

I've some sympathy for this, since the quoting is more often than not unwanted, IMO. But anyhow, I'd stay away from changing the semantics here, at least for QString. It's just breaking the formatting of too much code out there, for little gain.

> The common problem seems to me that warning messages automatically get
> quotes which looks semi-professional:
>
> qWarning() << "Cannot open:" << file.name() << ": " << file.errorString();
>
> typically results in:
>
>Cannot open: "foo.txt" : "No such file"

Actually it results in two spaces 
>
> It is also conceivable to use quotes only for empty strings in
>qWarning/qCritical/qFatal.

Different behavior for qDebug vs the rest? That does sound hacky too ...

Regards

Kai


More information about the Development mailing list