diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-10 10:11:10 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-10 10:11:11 +0200 |
commit | f035786021e9f7b1d9512b22774bc15553caaedb (patch) | |
tree | c46a29ed3657944d9f36d8643a99fad469235bc4 /src/corelib/global | |
parent | 72024fd50cdead8d890886dba32fd81ac54ff3ae (diff) | |
parent | 916c9d469bd0df227dc3be97fcca27e3cf58144f (diff) |
Merge remote-tracking branch 'origin/5.3' into dev
Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qflags.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index d7b673bc1f..097f2760b4 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -57,16 +57,22 @@ class QFlag { int i; public: -#if !defined(__LP64__) && !defined(Q_QDOC) + Q_DECL_CONSTEXPR inline QFlag(int ai) : i(ai) {} + Q_DECL_CONSTEXPR inline operator int() const { return i; } + +#if !defined(Q_CC_MSVC) + // Microsoft Visual Studio has buggy behavior when it comes to + // unsigned enums: even if the enum is unsigned, the enum tags are + // always signed +# if !defined(__LP64__) && !defined(Q_QDOC) Q_DECL_CONSTEXPR inline QFlag(long ai) : i(int(ai)) {} Q_DECL_CONSTEXPR inline QFlag(ulong ai) : i(int(long(ai))) {} -#endif - Q_DECL_CONSTEXPR inline QFlag(int ai) : i(ai) {} +# endif Q_DECL_CONSTEXPR inline QFlag(uint ai) : i(int(ai)) {} Q_DECL_CONSTEXPR inline QFlag(short ai) : i(int(ai)) {} Q_DECL_CONSTEXPR inline QFlag(ushort ai) : i(int(uint(ai))) {} - Q_DECL_CONSTEXPR inline operator int() const { return i; } Q_DECL_CONSTEXPR inline operator uint() const { return uint(i); } +#endif }; Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE); @@ -93,7 +99,11 @@ class QFlags struct Private; typedef int (Private::*Zero); public: -#ifndef Q_QDOC +#if defined(Q_CC_MSVC) || defined(Q_QDOC) + // see above for MSVC + // the definition below is too complex for qdoc + typedef int Int; +#else typedef typename QtPrivate::if_< QtPrivate::is_unsigned<Enum>::value, unsigned int, @@ -103,7 +113,6 @@ public: typedef Enum enum_type; // compiler-generated copy/move ctor/assignment operators are fine! #ifdef Q_QDOC - typedef int Int; // the real typedef above is too complex for qdoc inline QFlags(const QFlags &other); inline QFlags &operator=(const QFlags &other); #endif |