[Development] Undeprecating QString::null

Olivier Goffart olivier at woboq.com
Tue Jan 16 16:47:57 CET 2018

Am Dienstag, 16. Januar 2018, 16:20:54 CET schrieb Uwe Rathmann:
> Hi all,
> I received a bug report concerning a header of the Qwt library ( http://
> qwt.sf.net ), that is using the deprecated QString::null.
> Sure this is only a warning, but it is obviously something where Qwt
> users get irritated as they can't fix code of a 3rd party header.
> The offending line looks like this:
>     QwtText( const QString & = QString::null, ... );
> So my first question would be, what is wrong about using QString:null and
> why using QString() is better. My second question then would be if this
> is also for Qt4 ( Qwt 6.1.2 supports all versions >= Qt 4.4 ) and older
> versions of C++ and compilers.
> To be honest I don't want to create a new ( + binary incompatible )
> version of Qwt and/or add even more version depending #ifdefs, as long as
> there is no good reason.

QString::null is a leftover of Qt3 and was already deprecated in Qt 4.0
There was just some forgotten remaining compatibility code that was only 
recently marked as QT_DEPRECATED. 
Just change your code to use "= QString()", no #ifdef necessary.


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

More information about the Development mailing list