[Development] QString behavior change

Olivier Goffart olivier at woboq.com
Thu Jul 30 11:47:16 CEST 2015


On Thursday 30. July 2015 09:38:12 Gerhard Scheikl wrote:
> Hi
> 
> The behavior of QString::trimmed has changed from 5.3.2 to 5.5.
> .trimmed() on an empty string (" ") makes it null
> .trimmed() on an empty string ("") doesn't make it null
> 
> Is this intended or a bug?

This is caused by 54da2b2911ace652dbd2c8ea852c5b8c47ab09c8 in qtbase.

I don't think it was intended.

> By the way: the output of qDebug is not as expected:
> there are additional whitespaces before true/false and there is even
> another one before null at the first "Before trim" output.

That is expected. qDebug automatically add spaces. 
It always did that and it is very convinient in must cases.

Use qDebug().nospace() << "foo:" << foo;  if you really don't want the spaces.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org



More information about the Development mailing list