From 75f5e2bef2ab942f89d5d025ecd45ee4d18e3d57 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 10 Mar 2017 15:27:40 +0100 Subject: Deprecate QString::null It's a Qt 3 compatibility vehicle, and as such inherits the now-alien property to distinguish empty and null strings. Particularly worrisome is the following asymmetry: QString("") == QString::null // false QString("") == QString(QString::null) // true Instead of fixing this behavior, recognize that people might use it as a weird way to call isNull(), albeit one that once was idiomatic, and simply deprecate everything that deals with QString::null. [ChangeLog][QtCore][QString] QString::null is now deprecated. When used to construct a QString, use QString() instead. When used to compare to a QString, replace with QString::isNull(). Change-Id: I9f7e84a92522c75666da15f49324c500ae93af42 Reviewed-by: Thiago Macieira Reviewed-by: Anton Kudryavtsev --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib/tools/qstring/tst_qstring.cpp') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 48e856f406..03436375dd 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -3818,7 +3818,7 @@ void tst_QString::startsWith() QVERIFY( !a.startsWith(QLatin1Char('x')) ); QVERIFY( !a.startsWith(QChar()) ); - a = QString::null; + a = QString(); QVERIFY( !a.startsWith("") ); QVERIFY( a.startsWith(QString::null) ); QVERIFY( !a.startsWith("ABC") ); @@ -3928,7 +3928,7 @@ void tst_QString::endsWith() QVERIFY( a.endsWith(QLatin1String(0)) ); QVERIFY( !a.endsWith(QLatin1String("ABC")) ); - a = QString::null; + a = QString(); QVERIFY( !a.endsWith("") ); QVERIFY( a.endsWith(QString::null) ); QVERIFY( !a.endsWith("ABC") ); -- cgit v1.2.3