From 82a523f6b199eaf8a3c7656c7102d93dddff06b9 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 17 Mar 2016 13:52:43 +0100 Subject: Relax use of QT_NO_CAST_FROM_ASCII to QT_RESTRICTED_CAST_FROM_ASCII This is an opt-in trade-off between type safety and user code convenience. QT_NO_CAST_FROM_ASCII is highly beneficial to avoid unintended conversions from 8 bit data with potentially "unsuitable" encodings to QString. However, it has the undesirable side-effect to require user code to wrap character and string literals in QLatin1Char(...) and QLatin1String(...) or use similar construction, cluttering the code significantly. QT_RESTRICTED_CAST_FROM_ASCII macro works almost as QT_NO_CAST_FROM_ASCII, except that it enables the QChar(char) constructor and adds an additional QString(const char (&ch)[N]) constructor that matches C++ string literals, but no arbitrary character pointers. This avoids a significant share of the need to clutter the user code by only a slight relaxation of the type-safety. Change-Id: I64e0430bb1352edcedf7e19ee25c16408727084c Reviewed-by: Orgad Shaneh Reviewed-by: Eike Ziller --- qtcreator.qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qtcreator.qbs') diff --git a/qtcreator.qbs b/qtcreator.qbs index cafc911189..d1bb6d7759 100644 --- a/qtcreator.qbs +++ b/qtcreator.qbs @@ -56,7 +56,7 @@ Project { "QT_CREATOR", 'IDE_LIBRARY_BASENAME="' + libDirName + '"', "QT_NO_CAST_TO_ASCII", - "QT_NO_CAST_FROM_ASCII" + "QT_RESTRICTED_CAST_FROM_ASCII" ].concat(testsEnabled ? ["WITH_TESTS"] : []) qbsSearchPaths: "qbs" -- cgit v1.2.3