summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_text_qstring.cpp6
-rw-r--r--src/corelib/text/qstring.cpp23
2 files changed, 9 insertions, 20 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_text_qstring.cpp b/src/corelib/doc/snippets/code/src_corelib_text_qstring.cpp
index 4e79d1e27a..fade47cfc6 100644
--- a/src/corelib/doc/snippets/code/src_corelib_text_qstring.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_text_qstring.cpp
@@ -48,12 +48,6 @@
**
****************************************************************************/
-//! [0]
-DEFINES += QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_TO_ASCII
-//! [0]
-
-
//! [1]
QString url = QLatin1String("http://www.unicode.org/");
//! [1]
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index cc2c093cea..56ac657bff 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -1492,11 +1492,11 @@ inline char qToLower(char ch)
\macro QT_RESTRICTED_CAST_FROM_ASCII
\relates QString
- Defining this macro disables most automatic conversions from source
- literals and 8-bit data to unicode QStrings, but allows the use of
+ Disables most automatic conversions from source literals and 8-bit data
+ to unicode QStrings, but allows the use of
the \c{QChar(char)} and \c{QString(const char (&ch)[N]} constructors,
- and the \c{QString::operator=(const char (&ch)[N])} assignment operator
- giving most of the type-safety benefits of \c QT_NO_CAST_FROM_ASCII
+ and the \c{QString::operator=(const char (&ch)[N])} assignment operator.
+ This gives most of the type-safety benefits of \c QT_NO_CAST_FROM_ASCII
but does not require user code to wrap character and string literals
with QLatin1Char, QLatin1String or similar.
@@ -1521,7 +1521,7 @@ inline char qToLower(char ch)
\macro QT_NO_CAST_TO_ASCII
\relates QString
- disables automatic conversion from QString to 8-bit strings (char *)
+ Disables automatic conversion from QString to 8-bit strings (char *).
\sa QT_NO_CAST_FROM_ASCII, QT_RESTRICTED_CAST_FROM_ASCII, QT_NO_CAST_FROM_BYTEARRAY
*/
@@ -1756,23 +1756,18 @@ inline char qToLower(char ch)
Latin-1, but there is always the risk that an implicit conversion
from or to \c{const char *} is done using the wrong 8-bit
encoding. To minimize these risks, you can turn off these implicit
- conversions by defining the following two preprocessor symbols:
+ conversions by defining some of the following preprocessor symbols:
\list
- \li \c QT_NO_CAST_FROM_ASCII disables automatic conversions from
+ \li \l QT_NO_CAST_FROM_ASCII disables automatic conversions from
C string literals and pointers to Unicode.
- \li \c QT_RESTRICTED_CAST_FROM_ASCII allows automatic conversions
+ \li \l QT_RESTRICTED_CAST_FROM_ASCII allows automatic conversions
from C characters and character arrays, but disables automatic
conversions from character pointers to Unicode.
- \li \c QT_NO_CAST_TO_ASCII disables automatic conversion from QString
+ \li \l QT_NO_CAST_TO_ASCII disables automatic conversion from QString
to C strings.
\endlist
- One way to define these preprocessor symbols globally for your
- application is to add the following entry to your \l {Creating Project Files}{qmake project file}:
-
- \snippet code/src_corelib_text_qstring.cpp 0
-
You then need to explicitly call fromUtf8(), fromLatin1(),
or fromLocal8Bit() to construct a QString from an
8-bit string, or use the lightweight QLatin1String class, for