aboutsummaryrefslogtreecommitdiffstats
path: root/qtcreator.pri
diff options
context:
space:
mode:
authorhjk <hjk@theqtcompany.com>2016-03-17 13:52:43 +0100
committerhjk <hjk@theqtcompany.com>2016-03-17 16:01:33 +0000
commit82a523f6b199eaf8a3c7656c7102d93dddff06b9 (patch)
treec8373b8290a3b6fb635e0eb7c4d49a047eca89b8 /qtcreator.pri
parent05fbef78ad115d86caf39a632b2a9a1569a956a0 (diff)
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 <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'qtcreator.pri')
-rw-r--r--qtcreator.pri2
1 files changed, 1 insertions, 1 deletions
diff --git a/qtcreator.pri b/qtcreator.pri
index 3447d8ce71..073c048278 100644
--- a/qtcreator.pri
+++ b/qtcreator.pri
@@ -150,7 +150,7 @@ exists($$IDE_LIBRARY_PATH): LIBS *= -L$$IDE_LIBRARY_PATH # library path from ou
DEFINES += IDE_LIBRARY_BASENAME=\\\"$$IDE_LIBRARY_BASENAME\\\"
}
-DEFINES += QT_CREATOR QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+DEFINES += QT_CREATOR QT_NO_CAST_TO_ASCII QT_RESTRICTED_CAST_FROM_ASCII
!macx:DEFINES += QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
unix {