summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qflags.h12
-rw-r--r--src/corelib/global/qglobal.cpp28
2 files changed, 37 insertions, 3 deletions
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index dd4222b89f..9e97724fec 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -53,13 +53,19 @@ class QFlag
{
int i;
public:
- Q_DECL_CONSTEXPR inline QFlag(int i);
+#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) {}
+ 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); }
};
Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QFlag::QFlag(int ai) : i(ai) {}
-
class QIncompatibleFlag
{
int i;
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index e0a78d8533..e84c31eecf 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -115,12 +115,40 @@ Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits");
*/
/*!
+ \fn QFlag::QFlag(uint value)
+ \since Qt 5.3
+
+ Constructs a QFlag object that stores the given \a value.
+*/
+
+/*!
+ \fn QFlag::QFlag(short value)
+ \since 5.3
+
+ Constructs a QFlag object that stores the given \a value.
+*/
+
+/*!
+ \fn QFlag::QFlag(ushort value)
+ \since Qt 5.3
+
+ Constructs a QFlag object that stores the given \a value.
+*/
+
+/*!
\fn QFlag::operator int() const
Returns the value stored by the QFlag object.
*/
/*!
+ \fn QFlag::operator uint() const
+ \since Qt 5.3
+
+ Returns the value stored by the QFlag object.
+*/
+
+/*!
\class QFlags
\inmodule QtCore
\brief The QFlags class provides a type-safe way of storing