diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-29 09:18:59 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-29 09:23:14 +1000 |
commit | 98dd1781d9256f68025d2a2db408f4f5947f3214 (patch) | |
tree | dbe1424abd90014edb5546c920ca585ed62b46e3 /src/corelib/tools/qchar.h | |
parent | 6c1bdc1854a7700c2b3a345b95f6a2fdca84037d (diff) | |
parent | fa1b9070af66edb81b2a3735c1951f78b22bd666 (diff) |
Merge master -> api_changes
Includes fixes for tst_qfiledialog2, tst_qtextedit autotests on mac.
Change-Id: I49cac26894d31291a8339ccc1eb80b6a940f0827
Diffstat (limited to 'src/corelib/tools/qchar.h')
-rw-r--r-- | src/corelib/tools/qchar.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index df3d7eac33..3209ffb0f2 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -86,9 +86,8 @@ public: Q_DECL_CONSTEXPR QChar(QLatin1Char ch) : ucs(ch.unicode()) {} // implicit #ifndef QT_NO_CAST_FROM_ASCII - // these two constructors are NOT inline const_expr! - QT_ASCII_CAST_WARN_CONSTRUCTOR explicit QChar(char c); - QT_ASCII_CAST_WARN_CONSTRUCTOR explicit QChar(uchar c); + QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(char c) : ucs(uchar(c)) { } + QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(uchar c) : ucs(c) { } #endif // Unicode information @@ -222,13 +221,13 @@ public: UnicodeVersion unicodeVersion() const; - char toAscii() const; + inline char toAscii() const; inline char toLatin1() const; inline ushort unicode() const { return ucs; } inline ushort &unicode() { return ucs; } - static QChar fromAscii(char c); - static QChar fromLatin1(char c); + static inline QChar fromAscii(char c); + static inline QChar fromLatin1(char c); inline bool isNull() const { return ucs == 0; } bool isPrint() const; @@ -344,8 +343,10 @@ private: Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE); +inline char QChar::toAscii() const { return ucs > 0xff ? 0 : char(ucs); } inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); } inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); } +inline QChar QChar::fromAscii(char c) { return QChar(ushort(uchar(c))); } inline void QChar::setCell(uchar acell) { ucs = ushort((ucs & 0xff00) + acell); } |