summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-08-12 14:14:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-08-14 15:52:58 +0200
commit6f0df02d002356625f10683ef84da7685d92a2c4 (patch)
tree46713209af459ebda534c3404f48c5f5c80ba3f8
parent44cce1a2ea9dadd8b2de93f40de34269dda703c0 (diff)
Replace Qt CONSTEXPR defines with constexpr
Both normal and relaxed constexpr are required by our new minimum of C++17. Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
-rw-r--r--src/corelib/global/qendian.h52
-rw-r--r--src/corelib/global/qendian_p.h2
-rw-r--r--src/corelib/global/qflags.h90
-rw-r--r--src/corelib/global/qglobal.h44
-rw-r--r--src/corelib/global/qlogging.h10
-rw-r--r--src/corelib/global/qnumeric_p.h6
-rw-r--r--src/corelib/global/qoperatingsystemversion.h14
-rw-r--r--src/corelib/global/qrandom.cpp4
-rw-r--r--src/corelib/global/qrandom.h10
-rw-r--r--src/corelib/io/qdir.h2
-rw-r--r--src/corelib/io/qsettings.cpp2
-rw-r--r--src/corelib/io/qurl.h66
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h20
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel_p.h6
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp4
-rw-r--r--src/corelib/kernel/qdeadlinetimer.h6
-rw-r--r--src/corelib/kernel/qelapsedtimer.h2
-rw-r--r--src/corelib/kernel/qmath.h14
-rw-r--r--src/corelib/kernel/qmetaobject.h6
-rw-r--r--src/corelib/kernel/qmetatype.h18
-rw-r--r--src/corelib/kernel/qsystemerror_p.h8
-rw-r--r--src/corelib/kernel/qtimer.h2
-rw-r--r--src/corelib/kernel/qtmetamacros.h8
-rw-r--r--src/corelib/plugin/quuid.h18
-rw-r--r--src/corelib/serialization/qcborarray.h8
-rw-r--r--src/corelib/serialization/qcbormap.h8
-rw-r--r--src/corelib/serialization/qcborstreamwriter.cpp2
-rw-r--r--src/corelib/serialization/qcborvalue.h6
-rw-r--r--src/corelib/serialization/qtextstream.h4
-rw-r--r--src/corelib/text/qbytearraymatcher.h8
-rw-r--r--src/corelib/text/qbytearrayview.h2
-rw-r--r--src/corelib/text/qchar.h176
-rw-r--r--src/corelib/text/qlocale_p.h2
-rw-r--r--src/corelib/text/qstring.cpp8
-rw-r--r--src/corelib/text/qstring.h60
-rw-r--r--src/corelib/text/qstringalgorithms.h2
-rw-r--r--src/corelib/text/qstringbuilder.h2
-rw-r--r--src/corelib/text/qstringview.h56
-rw-r--r--src/corelib/thread/qatomic.h28
-rw-r--r--src/corelib/thread/qatomic_cxx11.h42
-rw-r--r--src/corelib/thread/qatomic_msvc.h28
-rw-r--r--src/corelib/thread/qbasicatomic.h28
-rw-r--r--src/corelib/thread/qfutex_p.h2
-rw-r--r--src/corelib/thread/qgenericatomic.h16
-rw-r--r--src/corelib/thread/qmutex.h2
-rw-r--r--src/corelib/thread/qsemaphore.cpp4
-rw-r--r--src/corelib/time/qdatetime.cpp8
-rw-r--r--src/corelib/time/qdatetime.h54
-rw-r--r--src/corelib/time/qdatetimeparser_p.h2
-rw-r--r--src/corelib/time/qtimezoneprivate_p.h4
-rw-r--r--src/corelib/tools/qalgorithms.h26
-rw-r--r--src/corelib/tools/qfreelist_p.h4
-rw-r--r--src/corelib/tools/qhashfunctions.h28
-rw-r--r--src/corelib/tools/qiterator.h2
-rw-r--r--src/corelib/tools/qline.h146
-rw-r--r--src/corelib/tools/qmargins.h222
-rw-r--r--src/corelib/tools/qrect.h552
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h4
-rw-r--r--src/corelib/tools/qsize.h200
-rw-r--r--src/corelib/tools/qtools_p.h10
-rw-r--r--src/gui/image/qimage.cpp2
-rw-r--r--src/gui/image/qimage_conversions.cpp4
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp2
-rw-r--r--src/gui/kernel/qpixelformat.h139
-rw-r--r--src/gui/kernel/qpointingdevice.h4
-rw-r--r--src/gui/math3d/qquaternion.h4
-rw-r--r--src/gui/math3d/qvector2d.h76
-rw-r--r--src/gui/math3d/qvector3d.h78
-rw-r--r--src/gui/math3d/qvector4d.h84
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/painting/qcolor.h10
-rw-r--r--src/gui/painting/qcolormatrix_p.h12
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_p.h10
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h2
-rw-r--r--src/gui/painting/qfixed_p.h136
-rw-r--r--src/gui/painting/qpixellayout.cpp370
-rw-r--r--src/gui/painting/qpixellayout_p.h4
-rw-r--r--src/gui/painting/qrgb.h20
-rw-r--r--src/gui/painting/qrgba64.h66
-rw-r--r--src/gui/painting/webgradients.cpp2
-rw-r--r--src/gui/text/qtextengine_p.h4
-rw-r--r--src/network/kernel/qhostaddress_p.h2
-rw-r--r--src/network/ssl/qsslcertificate_openssl.cpp2
-rw-r--r--src/network/ssl/qsslellipticcurve.h16
-rw-r--r--src/opengl/qopenglshaderprogram.cpp4
-rw-r--r--src/opengl/qopenglversionfunctions.h62
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp8
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qt_x11_p.h2
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp2
-rw-r--r--src/widgets/itemviews/qlistview_p.h22
-rw-r--r--src/widgets/kernel/qsizepolicy.h84
-rw-r--r--src/widgets/styles/qcommonstyle.cpp6
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp14
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp2
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp4
-rw-r--r--tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp4
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp4
-rw-r--r--tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp2
-rw-r--r--tests/auto/corelib/text/qstringview/tst_qstringview.cpp2
-rw-r--r--tests/auto/corelib/thread/qfuture/tst_qfuture.cpp2
-rw-r--r--tests/auto/corelib/thread/qmutex/tst_qmutex.cpp8
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp10
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp8
-rw-r--r--tests/auto/corelib/tools/qlist/tst_qlist.cpp2
-rw-r--r--tests/auto/corelib/tools/qpair/tst_qpair.cpp10
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp4
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp2
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp2
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp2
-rw-r--r--tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp16
-rw-r--r--tests/benchmarks/corelib/tools/qvector/qrawvector.h4
-rw-r--r--util/gradientgen/gradientgen.cpp2
117 files changed, 1746 insertions, 1781 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index a50ade4aa4..99b529f17c 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -89,7 +89,7 @@ template <typename T> Q_ALWAYS_INLINE T qFromUnaligned(const void *src)
// These definitions are written so that they are recognized by most compilers
// as bswap and replaced with single instruction builtins if available.
-inline Q_DECL_CONSTEXPR quint64 qbswap_helper(quint64 source)
+inline constexpr quint64 qbswap_helper(quint64 source)
{
return 0
| ((source & Q_UINT64_C(0x00000000000000ff)) << 56)
@@ -102,7 +102,7 @@ inline Q_DECL_CONSTEXPR quint64 qbswap_helper(quint64 source)
| ((source & Q_UINT64_C(0xff00000000000000)) >> 56);
}
-inline Q_DECL_CONSTEXPR quint32 qbswap_helper(quint32 source)
+inline constexpr quint32 qbswap_helper(quint32 source)
{
return 0
| ((source & 0x000000ff) << 24)
@@ -111,14 +111,14 @@ inline Q_DECL_CONSTEXPR quint32 qbswap_helper(quint32 source)
| ((source & 0xff000000) >> 24);
}
-inline Q_DECL_CONSTEXPR quint16 qbswap_helper(quint16 source)
+inline constexpr quint16 qbswap_helper(quint16 source)
{
return quint16( 0
| ((source & 0x00ff) << 8)
| ((source & 0xff00) >> 8) );
}
-inline Q_DECL_CONSTEXPR quint8 qbswap_helper(quint8 source)
+inline constexpr quint8 qbswap_helper(quint8 source)
{
return source;
}
@@ -130,7 +130,7 @@ inline Q_DECL_CONSTEXPR quint8 qbswap_helper(quint8 source)
* and it is therefore a bit more convenient and in most cases more efficient.
*/
template <typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
-inline Q_DECL_CONSTEXPR T qbswap(T source)
+inline constexpr T qbswap(T source)
{
return T(qbswap_helper(typename QIntegerForSizeof<T>::Unsigned(source)));
}
@@ -182,13 +182,13 @@ template<> Q_CORE_EXPORT void *qbswap<8>(const void *source, qsizetype count, vo
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template <typename T> inline Q_DECL_CONSTEXPR T qToBigEndian(T source)
+template <typename T> inline constexpr T qToBigEndian(T source)
{ return source; }
-template <typename T> inline Q_DECL_CONSTEXPR T qFromBigEndian(T source)
+template <typename T> inline constexpr T qFromBigEndian(T source)
{ return source; }
-template <typename T> inline Q_DECL_CONSTEXPR T qToLittleEndian(T source)
+template <typename T> inline constexpr T qToLittleEndian(T source)
{ return qbswap(source); }
-template <typename T> inline Q_DECL_CONSTEXPR T qFromLittleEndian(T source)
+template <typename T> inline constexpr T qFromLittleEndian(T source)
{ return qbswap(source); }
template <typename T> inline void qToBigEndian(T src, void *dest)
{ qToUnaligned<T>(src, dest); }
@@ -205,13 +205,13 @@ template <typename T> inline void qFromLittleEndian(const void *source, qsizetyp
{ qbswap<sizeof(T)>(source, count, dest); }
#else // Q_LITTLE_ENDIAN
-template <typename T> inline Q_DECL_CONSTEXPR T qToBigEndian(T source)
+template <typename T> inline constexpr T qToBigEndian(T source)
{ return qbswap(source); }
-template <typename T> inline Q_DECL_CONSTEXPR T qFromBigEndian(T source)
+template <typename T> inline constexpr T qFromBigEndian(T source)
{ return qbswap(source); }
-template <typename T> inline Q_DECL_CONSTEXPR T qToLittleEndian(T source)
+template <typename T> inline constexpr T qToLittleEndian(T source)
{ return source; }
-template <typename T> inline Q_DECL_CONSTEXPR T qFromLittleEndian(T source)
+template <typename T> inline constexpr T qFromLittleEndian(T source)
{ return source; }
template <typename T> inline void qToBigEndian(T src, void *dest)
{ qbswap<T>(src, dest); }
@@ -265,7 +265,7 @@ class QSpecialInteger
T val;
public:
QSpecialInteger() = default;
- explicit Q_DECL_CONSTEXPR QSpecialInteger(T i) : val(S::toSpecial(i)) {}
+ explicit constexpr QSpecialInteger(T i) : val(S::toSpecial(i)) {}
QSpecialInteger &operator =(T i) { val = S::toSpecial(i); return *this; }
operator T() const { return S::fromSpecial(val); }
@@ -310,9 +310,9 @@ public:
return pre;
}
- static Q_DECL_CONSTEXPR QSpecialInteger max()
+ static constexpr QSpecialInteger max()
{ return QSpecialInteger(std::numeric_limits<T>::max()); }
- static Q_DECL_CONSTEXPR QSpecialInteger min()
+ static constexpr QSpecialInteger min()
{ return QSpecialInteger(std::numeric_limits<T>::min()); }
};
@@ -320,23 +320,23 @@ template<typename T>
class QLittleEndianStorageType {
public:
typedef T StorageType;
- static Q_DECL_CONSTEXPR T toSpecial(T source) { return qToLittleEndian(source); }
- static Q_DECL_CONSTEXPR T fromSpecial(T source) { return qFromLittleEndian(source); }
+ static constexpr T toSpecial(T source) { return qToLittleEndian(source); }
+ static constexpr T fromSpecial(T source) { return qFromLittleEndian(source); }
};
template<typename T>
class QBigEndianStorageType {
public:
typedef T StorageType;
- static Q_DECL_CONSTEXPR T toSpecial(T source) { return qToBigEndian(source); }
- static Q_DECL_CONSTEXPR T fromSpecial(T source) { return qFromBigEndian(source); }
+ static constexpr T toSpecial(T source) { return qToBigEndian(source); }
+ static constexpr T fromSpecial(T source) { return qFromBigEndian(source); }
};
#ifdef Q_CLANG_QDOC
template<typename T>
class QLEInteger {
public:
- explicit Q_DECL_CONSTEXPR QLEInteger(T i);
+ explicit constexpr QLEInteger(T i);
QLEInteger &operator =(T i);
operator T() const;
bool operator ==(QLEInteger i) const;
@@ -356,14 +356,14 @@ public:
QLEInteger &operator ++(int);
QLEInteger &operator --(int);
- static Q_DECL_CONSTEXPR QLEInteger max();
- static Q_DECL_CONSTEXPR QLEInteger min();
+ static constexpr QLEInteger max();
+ static constexpr QLEInteger min();
};
template<typename T>
class QBEInteger {
public:
- explicit Q_DECL_CONSTEXPR QBEInteger(T i);
+ explicit constexpr QBEInteger(T i);
QBEInteger &operator =(T i);
operator T() const;
bool operator ==(QBEInteger i) const;
@@ -383,8 +383,8 @@ public:
QBEInteger &operator ++(int);
QBEInteger &operator --(int);
- static Q_DECL_CONSTEXPR QBEInteger max();
- static Q_DECL_CONSTEXPR QBEInteger min();
+ static constexpr QBEInteger max();
+ static constexpr QBEInteger min();
};
#else
diff --git a/src/corelib/global/qendian_p.h b/src/corelib/global/qendian_p.h
index c830e65b54..d0d79d4ce4 100644
--- a/src/corelib/global/qendian_p.h
+++ b/src/corelib/global/qendian_p.h
@@ -65,7 +65,7 @@ protected:
typedef typename S::StorageType T;
typedef typename std::make_unsigned<T>::type UT;
- static Q_DECL_CONSTEXPR UT mask()
+ static constexpr UT mask()
{
return ((UT(1) << width) - 1) << pos;
}
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index 3cb46e3a01..cf0cd4b155 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -52,21 +52,21 @@ class QFlag
{
int i;
public:
- Q_DECL_CONSTEXPR inline QFlag(int value) noexcept : i(value) {}
- Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; }
+ constexpr inline QFlag(int value) noexcept : i(value) {}
+ constexpr inline operator int() const noexcept { 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_CLANG_QDOC)
- Q_DECL_CONSTEXPR inline QFlag(long value) noexcept : i(int(value)) {}
- Q_DECL_CONSTEXPR inline QFlag(ulong value) noexcept : i(int(long(value))) {}
+ constexpr inline QFlag(long value) noexcept : i(int(value)) {}
+ constexpr inline QFlag(ulong value) noexcept : i(int(long(value))) {}
# endif
- Q_DECL_CONSTEXPR inline QFlag(uint value) noexcept : i(int(value)) {}
- Q_DECL_CONSTEXPR inline QFlag(short value) noexcept : i(int(value)) {}
- Q_DECL_CONSTEXPR inline QFlag(ushort value) noexcept : i(int(uint(value))) {}
- Q_DECL_CONSTEXPR inline operator uint() const noexcept { return uint(i); }
+ constexpr inline QFlag(uint value) noexcept : i(int(value)) {}
+ constexpr inline QFlag(short value) noexcept : i(int(value)) {}
+ constexpr inline QFlag(ushort value) noexcept : i(int(uint(value))) {}
+ constexpr inline operator uint() const noexcept { return uint(i); }
#endif
};
Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE);
@@ -75,12 +75,12 @@ class QIncompatibleFlag
{
int i;
public:
- Q_DECL_CONSTEXPR inline explicit QIncompatibleFlag(int i) noexcept;
- Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; }
+ constexpr inline explicit QIncompatibleFlag(int i) noexcept;
+ constexpr inline operator int() const noexcept { return i; }
};
Q_DECLARE_TYPEINFO(QIncompatibleFlag, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) noexcept : i(value) {}
+constexpr inline QIncompatibleFlag::QIncompatibleFlag(int value) noexcept : i(value) {}
#ifndef Q_NO_TYPESAFE_FLAGS
@@ -114,48 +114,48 @@ public:
typedef Enum enum_type;
// compiler-generated copy/move ctor/assignment operators are fine!
#ifdef Q_CLANG_QDOC
- Q_DECL_CONSTEXPR inline QFlags(const QFlags &other);
- Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other);
+ constexpr inline QFlags(const QFlags &other);
+ constexpr inline QFlags &operator=(const QFlags &other);
#endif
- Q_DECL_CONSTEXPR inline QFlags() noexcept : i(0) {}
- Q_DECL_CONSTEXPR inline QFlags(Enum flags) noexcept : i(Int(flags)) {}
+ constexpr inline QFlags() noexcept : i(0) {}
+ constexpr inline QFlags(Enum flags) noexcept : i(Int(flags)) {}
#if QT_DEPRECATED_SINCE(5,15)
- QT_DEPRECATED_X("Use default constructor instead") Q_DECL_CONSTEXPR inline QFlags(Zero) noexcept : i(0) {}
+ QT_DEPRECATED_X("Use default constructor instead") constexpr inline QFlags(Zero) noexcept : i(0) {}
#endif
- Q_DECL_CONSTEXPR inline QFlags(QFlag flag) noexcept : i(flag) {}
+ constexpr inline QFlags(QFlag flag) noexcept : i(flag) {}
- Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) noexcept
+ constexpr inline QFlags(std::initializer_list<Enum> flags) noexcept
: i(initializer_list_helper(flags.begin(), flags.end())) {}
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) noexcept { i &= mask; return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) noexcept { i &= mask; return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) noexcept { i &= Int(mask); return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) noexcept { i |= other.i; return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) noexcept { i |= Int(other); return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) noexcept { i ^= other.i; return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) noexcept { i ^= Int(other); return *this; }
-
- Q_DECL_CONSTEXPR inline operator Int() const noexcept { return i; }
-
- Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const noexcept { return QFlags(QFlag(i | other.i)); }
- Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const noexcept { return QFlags(QFlag(i | Int(other))); }
- Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const noexcept { return QFlags(QFlag(i ^ other.i)); }
- Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const noexcept { return QFlags(QFlag(i ^ Int(other))); }
- Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const noexcept { return QFlags(QFlag(i & mask)); }
- Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const noexcept { return QFlags(QFlag(i & mask)); }
- Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const noexcept { return QFlags(QFlag(i & Int(other))); }
- Q_DECL_CONSTEXPR inline QFlags operator~() const noexcept { return QFlags(QFlag(~i)); }
-
- Q_DECL_CONSTEXPR inline bool operator!() const noexcept { return !i; }
-
- Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) noexcept
+ constexpr inline QFlags &operator&=(int mask) noexcept { i &= mask; return *this; }
+ constexpr inline QFlags &operator&=(uint mask) noexcept { i &= mask; return *this; }
+ constexpr inline QFlags &operator&=(Enum mask) noexcept { i &= Int(mask); return *this; }
+ constexpr inline QFlags &operator|=(QFlags other) noexcept { i |= other.i; return *this; }
+ constexpr inline QFlags &operator|=(Enum other) noexcept { i |= Int(other); return *this; }
+ constexpr inline QFlags &operator^=(QFlags other) noexcept { i ^= other.i; return *this; }
+ constexpr inline QFlags &operator^=(Enum other) noexcept { i ^= Int(other); return *this; }
+
+ constexpr inline operator Int() const noexcept { return i; }
+
+ constexpr inline QFlags operator|(QFlags other) const noexcept { return QFlags(QFlag(i | other.i)); }
+ constexpr inline QFlags operator|(Enum other) const noexcept { return QFlags(QFlag(i | Int(other))); }
+ constexpr inline QFlags operator^(QFlags other) const noexcept { return QFlags(QFlag(i ^ other.i)); }
+ constexpr inline QFlags operator^(Enum other) const noexcept { return QFlags(QFlag(i ^ Int(other))); }
+ constexpr inline QFlags operator&(int mask) const noexcept { return QFlags(QFlag(i & mask)); }
+ constexpr inline QFlags operator&(uint mask) const noexcept { return QFlags(QFlag(i & mask)); }
+ constexpr inline QFlags operator&(Enum other) const noexcept { return QFlags(QFlag(i & Int(other))); }
+ constexpr inline QFlags operator~() const noexcept { return QFlags(QFlag(~i)); }
+
+ constexpr inline bool operator!() const noexcept { return !i; }
+
+ constexpr inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
+ constexpr inline QFlags &setFlag(Enum flag, bool on = true) noexcept
{
return on ? (*this |= flag) : (*this &= ~Int(flag));
}
private:
- Q_DECL_CONSTEXPR static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it,
+ constexpr static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it,
typename std::initializer_list<Enum>::const_iterator end)
noexcept
{
@@ -171,13 +171,13 @@ typedef QFlags<Enum> Flags;
#endif
#define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \
-Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \
+constexpr inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \
{ return QIncompatibleFlag(int(f1) | f2); }
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
-Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \
+constexpr inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \
{ return QFlags<Flags::enum_type>(f1) | f2; } \
-Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \
+constexpr inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \
{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index db858c44b3..140a9562c0 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -603,16 +603,16 @@ using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
*/
template <typename T>
-Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
+constexpr inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
-Q_DECL_CONSTEXPR inline int qRound(double d)
+constexpr inline int qRound(double d)
{ return d >= 0.0 ? int(d + 0.5) : int(d - double(int(d-1)) + 0.5) + int(d-1); }
-Q_DECL_CONSTEXPR inline int qRound(float d)
+constexpr inline int qRound(float d)
{ return d >= 0.0f ? int(d + 0.5f) : int(d - float(int(d-1)) + 0.5f) + int(d-1); }
-Q_DECL_CONSTEXPR inline qint64 qRound64(double d)
+constexpr inline qint64 qRound64(double d)
{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - double(qint64(d-1)) + 0.5) + qint64(d-1); }
-Q_DECL_CONSTEXPR inline qint64 qRound64(float d)
+constexpr inline qint64 qRound64(float d)
{ return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - float(qint64(d-1)) + 0.5f) + qint64(d-1); }
namespace QTypeTraits {
@@ -888,22 +888,22 @@ typedef void (*QFunctionPointer)();
# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
#endif
-Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(double p1, double p2)
+Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyCompare(double p1, double p2)
{
return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
}
-Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(float p1, float p2)
+Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyCompare(float p1, float p2)
{
return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
}
-Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNull(double d)
+Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyIsNull(double d)
{
return qAbs(d) <= 0.000000000001;
}
-Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNull(float f)
+Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qFuzzyIsNull(float f)
{
return qAbs(f) <= 0.00001f;
}
@@ -911,12 +911,12 @@ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNul
QT_WARNING_PUSH
QT_WARNING_DISABLE_FLOAT_COMPARE
-Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qIsNull(double d) noexcept
+Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qIsNull(double d) noexcept
{
return d == 0.0;
}
-Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qIsNull(float f) noexcept
+Q_REQUIRED_RESULT constexpr static inline Q_DECL_UNUSED bool qIsNull(float f) noexcept
{
return f == 0.0f;
}
@@ -1029,14 +1029,14 @@ inline bool qt_is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
// this adds const to non-const objects (like std::as_const)
template <typename T>
-Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
+constexpr typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
// prevent rvalue arguments:
template <typename T>
void qAsConst(const T &&) = delete;
// like std::exchange
template <typename T, typename U = T>
-Q_DECL_RELAXED_CONSTEXPR T qExchange(T &t, U &&newValue)
+constexpr T qExchange(T &t, U &&newValue)
{
T old = std::move(t);
t = std::forward<U>(newValue);
@@ -1200,11 +1200,11 @@ template <typename... Args>
struct QNonConstOverload
{
template <typename R, typename T>
- Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr)
+ constexpr auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr)
{ return ptr; }
template <typename R, typename T>
- static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr)
+ static constexpr auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr)
{ return ptr; }
};
@@ -1212,11 +1212,11 @@ template <typename... Args>
struct QConstOverload
{
template <typename R, typename T>
- Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
+ constexpr auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
{ return ptr; }
template <typename R, typename T>
- static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr)
+ static constexpr auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr)
{ return ptr; }
};
@@ -1229,18 +1229,18 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
using QNonConstOverload<Args...>::operator();
template <typename R>
- Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr)
+ constexpr auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr)
{ return ptr; }
template <typename R>
- static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
+ static constexpr auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
{ return ptr; }
};
#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14
-template <typename... Args> Q_CONSTEXPR Q_DECL_UNUSED QOverload<Args...> qOverload = {};
-template <typename... Args> Q_CONSTEXPR Q_DECL_UNUSED QConstOverload<Args...> qConstOverload = {};
-template <typename... Args> Q_CONSTEXPR Q_DECL_UNUSED QNonConstOverload<Args...> qNonConstOverload = {};
+template <typename... Args> constexpr Q_DECL_UNUSED QOverload<Args...> qOverload = {};
+template <typename... Args> constexpr Q_DECL_UNUSED QConstOverload<Args...> qConstOverload = {};
+template <typename... Args> constexpr Q_DECL_UNUSED QNonConstOverload<Args...> qNonConstOverload = {};
#endif
#endif
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index be9707ff06..e905929c78 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -63,8 +63,8 @@ class QMessageLogContext
{
Q_DISABLE_COPY(QMessageLogContext)
public:
- Q_DECL_CONSTEXPR QMessageLogContext() noexcept = default;
- Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept
+ constexpr QMessageLogContext() noexcept = default;
+ constexpr QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept
: line(lineNumber), file(fileName), function(functionName), category(categoryName) {}
int version = 2;
@@ -86,10 +86,10 @@ class Q_CORE_EXPORT QMessageLogger
{
Q_DISABLE_COPY(QMessageLogger)
public:
- Q_DECL_CONSTEXPR QMessageLogger() : context() {}
- Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function)
+ constexpr QMessageLogger() : context() {}
+ constexpr QMessageLogger(const char *file, int line, const char *function)
: context(file, line, function, "default") {}
- Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function, const char *category)
+ constexpr QMessageLogger(const char *file, int line, const char *function, const char *category)
: context(file, line, function, category) {}
void debug(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h
index 790a00bdb5..2c5d19d274 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -126,7 +126,7 @@ Q_DECL_CONST_FUNCTION static inline int fpclassify(float f) { return std::fpclas
#endif
}
-Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() noexcept
+constexpr Q_DECL_CONST_FUNCTION static inline double qt_inf() noexcept
{
static_assert(std::numeric_limits<double>::has_infinity,
"platform has no definition for infinity for type double");
@@ -134,7 +134,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() noexcept
}
#if QT_CONFIG(signaling_nan)
-Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() noexcept
+constexpr Q_DECL_CONST_FUNCTION static inline double qt_snan() noexcept
{
static_assert(std::numeric_limits<double>::has_signaling_NaN,
"platform has no definition for signaling NaN for type double");
@@ -143,7 +143,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() noexcept
#endif
// Quiet NaN
-Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() noexcept
+constexpr Q_DECL_CONST_FUNCTION static inline double qt_qnan() noexcept
{
static_assert(std::numeric_limits<double>::has_quiet_NaN,
"platform has no definition for quiet NaN for type double");
diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h
index 1a8d38400b..37ace76755 100644
--- a/src/corelib/global/qoperatingsystemversion.h
+++ b/src/corelib/global/qoperatingsystemversion.h
@@ -85,7 +85,7 @@ public:
static const QOperatingSystemVersion AndroidNougat_MR1;
static const QOperatingSystemVersion AndroidOreo;
- Q_DECL_CONSTEXPR QOperatingSystemVersion(OSType osType,
+ constexpr QOperatingSystemVersion(OSType osType,
int vmajor, int vminor = -1, int vmicro = -1)
: m_os(osType),
m_major(qMax(-1, vmajor)),
@@ -95,7 +95,7 @@ public:
static QOperatingSystemVersion current();
- static Q_DECL_CONSTEXPR OSType currentType()
+ static constexpr OSType currentType()
{
#if defined(Q_OS_WIN)
return Windows;
@@ -114,15 +114,15 @@ public:
#endif
}
- Q_DECL_CONSTEXPR int majorVersion() const { return m_major; }
- Q_DECL_CONSTEXPR int minorVersion() const { return m_minor; }
- Q_DECL_CONSTEXPR int microVersion() const { return m_micro; }
+ constexpr int majorVersion() const { return m_major; }
+ constexpr int minorVersion() const { return m_minor; }
+ constexpr int microVersion() const { return m_micro; }
- Q_DECL_CONSTEXPR int segmentCount() const
+ constexpr int segmentCount() const
{ return m_micro >= 0 ? 3 : m_minor >= 0 ? 2 : m_major >= 0 ? 1 : 0; }
bool isAnyOfType(std::initializer_list<OSType> types) const;
- Q_DECL_CONSTEXPR OSType type() const { return m_os; }
+ constexpr OSType type() const { return m_os; }
QString name() const;
friend bool operator>(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs)
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index 1d2a29c074..424fa4449e 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -155,7 +155,7 @@ struct QRandomGenerator::SystemGenerator
qt_safe_close(fd);
}
- Q_DECL_CONSTEXPR SystemGenerator() : fdp1 Q_BASIC_ATOMIC_INITIALIZER(0) {}
+ constexpr SystemGenerator() : fdp1 Q_BASIC_ATOMIC_INITIALIZER(0) {}
qsizetype fillBuffer(void *buffer, qsizetype count)
{
@@ -1057,7 +1057,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\sa QRandomGenerator::generate(), QRandomGenerator::generate64()
*/
-Q_DECL_CONSTEXPR QRandomGenerator::Storage::Storage()
+constexpr QRandomGenerator::Storage::Storage()
: dummy(0)
{
// nothing
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index 4e27ef1edc..7bb90de2bb 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -169,8 +169,8 @@ public:
void seed(quint32 s = 1) { *this = { s }; }
void seed(std::seed_seq &sseq) noexcept { *this = { sseq }; }
Q_CORE_EXPORT void discard(unsigned long long z);
- static Q_DECL_CONSTEXPR result_type min() { return std::numeric_limits<result_type>::min(); }
- static Q_DECL_CONSTEXPR result_type max() { return std::numeric_limits<result_type>::max(); }
+ static constexpr result_type min() { return std::numeric_limits<result_type>::min(); }
+ static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
static inline Q_DECL_CONST_FUNCTION QRandomGenerator *system();
static inline Q_DECL_CONST_FUNCTION QRandomGenerator *global();
@@ -203,7 +203,7 @@ private:
static_assert(std::is_trivially_destructible<RandomEngine>::value,
"std::mersenne_twister not trivially destructible as expected");
- Q_DECL_CONSTEXPR Storage();
+ constexpr Storage();
};
uint type;
Storage storage;
@@ -245,8 +245,8 @@ public:
QRandomGenerator::discard(z * 2);
}
- static Q_DECL_CONSTEXPR result_type min() { return std::numeric_limits<result_type>::min(); }
- static Q_DECL_CONSTEXPR result_type max() { return std::numeric_limits<result_type>::max(); }
+ static constexpr result_type min() { return std::numeric_limits<result_type>::min(); }
+ static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *system();
static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *global();
static Q_CORE_EXPORT QRandomGenerator64 securelySeeded();
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index 023d488545..f4cf621e80 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -221,7 +221,7 @@ public:
static QFileInfoList drives();
- Q_DECL_CONSTEXPR static inline QChar listSeparator() noexcept
+ constexpr static inline QChar listSeparator() noexcept
{
#if defined(Q_OS_WIN)
return QLatin1Char(';');
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index e5ce2c6674..6165cd2af2 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -964,7 +964,7 @@ static inline int pathHashKey(QSettings::Format format, QSettings::Scope scope)
#ifndef Q_OS_WIN
static QString make_user_path()
{
- static Q_CONSTEXPR QChar sep = QLatin1Char('/');
+ static constexpr QChar sep = QLatin1Char('/');
#ifndef QSETTINGS_USE_QSTANDARDPATHS
// Non XDG platforms (OS X, iOS, Android...) have used this code path erroneously
// for some time now. Moving away from that would require migrating existing settings.
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 043b3b1482..b8c4c881be 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -66,12 +66,12 @@ class QUrlTwoFlags
int i;
typedef int QUrlTwoFlags:: *Zero;
public:
- Q_DECL_CONSTEXPR inline QUrlTwoFlags(E1 f) : i(f) {}
- Q_DECL_CONSTEXPR inline QUrlTwoFlags(E2 f) : i(f) {}
- Q_DECL_CONSTEXPR inline QUrlTwoFlags(QFlag f) : i(f) {}
- Q_DECL_CONSTEXPR inline QUrlTwoFlags(QFlags<E1> f) : i(f.operator typename QFlags<E1>::Int()) {}
- Q_DECL_CONSTEXPR inline QUrlTwoFlags(QFlags<E2> f) : i(f.operator typename QFlags<E2>::Int()) {}
- Q_DECL_CONSTEXPR inline QUrlTwoFlags(Zero = 0) : i(0) {}
+ constexpr inline QUrlTwoFlags(E1 f) : i(f) {}
+ constexpr inline QUrlTwoFlags(E2 f) : i(f) {}
+ constexpr inline QUrlTwoFlags(QFlag f) : i(f) {}
+ constexpr inline QUrlTwoFlags(QFlags<E1> f) : i(f.operator typename QFlags<E1>::Int()) {}
+ constexpr inline QUrlTwoFlags(QFlags<E2> f) : i(f.operator typename QFlags<E2>::Int()) {}
+ constexpr inline QUrlTwoFlags(Zero = 0) : i(0) {}
inline QUrlTwoFlags &operator&=(int mask) { i &= mask; return *this; }
inline QUrlTwoFlags &operator&=(uint mask) { i &= mask; return *this; }
@@ -82,36 +82,36 @@ public:
inline QUrlTwoFlags &operator^=(E1 f) { i ^= f; return *this; }
inline QUrlTwoFlags &operator^=(E2 f) { i ^= f; return *this; }
- Q_DECL_CONSTEXPR inline operator QFlags<E1>() const { return QFlag(i); }
- Q_DECL_CONSTEXPR inline operator QFlags<E2>() const { return QFlag(i); }
- Q_DECL_CONSTEXPR inline operator int() const { return i; }
- Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
+ constexpr inline operator QFlags<E1>() const { return QFlag(i); }
+ constexpr inline operator QFlags<E2>() const { return QFlag(i); }
+ constexpr inline operator int() const { return i; }
+ constexpr inline bool operator!() const { return !i; }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(QUrlTwoFlags f) const
+ constexpr inline QUrlTwoFlags operator|(QUrlTwoFlags f) const
{ return QUrlTwoFlags(QFlag(i | f.i)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E1 f) const
+ constexpr inline QUrlTwoFlags operator|(E1 f) const
{ return QUrlTwoFlags(QFlag(i | f)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E2 f) const
+ constexpr inline QUrlTwoFlags operator|(E2 f) const
{ return QUrlTwoFlags(QFlag(i | f)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(QUrlTwoFlags f) const
+ constexpr inline QUrlTwoFlags operator^(QUrlTwoFlags f) const
{ return QUrlTwoFlags(QFlag(i ^ f.i)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E1 f) const
+ constexpr inline QUrlTwoFlags operator^(E1 f) const
{ return QUrlTwoFlags(QFlag(i ^ f)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E2 f) const
+ constexpr inline QUrlTwoFlags operator^(E2 f) const
{ return QUrlTwoFlags(QFlag(i ^ f)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(int mask) const
+ constexpr inline QUrlTwoFlags operator&(int mask) const
{ return QUrlTwoFlags(QFlag(i & mask)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(uint mask) const
+ constexpr inline QUrlTwoFlags operator&(uint mask) const
{ return QUrlTwoFlags(QFlag(i & mask)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E1 f) const
+ constexpr inline QUrlTwoFlags operator&(E1 f) const
{ return QUrlTwoFlags(QFlag(i & f)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E2 f) const
+ constexpr inline QUrlTwoFlags operator&(E2 f) const
{ return QUrlTwoFlags(QFlag(i & f)); }
- Q_DECL_CONSTEXPR inline QUrlTwoFlags operator~() const
+ constexpr inline QUrlTwoFlags operator~() const
{ return QUrlTwoFlags(QFlag(~i)); }
- Q_DECL_CONSTEXPR inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
- Q_DECL_CONSTEXPR inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+ constexpr inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+ constexpr inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
};
template<typename E1, typename E2>
@@ -302,29 +302,29 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::ComponentFormattingOptions)
//Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions)
#ifndef Q_QDOC
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2)
{ return QUrl::FormattingOptions(f1) | f2; }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2)
{ return f2 | f1; }
-Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(QUrl::UrlFormattingOption f1, int f2)
+constexpr inline QIncompatibleFlag operator|(QUrl::UrlFormattingOption f1, int f2)
{ return QIncompatibleFlag(int(f1) | f2); }
// add operators for OR'ing the two types of flags
inline QUrl::FormattingOptions &operator|=(QUrl::FormattingOptions &i, QUrl::ComponentFormattingOptions f)
{ i |= QUrl::UrlFormattingOption(int(f)); return i; }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOption f)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOption f)
{ return i | QUrl::UrlFormattingOption(int(f)); }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOptions f)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOptions f)
{ return i | QUrl::UrlFormattingOption(int(f)); }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::UrlFormattingOption i)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::UrlFormattingOption i)
{ return i | QUrl::UrlFormattingOption(int(f)); }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::UrlFormattingOption i)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::UrlFormattingOption i)
{ return i | QUrl::UrlFormattingOption(int(f)); }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::FormattingOptions i, QUrl::ComponentFormattingOptions f)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::FormattingOptions i, QUrl::ComponentFormattingOptions f)
{ return i | QUrl::UrlFormattingOption(int(f)); }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::FormattingOptions i)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::FormattingOptions i)
{ return i | QUrl::UrlFormattingOption(int(f)); }
-Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::FormattingOptions i)
+constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::FormattingOptions i)
{ return i | QUrl::UrlFormattingOption(int(f)); }
//inline QUrl::UrlFormattingOption &operator=(const QUrl::UrlFormattingOption &i, QUrl::ComponentFormattingOptions f)
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index a7fb429cf3..7012b9fe92 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -57,11 +57,11 @@ class QModelIndex
{
friend class QAbstractItemModel;
public:
- Q_DECL_CONSTEXPR inline QModelIndex() noexcept : r(-1), c(-1), i(0), m(nullptr) {}
+ constexpr inline QModelIndex() noexcept : r(-1), c(-1), i(0), m(nullptr) {}
// compiler-generated copy/move ctors/assignment operators are fine!
- Q_DECL_CONSTEXPR inline int row() const noexcept { return r; }
- Q_DECL_CONSTEXPR inline int column() const noexcept { return c; }
- Q_DECL_CONSTEXPR inline quintptr internalId() const noexcept { return i; }
+ constexpr inline int row() const noexcept { return r; }
+ constexpr inline int column() const noexcept { return c; }
+ constexpr inline quintptr internalId() const noexcept { return i; }
inline void *internalPointer() const noexcept { return reinterpret_cast<void*>(i); }
inline const void *constInternalPointer() const noexcept { return reinterpret_cast<const void *>(i); }
inline QModelIndex parent() const;
@@ -70,13 +70,13 @@ public:
inline QModelIndex siblingAtRow(int row) const;
inline QVariant data(int role = Qt::DisplayRole) const;
inline Qt::ItemFlags flags() const;
- Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const noexcept { return m; }
- Q_DECL_CONSTEXPR inline bool isValid() const noexcept { return (r >= 0) && (c >= 0) && (m != nullptr); }
- Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const noexcept
+ constexpr inline const QAbstractItemModel *model() const noexcept { return m; }
+ constexpr inline bool isValid() const noexcept { return (r >= 0) && (c >= 0) && (m != nullptr); }
+ constexpr inline bool operator==(const QModelIndex &other) const noexcept
{ return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); }
- Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const noexcept
+ constexpr inline bool operator!=(const QModelIndex &other) const noexcept
{ return !(*this == other); }
- Q_DECL_CONSTEXPR inline bool operator<(const QModelIndex &other) const noexcept
+ constexpr inline bool operator<(const QModelIndex &other) const noexcept
{
return r < other.r
|| (r == other.r && (c < other.c
@@ -86,7 +86,7 @@ public:
private:
inline QModelIndex(int arow, int acolumn, const void *ptr, const QAbstractItemModel *amodel) noexcept
: r(arow), c(acolumn), i(reinterpret_cast<quintptr>(ptr)), m(amodel) {}
- Q_DECL_CONSTEXPR inline QModelIndex(int arow, int acolumn, quintptr id, const QAbstractItemModel *amodel) noexcept
+ constexpr inline QModelIndex(int arow, int acolumn, quintptr id, const QAbstractItemModel *amodel) noexcept
: r(arow), c(acolumn), i(id), m(amodel) {}
int r, c;
quintptr i;
diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h
index 6b2f69cf30..a2892cea87 100644
--- a/src/corelib/itemmodels/qabstractitemmodel_p.h
+++ b/src/corelib/itemmodels/qabstractitemmodel_p.h
@@ -115,8 +115,8 @@ public:
void invalidatePersistentIndex(const QModelIndex &index);
struct Change {
- Q_DECL_CONSTEXPR Change() : parent(), first(-1), last(-1), needsAdjust(false) {}
- Q_DECL_CONSTEXPR Change(const QModelIndex &p, int f, int l) : parent(p), first(f), last(l), needsAdjust(false) {}
+ constexpr Change() : parent(), first(-1), last(-1), needsAdjust(false) {}
+ constexpr Change(const QModelIndex &p, int f, int l) : parent(p), first(f), last(l), needsAdjust(false) {}
QModelIndex parent;
int first, last;
@@ -136,7 +136,7 @@ public:
// rowsMoved signal.
bool needsAdjust;
- Q_DECL_CONSTEXPR bool isValid() const { return first >= 0 && last >= 0; }
+ constexpr bool isValid() const { return first >= 0 && last >= 0; }
};
QStack<Change> changes;
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index 5eed378f9e..b0708a1074 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -1259,10 +1259,10 @@ struct IsNotValid {
typedef bool result_type;
struct is_transparent : std::true_type {};
template <typename T>
- Q_DECL_CONSTEXPR bool operator()(T &t) const noexcept(noexcept(t.isValid()))
+ constexpr bool operator()(T &t) const noexcept(noexcept(t.isValid()))
{ return !t.isValid(); }
template <typename T>
- Q_DECL_CONSTEXPR bool operator()(T *t) const noexcept(noexcept(t->isValid()))
+ constexpr bool operator()(T *t) const noexcept(noexcept(t->isValid()))
{ return !t->isValid(); }
};
}
diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h
index 99e09eb31f..180d5fe431 100644
--- a/src/corelib/kernel/qdeadlinetimer.h
+++ b/src/corelib/kernel/qdeadlinetimer.h
@@ -63,16 +63,16 @@ class Q_CORE_EXPORT QDeadlineTimer
public:
enum ForeverConstant { Forever };
- Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) noexcept
+ constexpr QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) noexcept
: t1(0), t2(0), type(type_) {}
- Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) noexcept
+ constexpr QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) noexcept
: t1(std::numeric_limits<qint64>::max()), t2(0), type(type_) {}
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept;
void swap(QDeadlineTimer &other) noexcept
{ qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); }
- Q_DECL_CONSTEXPR bool isForever() const noexcept
+ constexpr bool isForever() const noexcept
{ return t1 == (std::numeric_limits<qint64>::max)(); }
bool hasExpired() const noexcept;
diff --git a/src/corelib/kernel/qelapsedtimer.h b/src/corelib/kernel/qelapsedtimer.h
index 873847f6b6..8d5704859b 100644
--- a/src/corelib/kernel/qelapsedtimer.h
+++ b/src/corelib/kernel/qelapsedtimer.h
@@ -56,7 +56,7 @@ public:
PerformanceCounter
};
- Q_DECL_CONSTEXPR QElapsedTimer()
+ constexpr QElapsedTimer()
: t1(Q_INT64_C(0x8000000000000000)),
t2(Q_INT64_C(0x8000000000000000))
{
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index e7b6ab9c0e..5f36de303c 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -223,38 +223,38 @@ inline qreal qFastCos(qreal x)
return qt_sine_table[si] - (qt_sine_table[ci] + 0.5 * qt_sine_table[si] * d) * d;
}
-Q_DECL_CONSTEXPR inline float qDegreesToRadians(float degrees)
+constexpr inline float qDegreesToRadians(float degrees)
{
return degrees * float(M_PI/180);
}
-Q_DECL_CONSTEXPR inline double qDegreesToRadians(double degrees)
+constexpr inline double qDegreesToRadians(double degrees)
{
return degrees * (M_PI / 180);
}
-Q_DECL_CONSTEXPR inline long double qDegreesToRadians(long double degrees)
+constexpr inline long double qDegreesToRadians(long double degrees)
{
return degrees * (M_PI / 180);
}
template <typename T, std::enable_if_t<std::is_integral_v<T>, bool> = true>
-Q_DECL_CONSTEXPR inline double qDegreesToRadians(T degrees)
+constexpr inline double qDegreesToRadians(T degrees)
{
return qDegreesToRadians(static_cast<double>(degrees));
}
-Q_DECL_CONSTEXPR inline float qRadiansToDegrees(float radians)
+constexpr inline float qRadiansToDegrees(float radians)
{
return radians * float(180/M_PI);
}
-Q_DECL_CONSTEXPR inline double qRadiansToDegrees(double radians)
+constexpr inline double qRadiansToDegrees(double radians)
{
return radians * (180 / M_PI);
}
-Q_DECL_CONSTEXPR inline long double qRadiansToDegrees(long double radians)
+constexpr inline long double qRadiansToDegrees(long double radians)
{
return radians * (180 / M_PI);
}
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 20a5c67586..d013bfce65 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QMetaMethod
{
public:
- Q_DECL_CONSTEXPR inline QMetaMethod() : mobj(nullptr), data({ nullptr }) {}
+ constexpr inline QMetaMethod() : mobj(nullptr), data({ nullptr }) {}
QByteArray methodSignature() const;
QByteArray name() const;
@@ -218,7 +218,7 @@ inline bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2)
class Q_CORE_EXPORT QMetaEnum
{
public:
- Q_DECL_CONSTEXPR inline QMetaEnum() : mobj(nullptr), data({ nullptr }) {}
+ constexpr inline QMetaEnum() : mobj(nullptr), data({ nullptr }) {}
const char *name() const;
const char *enumName() const;
@@ -347,7 +347,7 @@ private:
class Q_CORE_EXPORT QMetaClassInfo
{
public:
- Q_DECL_CONSTEXPR inline QMetaClassInfo() : mobj(nullptr), data({ nullptr }) {}
+ constexpr inline QMetaClassInfo() : mobj(nullptr), data({ nullptr }) {}
const char *name() const;
const char *value() const;
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 88a888c956..527feffa54 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -71,7 +71,7 @@ template <typename T>
struct QMetaTypeId2;
template <typename T>
-inline Q_DECL_CONSTEXPR int qMetaTypeId();
+inline constexpr int qMetaTypeId();
// F is a tuple: (QMetaType::TypeName, QMetaType::TypeNameID, RealType)
// ### Qt6: reorder the types to match the C++ integral type ranking
@@ -1636,7 +1636,7 @@ template <typename T>
struct QMetaTypeId2
{
enum { Defined = QMetaTypeId<T>::Defined, IsBuiltIn=false };
- static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
+ static inline constexpr int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
};
template <typename T>
@@ -1648,11 +1648,11 @@ struct QMetaTypeId2<T&> { enum {Defined = false }; };
namespace QtPrivate {
template <typename T, bool Defined = QMetaTypeId2<T>::Defined>
struct QMetaTypeIdHelper {
- static inline Q_DECL_CONSTEXPR int qt_metatype_id()
+ static inline constexpr int qt_metatype_id()
{ return QMetaTypeId2<T>::qt_metatype_id(); }
};
template <typename T> struct QMetaTypeIdHelper<T, false> {
- static inline Q_DECL_CONSTEXPR int qt_metatype_id()
+ static inline constexpr int qt_metatype_id()
{ return -1; }
};
@@ -1764,7 +1764,7 @@ void qRegisterMetaTypeStreamOperators(const char *typeName
#endif // QT_NO_DATASTREAM
template <typename T>
-inline Q_DECL_CONSTEXPR int qMetaTypeId()
+inline constexpr int qMetaTypeId()
{
if constexpr (bool(QMetaTypeId2<T>::IsBuiltIn)) {
return QMetaTypeId2<T>::MetaType;
@@ -1774,7 +1774,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId()
}
template <typename T>
-inline Q_DECL_CONSTEXPR int qRegisterMetaType()
+inline constexpr int qRegisterMetaType()
{
return qMetaTypeId<T>();
}
@@ -1782,11 +1782,11 @@ inline Q_DECL_CONSTEXPR int qRegisterMetaType()
#if QT_DEPRECATED_SINCE(5, 1) && !defined(Q_CLANG_QDOC)
// There used to be a T *dummy = 0 argument in Qt 4.0 to support MSVC6
template <typename T>
-QT_DEPRECATED inline Q_DECL_CONSTEXPR int qMetaTypeId(T *)
+QT_DEPRECATED inline constexpr int qMetaTypeId(T *)
{ return qMetaTypeId<T>(); }
#ifndef Q_CC_SUN
template <typename T>
-QT_DEPRECATED inline Q_DECL_CONSTEXPR int qRegisterMetaType(T *)
+QT_DEPRECATED inline constexpr int qRegisterMetaType(T *)
{ return qRegisterMetaType<T>(); }
#endif
#endif
@@ -1935,7 +1935,7 @@ inline int qRegisterMetaTypeStreamOperators()
template<> struct QMetaTypeId2<NAME> \
{ \
enum { Defined = 1, IsBuiltIn = true, MetaType = METATYPEID }; \
- static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return METATYPEID; } \
+ static inline constexpr int qt_metatype_id() { return METATYPEID; } \
static constexpr const char * const name = #NAME; \
}; \
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h
index abc2f1efc1..cae04aeaa1 100644
--- a/src/corelib/kernel/qsystemerror_p.h
+++ b/src/corelib/kernel/qsystemerror_p.h
@@ -66,15 +66,15 @@ public:
NativeError
};
- Q_DECL_CONSTEXPR explicit QSystemError(int error, ErrorScope scope)
+ constexpr explicit QSystemError(int error, ErrorScope scope)
: errorCode(error), errorScope(scope)
{
}
- Q_DECL_CONSTEXPR QSystemError() = default;
+ constexpr QSystemError() = default;
QString toString() const { return string(errorScope, errorCode); }
- Q_DECL_CONSTEXPR ErrorScope scope() const { return errorScope; }
- Q_DECL_CONSTEXPR int error() const { return errorCode; }
+ constexpr ErrorScope scope() const { return errorScope; }
+ constexpr int error() const { return errorCode; }
static Q_CORE_EXPORT QString string(ErrorScope errorScope, int errorCode);
static Q_CORE_EXPORT QString stdString(int errorCode = -1);
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index c55fd8d6c3..66df5a7d4d 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -218,7 +218,7 @@ private:
inline int startTimer(int){ return -1;}
inline void killTimer(int){}
- static Q_DECL_CONSTEXPR Qt::TimerType defaultTypeFor(int msecs) noexcept
+ static constexpr Qt::TimerType defaultTypeFor(int msecs) noexcept
{ return msecs >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer; }
static void singleShotImpl(int msec, Qt::TimerType timerType,
const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj);
diff --git a/src/corelib/kernel/qtmetamacros.h b/src/corelib/kernel/qtmetamacros.h
index 0d7b8c0543..8612cc4fc5 100644
--- a/src/corelib/kernel/qtmetamacros.h
+++ b/src/corelib/kernel/qtmetamacros.h
@@ -134,13 +134,13 @@ QT_BEGIN_NAMESPACE
#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x)
#define Q_ENUM_IMPL(ENUM) \
- friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
- friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
+ friend constexpr const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
+ friend constexpr const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
#define Q_ENUM_NS_IMPL(ENUM) \
- inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
- inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
+ inline constexpr const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
+ inline constexpr const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index bdd74f4b77..6acdc95ac6 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -93,9 +93,9 @@ public:
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_CLANG_QDOC)
- Q_DECL_CONSTEXPR QUuid() noexcept : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
+ constexpr QUuid() noexcept : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
- Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
+ constexpr QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept
: data1(l), data2(w1), data3(w2), data4{b1, b2, b3, b4, b5, b6, b7, b8} {}
#else
@@ -136,7 +136,7 @@ public:
static QUuid fromRfc4122(const QByteArray &);
bool isNull() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR bool operator==(const QUuid &orig) const noexcept
+ constexpr bool operator==(const QUuid &orig) const noexcept
{
if (data1 != orig.data1 || data2 != orig.data2 ||
data3 != orig.data3)
@@ -149,7 +149,7 @@ public:
return true;
}
- Q_DECL_RELAXED_CONSTEXPR bool operator!=(const QUuid &orig) const noexcept
+ constexpr bool operator!=(const QUuid &orig) const noexcept
{
return !(*this == orig);
}
@@ -161,7 +161,7 @@ public:
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_CLANG_QDOC)
- Q_DECL_CONSTEXPR QUuid(const GUID &guid) noexcept
+ constexpr QUuid(const GUID &guid) noexcept
: data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]} {}
@@ -176,24 +176,24 @@ public:
}
#endif
- Q_DECL_RELAXED_CONSTEXPR QUuid &operator=(const GUID &guid) noexcept
+ constexpr QUuid &operator=(const GUID &guid) noexcept
{
*this = QUuid(guid);
return *this;
}
- Q_DECL_RELAXED_CONSTEXPR operator GUID() const noexcept
+ constexpr operator GUID() const noexcept
{
GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } };
return guid;
}
- Q_DECL_RELAXED_CONSTEXPR bool operator==(const GUID &guid) const noexcept
+ constexpr bool operator==(const GUID &guid) const noexcept
{
return *this == QUuid(guid);
}
- Q_DECL_RELAXED_CONSTEXPR bool operator!=(const GUID &guid) const noexcept
+ constexpr bool operator!=(const GUID &guid) const noexcept
{
return !(*this == guid);
}
diff --git a/src/corelib/serialization/qcborarray.h b/src/corelib/serialization/qcborarray.h
index 4ad8100bfe..ba7f4dc80d 100644
--- a/src/corelib/serialization/qcborarray.h
+++ b/src/corelib/serialization/qcborarray.h
@@ -68,8 +68,8 @@ public:
typedef QCborValueRef reference;
typedef QCborValueRef *pointer;
- Q_DECL_CONSTEXPR Iterator() = default;
- Q_DECL_CONSTEXPR Iterator(const Iterator &) = default;
+ constexpr Iterator() = default;
+ constexpr Iterator(const Iterator &) = default;
Iterator &operator=(const Iterator &other)
{
// rebind the reference
@@ -117,8 +117,8 @@ public:
typedef const QCborValueRef reference;
typedef const QCborValueRef *pointer;
- Q_DECL_CONSTEXPR ConstIterator() = default;
- Q_DECL_CONSTEXPR ConstIterator(const ConstIterator &) = default;
+ constexpr ConstIterator() = default;
+ constexpr ConstIterator(const ConstIterator &) = default;
ConstIterator &operator=(const ConstIterator &other)
{
// rebind the reference
diff --git a/src/corelib/serialization/qcbormap.h b/src/corelib/serialization/qcbormap.h
index cd1824f8e7..4c0a31c834 100644
--- a/src/corelib/serialization/qcbormap.h
+++ b/src/corelib/serialization/qcbormap.h
@@ -78,8 +78,8 @@ public:
typedef QPair<const QCborValueRef, QCborValueRef> reference;
typedef QPair<const QCborValueRef, QCborValueRef> pointer;
- Q_DECL_CONSTEXPR Iterator() = default;
- Q_DECL_CONSTEXPR Iterator(const Iterator &) = default;
+ constexpr Iterator() = default;
+ constexpr Iterator(const Iterator &) = default;
Iterator &operator=(const Iterator &other)
{
// rebind the reference
@@ -130,8 +130,8 @@ public:
typedef QPair<const QCborValueRef, const QCborValueRef> reference;
typedef QPair<const QCborValueRef, const QCborValueRef> pointer;
- Q_DECL_CONSTEXPR ConstIterator() = default;
- Q_DECL_CONSTEXPR ConstIterator(const ConstIterator &) = default;
+ constexpr ConstIterator() = default;
+ constexpr ConstIterator(const ConstIterator &) = default;
ConstIterator &operator=(const ConstIterator &other)
{
// rebind the reference
diff --git a/src/corelib/serialization/qcborstreamwriter.cpp b/src/corelib/serialization/qcborstreamwriter.cpp
index 4d6f323e9a..51d4fefb6b 100644
--- a/src/corelib/serialization/qcborstreamwriter.cpp
+++ b/src/corelib/serialization/qcborstreamwriter.cpp
@@ -217,7 +217,7 @@ Q_DECLARE_TYPEINFO(CborEncoder, Q_PRIMITIVE_TYPE);
class QCborStreamWriterPrivate
{
public:
- static Q_CONSTEXPR quint64 IndefiniteLength = (std::numeric_limits<quint64>::max)();
+ static constexpr quint64 IndefiniteLength = (std::numeric_limits<quint64>::max)();
QIODevice *device;
CborEncoder encoder;
diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h
index b8c3dce294..839fd66211 100644
--- a/src/corelib/serialization/qcborvalue.h
+++ b/src/corelib/serialization/qcborvalue.h
@@ -325,12 +325,12 @@ private:
return d;
}
- Q_DECL_CONSTEXPR static Type type_helper(QCborSimpleType st)
+ constexpr static Type type_helper(QCborSimpleType st)
{
return Type(quint8(st) | SimpleType);
}
- Q_DECL_CONSTEXPR static bool isTag_helper(Type tt)
+ constexpr static bool isTag_helper(Type tt)
{
return tt == Tag || tt >= 0x10000;
}
@@ -470,7 +470,7 @@ private:
QCborValue::Type concreteType() const noexcept { return concreteType(*this); }
// this will actually be invalid...
- Q_DECL_CONSTEXPR QCborValueRef() : d(nullptr), i(0) {}
+ constexpr QCborValueRef() : d(nullptr), i(0) {}
QCborValueRef(QCborContainerPrivate *dd, qsizetype ii)
: d(dd), i(ii)
diff --git a/src/corelib/serialization/qtextstream.h b/src/corelib/serialization/qtextstream.h
index 1d13ed896c..a3526c84fc 100644
--- a/src/corelib/serialization/qtextstream.h
+++ b/src/corelib/serialization/qtextstream.h
@@ -206,8 +206,8 @@ typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument
class Q_CORE_EXPORT QTextStreamManipulator
{
public:
- Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) noexcept : mf(m), mc(nullptr), arg(a), ch() {}
- Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) noexcept : mf(nullptr), mc(m), arg(-1), ch(c) {}
+ constexpr QTextStreamManipulator(QTSMFI m, int a) noexcept : mf(m), mc(nullptr), arg(a), ch() {}
+ constexpr QTextStreamManipulator(QTSMFC m, QChar c) noexcept : mf(nullptr), mc(m), arg(-1), ch(c) {}
void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } }
private:
diff --git a/src/corelib/text/qbytearraymatcher.h b/src/corelib/text/qbytearraymatcher.h
index e847d3a6dc..876225230b 100644
--- a/src/corelib/text/qbytearraymatcher.h
+++ b/src/corelib/text/qbytearraymatcher.h
@@ -90,7 +90,7 @@ class QStaticByteArrayMatcherBase
uchar data[256];
} m_skiptable;
protected:
- explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcherBase(const char *pattern, uint n) noexcept
+ explicit constexpr QStaticByteArrayMatcherBase(const char *pattern, uint n) noexcept
: m_skiptable(generate(pattern, n)) {}
// compiler-generated copy/more ctors/assignment operators are ok!
// compiler-generated dtor is ok!
@@ -98,7 +98,7 @@ protected:
Q_CORE_EXPORT int indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const noexcept;
private:
- static Q_DECL_RELAXED_CONSTEXPR Skiptable generate(const char *pattern, uint n) noexcept
+ static constexpr Skiptable generate(const char *pattern, uint n) noexcept
{
const auto uchar_max = (std::numeric_limits<uchar>::max)();
uchar max = n > uchar_max ? uchar_max : uchar(n);
@@ -140,7 +140,7 @@ class QStaticByteArrayMatcher : QStaticByteArrayMatcherBase
char m_pattern[N];
static_assert(N > 2, "QStaticByteArrayMatcher makes no sense for finding a single-char pattern");
public:
- explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher(const char (&patternToMatch)[N]) noexcept
+ explicit constexpr QStaticByteArrayMatcher(const char (&patternToMatch)[N]) noexcept
: QStaticByteArrayMatcherBase(patternToMatch, N - 1), m_pattern()
{
for (uint i = 0; i < N; ++i)
@@ -156,7 +156,7 @@ public:
};
template <uint N>
-Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher<N> qMakeStaticByteArrayMatcher(const char (&pattern)[N]) noexcept
+constexpr QStaticByteArrayMatcher<N> qMakeStaticByteArrayMatcher(const char (&pattern)[N]) noexcept
{ return QStaticByteArrayMatcher<N>(pattern); }
QT_END_NAMESPACE
diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h
index 4366c37ed2..81db7029de 100644
--- a/src/corelib/text/qbytearrayview.h
+++ b/src/corelib/text/qbytearrayview.h
@@ -156,7 +156,7 @@ private:
template <typename Byte>
static const storage_type *castHelper(const Byte *data) noexcept
{ return reinterpret_cast<const storage_type*>(data); }
- static Q_DECL_CONSTEXPR const storage_type *castHelper(const storage_type *data) noexcept
+ static constexpr const storage_type *castHelper(const storage_type *data) noexcept
{ return data; }
public:
diff --git a/src/corelib/text/qchar.h b/src/corelib/text/qchar.h
index 8c6b2685aa..c3fe6d3107 100644
--- a/src/corelib/text/qchar.h
+++ b/src/corelib/text/qchar.h
@@ -52,27 +52,27 @@ class QString;
struct QLatin1Char
{
public:
- Q_DECL_CONSTEXPR inline explicit QLatin1Char(char c) noexcept : ch(c) {}
- Q_DECL_CONSTEXPR inline char toLatin1() const noexcept { return ch; }
- Q_DECL_CONSTEXPR inline char16_t unicode() const noexcept { return char16_t(uchar(ch)); }
+ constexpr inline explicit QLatin1Char(char c) noexcept : ch(c) {}
+ constexpr inline char toLatin1() const noexcept { return ch; }
+ constexpr inline char16_t unicode() const noexcept { return char16_t(uchar(ch)); }
private:
char ch;
};
-Q_DECL_CONSTEXPR inline bool operator==(char lhs, QLatin1Char rhs) noexcept { return lhs == rhs.toLatin1(); }
-Q_DECL_CONSTEXPR inline bool operator!=(char lhs, QLatin1Char rhs) noexcept { return lhs != rhs.toLatin1(); }
-Q_DECL_CONSTEXPR inline bool operator<=(char lhs, QLatin1Char rhs) noexcept { return lhs <= rhs.toLatin1(); }
-Q_DECL_CONSTEXPR inline bool operator>=(char lhs, QLatin1Char rhs) noexcept { return lhs >= rhs.toLatin1(); }
-Q_DECL_CONSTEXPR inline bool operator< (char lhs, QLatin1Char rhs) noexcept { return lhs < rhs.toLatin1(); }
-Q_DECL_CONSTEXPR inline bool operator> (char lhs, QLatin1Char rhs) noexcept { return lhs > rhs.toLatin1(); }
+constexpr inline bool operator==(char lhs, QLatin1Char rhs) noexcept { return lhs == rhs.toLatin1(); }
+constexpr inline bool operator!=(char lhs, QLatin1Char rhs) noexcept { return lhs != rhs.toLatin1(); }
+constexpr inline bool operator<=(char lhs, QLatin1Char rhs) noexcept { return lhs <= rhs.toLatin1(); }
+constexpr inline bool operator>=(char lhs, QLatin1Char rhs) noexcept { return lhs >= rhs.toLatin1(); }
+constexpr inline bool operator< (char lhs, QLatin1Char rhs) noexcept { return lhs < rhs.toLatin1(); }
+constexpr inline bool operator> (char lhs, QLatin1Char rhs) noexcept { return lhs > rhs.toLatin1(); }
-Q_DECL_CONSTEXPR inline bool operator==(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() == rhs; }
-Q_DECL_CONSTEXPR inline bool operator!=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() != rhs; }
-Q_DECL_CONSTEXPR inline bool operator<=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() <= rhs; }
-Q_DECL_CONSTEXPR inline bool operator>=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() >= rhs; }
-Q_DECL_CONSTEXPR inline bool operator< (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() < rhs; }
-Q_DECL_CONSTEXPR inline bool operator> (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() > rhs; }
+constexpr inline bool operator==(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() == rhs; }
+constexpr inline bool operator!=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() != rhs; }
+constexpr inline bool operator<=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() <= rhs; }
+constexpr inline bool operator>=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() >= rhs; }
+constexpr inline bool operator< (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() < rhs; }
+constexpr inline bool operator> (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() > rhs; }
class Q_CORE_EXPORT QChar {
public:
@@ -94,30 +94,30 @@ public:
LastValidCodePoint = 0x10ffff
};
- Q_DECL_CONSTEXPR QChar() noexcept : ucs(0) {}
- Q_DECL_CONSTEXPR QChar(ushort rc) noexcept : ucs(rc) {}
- Q_DECL_CONSTEXPR QChar(uchar c, uchar r) noexcept : ucs(char16_t((r << 8) | c)) {}
- Q_DECL_CONSTEXPR QChar(short rc) noexcept : ucs(char16_t(rc)) {}
- Q_DECL_CONSTEXPR QChar(uint rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
- Q_DECL_CONSTEXPR QChar(int rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
- Q_DECL_CONSTEXPR QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {} // implicit
- Q_DECL_CONSTEXPR QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit
+ constexpr QChar() noexcept : ucs(0) {}
+ constexpr QChar(ushort rc) noexcept : ucs(rc) {}
+ constexpr QChar(uchar c, uchar r) noexcept : ucs(char16_t((r << 8) | c)) {}
+ constexpr QChar(short rc) noexcept : ucs(char16_t(rc)) {}
+ constexpr QChar(uint rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
+ constexpr QChar(int rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
+ constexpr QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {} // implicit
+ constexpr QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit
#if defined(Q_COMPILER_UNICODE_STRINGS)
- Q_DECL_CONSTEXPR QChar(char16_t ch) noexcept : ucs(ch) {} // implicit
+ constexpr QChar(char16_t ch) noexcept : ucs(ch) {} // implicit
#endif
#if defined(Q_OS_WIN)
static_assert(sizeof(wchar_t) == sizeof(char16_t));
#endif
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
# if !defined(_WCHAR_T_DEFINED) || defined(_NATIVE_WCHAR_T_DEFINED)
- Q_DECL_CONSTEXPR QChar(wchar_t ch) noexcept : ucs(char16_t(ch)) {} // implicit
+ constexpr QChar(wchar_t ch) noexcept : ucs(char16_t(ch)) {} // implicit
# endif
#endif
#ifndef QT_NO_CAST_FROM_ASCII
- QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR QChar(char c) noexcept : ucs(uchar(c)) { }
+ QT_ASCII_CAST_WARN constexpr QChar(char c) noexcept : ucs(uchar(c)) { }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
- QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR QChar(uchar c) noexcept : ucs(c) { }
+ QT_ASCII_CAST_WARN constexpr QChar(uchar c) noexcept : ucs(c) { }
#endif
#endif
@@ -467,70 +467,70 @@ public:
inline UnicodeVersion unicodeVersion() const noexcept { return QChar::unicodeVersion(ucs); }
- Q_DECL_CONSTEXPR inline char toLatin1() const noexcept { return ucs > 0xff ? '\0' : char(ucs); }
- Q_DECL_CONSTEXPR inline char16_t unicode() const noexcept { return ucs; }
- Q_DECL_RELAXED_CONSTEXPR inline char16_t &unicode() noexcept { return ucs; }
+ constexpr inline char toLatin1() const noexcept { return ucs > 0xff ? '\0' : char(ucs); }
+ constexpr inline char16_t unicode() const noexcept { return ucs; }
+ constexpr inline char16_t &unicode() noexcept { return ucs; }
- static Q_DECL_CONSTEXPR QChar fromLatin1(char c) noexcept { return QLatin1Char(c); }
+ static constexpr QChar fromLatin1(char c) noexcept { return QLatin1Char(c); }
- Q_DECL_CONSTEXPR inline bool isNull() const noexcept { return ucs == 0; }
+ constexpr inline bool isNull() const noexcept { return ucs == 0; }
inline bool isPrint() const noexcept { return QChar::isPrint(ucs); }
- Q_DECL_CONSTEXPR inline bool isSpace() const noexcept { return QChar::isSpace(ucs); }
+ constexpr inline bool isSpace() const noexcept { return QChar::isSpace(ucs); }
inline bool isMark() const noexcept { return QChar::isMark(ucs); }
inline bool isPunct() const noexcept { return QChar::isPunct(ucs); }
inline bool isSymbol() const noexcept { return QChar::isSymbol(ucs); }
- Q_DECL_CONSTEXPR inline bool isLetter() const noexcept { return QChar::isLetter(ucs); }
- Q_DECL_CONSTEXPR inline bool isNumber() const noexcept { return QChar::isNumber(ucs); }
- Q_DECL_CONSTEXPR inline bool isLetterOrNumber() const noexcept { return QChar::isLetterOrNumber(ucs); }
- Q_DECL_CONSTEXPR inline bool isDigit() const noexcept { return QChar::isDigit(ucs); }
- Q_DECL_CONSTEXPR inline bool isLower() const noexcept { return QChar::isLower(ucs); }
- Q_DECL_CONSTEXPR inline bool isUpper() const noexcept { return QChar::isUpper(ucs); }
- Q_DECL_CONSTEXPR inline bool isTitleCase() const noexcept { return QChar::isTitleCase(ucs); }
-
- Q_DECL_CONSTEXPR inline bool isNonCharacter() const noexcept { return QChar::isNonCharacter(ucs); }
- Q_DECL_CONSTEXPR inline bool isHighSurrogate() const noexcept { return QChar::isHighSurrogate(ucs); }
- Q_DECL_CONSTEXPR inline bool isLowSurrogate() const noexcept { return QChar::isLowSurrogate(ucs); }
- Q_DECL_CONSTEXPR inline bool isSurrogate() const noexcept { return QChar::isSurrogate(ucs); }
-
- Q_DECL_CONSTEXPR inline uchar cell() const noexcept { return uchar(ucs & 0xff); }
- Q_DECL_CONSTEXPR inline uchar row() const noexcept { return uchar((ucs>>8)&0xff); }
- Q_DECL_RELAXED_CONSTEXPR inline void setCell(uchar acell) noexcept { ucs = char16_t((ucs & 0xff00) + acell); }
- Q_DECL_RELAXED_CONSTEXPR inline void setRow(uchar arow) noexcept { ucs = char16_t((char16_t(arow)<<8) + (ucs&0xff)); }
-
- static Q_DECL_CONSTEXPR inline bool isNonCharacter(char32_t ucs4) noexcept
+ constexpr inline bool isLetter() const noexcept { return QChar::isLetter(ucs); }
+ constexpr inline bool isNumber() const noexcept { return QChar::isNumber(ucs); }
+ constexpr inline bool isLetterOrNumber() const noexcept { return QChar::isLetterOrNumber(ucs); }
+ constexpr inline bool isDigit() const noexcept { return QChar::isDigit(ucs); }
+ constexpr inline bool isLower() const noexcept { return QChar::isLower(ucs); }
+ constexpr inline bool isUpper() const noexcept { return QChar::isUpper(ucs); }
+ constexpr inline bool isTitleCase() const noexcept { return QChar::isTitleCase(ucs); }
+
+ constexpr inline bool isNonCharacter() const noexcept { return QChar::isNonCharacter(ucs); }
+ constexpr inline bool isHighSurrogate() const noexcept { return QChar::isHighSurrogate(ucs); }
+ constexpr inline bool isLowSurrogate() const noexcept { return QChar::isLowSurrogate(ucs); }
+ constexpr inline bool isSurrogate() const noexcept { return QChar::isSurrogate(ucs); }
+
+ constexpr inline uchar cell() const noexcept { return uchar(ucs & 0xff); }
+ constexpr inline uchar row() const noexcept { return uchar((ucs>>8)&0xff); }
+ constexpr inline void setCell(uchar acell) noexcept { ucs = char16_t((ucs & 0xff00) + acell); }
+ constexpr inline void setRow(uchar arow) noexcept { ucs = char16_t((char16_t(arow)<<8) + (ucs&0xff)); }
+
+ static constexpr inline bool isNonCharacter(char32_t ucs4) noexcept
{
return ucs4 >= 0xfdd0 && (ucs4 <= 0xfdef || (ucs4 & 0xfffe) == 0xfffe);
}
- static Q_DECL_CONSTEXPR inline bool isHighSurrogate(char32_t ucs4) noexcept
+ static constexpr inline bool isHighSurrogate(char32_t ucs4) noexcept
{
return ((ucs4 & 0xfffffc00) == 0xd800);
}
- static Q_DECL_CONSTEXPR inline bool isLowSurrogate(char32_t ucs4) noexcept
+ static constexpr inline bool isLowSurrogate(char32_t ucs4) noexcept
{
return ((ucs4 & 0xfffffc00) == 0xdc00);
}
- static Q_DECL_CONSTEXPR inline bool isSurrogate(char32_t ucs4) noexcept
+ static constexpr inline bool isSurrogate(char32_t ucs4) noexcept
{
return (ucs4 - 0xd800u < 2048u);
}
- static Q_DECL_CONSTEXPR inline bool requiresSurrogates(char32_t ucs4) noexcept
+ static constexpr inline bool requiresSurrogates(char32_t ucs4) noexcept
{
return (ucs4 >= 0x10000);
}
- static Q_DECL_CONSTEXPR inline char32_t surrogateToUcs4(char16_t high, char16_t low) noexcept
+ static constexpr inline char32_t surrogateToUcs4(char16_t high, char16_t low) noexcept
{
return (char32_t(high)<<10) + low - 0x35fdc00;
}
- static Q_DECL_CONSTEXPR inline char32_t surrogateToUcs4(QChar high, QChar low) noexcept
+ static constexpr inline char32_t surrogateToUcs4(QChar high, QChar low) noexcept
{
return surrogateToUcs4(high.ucs, low.ucs);
}
- static Q_DECL_CONSTEXPR inline char16_t highSurrogate(char32_t ucs4) noexcept
+ static constexpr inline char16_t highSurrogate(char32_t ucs4) noexcept
{
return char16_t((ucs4>>10) + 0xd7c0);
}
- static Q_DECL_CONSTEXPR inline char16_t lowSurrogate(char32_t ucs4) noexcept
+ static constexpr inline char16_t lowSurrogate(char32_t ucs4) noexcept
{
return char16_t(ucs4%0x400 + 0xdc00);
}
@@ -559,7 +559,7 @@ public:
static UnicodeVersion QT_FASTCALL currentUnicodeVersion() noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isPrint(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION;
- static Q_DECL_CONSTEXPR inline bool isSpace(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isSpace(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{
// note that [0x09..0x0d] + 0x85 are exceptional Cc-s and must be handled explicitly
return ucs4 == 0x20 || (ucs4 <= 0x0d && ucs4 >= 0x09)
@@ -568,26 +568,26 @@ public:
static bool QT_FASTCALL isMark(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isPunct(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isSymbol(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION;
- static Q_DECL_CONSTEXPR inline bool isLetter(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isLetter(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{
return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z'))
|| (ucs4 > 127 && QChar::isLetter_helper(ucs4));
}
- static Q_DECL_CONSTEXPR inline bool isNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::isNumber_helper(ucs4)); }
- static Q_DECL_CONSTEXPR inline bool isLetterOrNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isLetterOrNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{
return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z'))
|| (ucs4 >= '0' && ucs4 <= '9')
|| (ucs4 > 127 && QChar::isLetterOrNumber_helper(ucs4));
}
- static Q_DECL_CONSTEXPR inline bool isDigit(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isDigit(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::category(ucs4) == Number_DecimalDigit); }
- static Q_DECL_CONSTEXPR inline bool isLower(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isLower(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= 'z' && ucs4 >= 'a') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Lowercase); }
- static Q_DECL_CONSTEXPR inline bool isUpper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isUpper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= 'Z' && ucs4 >= 'A') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Uppercase); }
- static Q_DECL_CONSTEXPR inline bool isTitleCase(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr inline bool isTitleCase(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return ucs4 > 127 && QChar::category(ucs4) == Letter_Titlecase; }
private:
@@ -601,36 +601,36 @@ private:
QChar(uchar c) noexcept;
#endif
- friend Q_DECL_CONSTEXPR bool operator==(QChar, QChar) noexcept;
- friend Q_DECL_CONSTEXPR bool operator< (QChar, QChar) noexcept;
+ friend constexpr bool operator==(QChar, QChar) noexcept;
+ friend constexpr bool operator< (QChar, QChar) noexcept;
char16_t ucs;
};
Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE);
-Q_DECL_CONSTEXPR inline bool operator==(QChar c1, QChar c2) noexcept { return c1.ucs == c2.ucs; }
-Q_DECL_CONSTEXPR inline bool operator< (QChar c1, QChar c2) noexcept { return c1.ucs < c2.ucs; }
+constexpr inline bool operator==(QChar c1, QChar c2) noexcept { return c1.ucs == c2.ucs; }
+constexpr inline bool operator< (QChar c1, QChar c2) noexcept { return c1.ucs < c2.ucs; }
-Q_DECL_CONSTEXPR inline bool operator!=(QChar c1, QChar c2) noexcept { return !operator==(c1, c2); }
-Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) noexcept { return !operator< (c1, c2); }
-Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) noexcept { return operator< (c2, c1); }
-Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) noexcept { return !operator< (c2, c1); }
+constexpr inline bool operator!=(QChar c1, QChar c2) noexcept { return !operator==(c1, c2); }
+constexpr inline bool operator>=(QChar c1, QChar c2) noexcept { return !operator< (c1, c2); }
+constexpr inline bool operator> (QChar c1, QChar c2) noexcept { return operator< (c2, c1); }
+constexpr inline bool operator<=(QChar c1, QChar c2) noexcept { return !operator< (c2, c1); }
-Q_DECL_CONSTEXPR inline bool operator==(QChar lhs, std::nullptr_t) noexcept { return lhs.isNull(); }
-Q_DECL_CONSTEXPR inline bool operator< (QChar, std::nullptr_t) noexcept { return false; }
-Q_DECL_CONSTEXPR inline bool operator==(std::nullptr_t, QChar rhs) noexcept { return rhs.isNull(); }
-Q_DECL_CONSTEXPR inline bool operator< (std::nullptr_t, QChar rhs) noexcept { return !rhs.isNull(); }
+constexpr inline bool operator==(QChar lhs, std::nullptr_t) noexcept { return lhs.isNull(); }
+constexpr inline bool operator< (QChar, std::nullptr_t) noexcept { return false; }
+constexpr inline bool operator==(std::nullptr_t, QChar rhs) noexcept { return rhs.isNull(); }
+constexpr inline bool operator< (std::nullptr_t, QChar rhs) noexcept { return !rhs.isNull(); }
-Q_DECL_CONSTEXPR inline bool operator!=(QChar lhs, std::nullptr_t) noexcept { return !operator==(lhs, nullptr); }
-Q_DECL_CONSTEXPR inline bool operator>=(QChar lhs, std::nullptr_t) noexcept { return !operator< (lhs, nullptr); }
-Q_DECL_CONSTEXPR inline bool operator> (QChar lhs, std::nullptr_t) noexcept { return operator< (nullptr, lhs); }
-Q_DECL_CONSTEXPR inline bool operator<=(QChar lhs, std::nullptr_t) noexcept { return !operator< (nullptr, lhs); }
+constexpr inline bool operator!=(QChar lhs, std::nullptr_t) noexcept { return !operator==(lhs, nullptr); }
+constexpr inline bool operator>=(QChar lhs, std::nullptr_t) noexcept { return !operator< (lhs, nullptr); }
+constexpr inline bool operator> (QChar lhs, std::nullptr_t) noexcept { return operator< (nullptr, lhs); }
+constexpr inline bool operator<=(QChar lhs, std::nullptr_t) noexcept { return !operator< (nullptr, lhs); }
-Q_DECL_CONSTEXPR inline bool operator!=(std::nullptr_t, QChar rhs) noexcept { return !operator==(nullptr, rhs); }
-Q_DECL_CONSTEXPR inline bool operator>=(std::nullptr_t, QChar rhs) noexcept { return !operator< (nullptr, rhs); }
-Q_DECL_CONSTEXPR inline bool operator> (std::nullptr_t, QChar rhs) noexcept { return operator< (rhs, nullptr); }
-Q_DECL_CONSTEXPR inline bool operator<=(std::nullptr_t, QChar rhs) noexcept { return !operator< (rhs, nullptr); }
+constexpr inline bool operator!=(std::nullptr_t, QChar rhs) noexcept { return !operator==(nullptr, rhs); }
+constexpr inline bool operator>=(std::nullptr_t, QChar rhs) noexcept { return !operator< (nullptr, rhs); }
+constexpr inline bool operator> (std::nullptr_t, QChar rhs) noexcept { return operator< (rhs, nullptr); }
+constexpr inline bool operator<=(std::nullptr_t, QChar rhs) noexcept { return !operator< (rhs, nullptr); }
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QChar);
diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h
index fa61438041..df6aba30ce 100644
--- a/src/corelib/text/qlocale_p.h
+++ b/src/corelib/text/qlocale_p.h
@@ -494,7 +494,7 @@ enum { AsciiSpaceMask = (1u << (' ' - 1)) |
(1u << ('\v' - 1)) | // 11: VT - vertical tab
(1u << ('\f' - 1)) | // 12: FF - form feed
(1u << ('\r' - 1)) }; // 13: CR - carriage return
-Q_DECL_CONSTEXPR inline bool ascii_isspace(uchar c)
+constexpr inline bool ascii_isspace(uchar c)
{
return c >= 1u && c <= 32u && (AsciiSpaceMask >> uint(c - 1)) & 1u;
}
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 773688d783..6f8d2c87f5 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -588,7 +588,7 @@ bool QtPrivate::isLatin1(QStringView s) noexcept
bool QtPrivate::isValidUtf16(QStringView s) noexcept
{
- Q_CONSTEXPR char32_t InvalidCodePoint = UINT_MAX;
+ constexpr char32_t InvalidCodePoint = UINT_MAX;
QStringIterator i(s);
while (i.hasNext()) {
@@ -1187,7 +1187,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, size_t l)
}
template <typename Number>
-Q_DECL_CONSTEXPR int lencmp(Number lhs, Number rhs) noexcept
+constexpr int lencmp(Number lhs, Number rhs) noexcept
{
return lhs == rhs ? 0 :
lhs > rhs ? 1 :
@@ -8245,9 +8245,9 @@ namespace {
struct Part
{
Part() = default; // for QVarLengthArray; do not use
- Q_DECL_CONSTEXPR Part(QStringView s, int num = -1)
+ constexpr Part(QStringView s, int num = -1)
: tag{QtPrivate::ArgBase::U16}, number{num}, data{s.utf16()}, size{s.size()} {}
- Q_DECL_CONSTEXPR Part(QLatin1String s, int num = -1)
+ constexpr Part(QLatin1String s, int num = -1)
: tag{QtPrivate::ArgBase::L1}, number{num}, data{s.data()}, size{s.size()} {}
void reset(QStringView s) noexcept { *this = {s, number}; }
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index ba21aba618..6ad24b2b5f 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -85,37 +85,37 @@ template <bool...B> class BoolList;
class QLatin1String
{
public:
- Q_DECL_CONSTEXPR inline QLatin1String() noexcept : m_size(0), m_data(nullptr) {}
- Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) noexcept : m_size(s ? int(strlen(s)) : 0), m_data(s) {}
- Q_DECL_CONSTEXPR explicit QLatin1String(const char *f, const char *l)
+ constexpr inline QLatin1String() noexcept : m_size(0), m_data(nullptr) {}
+ constexpr inline explicit QLatin1String(const char *s) noexcept : m_size(s ? int(strlen(s)) : 0), m_data(s) {}
+ constexpr explicit QLatin1String(const char *f, const char *l)
: QLatin1String(f, int(l - f)) {}
- Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) noexcept : m_size(sz), m_data(s) {}
+ constexpr inline explicit QLatin1String(const char *s, int sz) noexcept : m_size(sz), m_data(s) {}
inline explicit QLatin1String(const QByteArray &s) noexcept : m_size(int(qstrnlen(s.constData(), s.size()))), m_data(s.constData()) {}
inline QString toString() const;
- Q_DECL_CONSTEXPR const char *latin1() const noexcept { return m_data; }
- Q_DECL_CONSTEXPR int size() const noexcept { return m_size; }
- Q_DECL_CONSTEXPR const char *data() const noexcept { return m_data; }
+ constexpr const char *latin1() const noexcept { return m_data; }
+ constexpr int size() const noexcept { return m_size; }
+ constexpr const char *data() const noexcept { return m_data; }
- Q_DECL_CONSTEXPR bool isNull() const noexcept { return !data(); }
- Q_DECL_CONSTEXPR bool isEmpty() const noexcept { return !size(); }
+ constexpr bool isNull() const noexcept { return !data(); }
+ constexpr bool isEmpty() const noexcept { return !size(); }
template <typename...Args>
Q_REQUIRED_RESULT inline QString arg(Args &&...args) const;
- Q_DECL_CONSTEXPR QLatin1Char at(int i) const
+ constexpr QLatin1Char at(int i) const
{ return Q_ASSERT(i >= 0), Q_ASSERT(i < size()), QLatin1Char(m_data[i]); }
- Q_DECL_CONSTEXPR QLatin1Char operator[](int i) const { return at(i); }
+ constexpr QLatin1Char operator[](int i) const { return at(i); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QLatin1Char front() const { return at(0); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QLatin1Char back() const { return at(size() - 1); }
+ Q_REQUIRED_RESULT constexpr QLatin1Char front() const { return at(0); }
+ Q_REQUIRED_RESULT constexpr QLatin1Char back() const { return at(size() - 1); }
Q_REQUIRED_RESULT int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::compareStrings(*this, other, cs); }
Q_REQUIRED_RESULT int compare(QLatin1String other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::compareStrings(*this, other, cs); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR int compare(QChar c) const noexcept
+ Q_REQUIRED_RESULT constexpr int compare(QChar c) const noexcept
{ return isEmpty() || front() == c ? size() - 1 : uchar(m_data[0]) - c.unicode() ; }
Q_REQUIRED_RESULT int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
{ return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); }
@@ -124,7 +124,7 @@ public:
{ return QtPrivate::startsWith(*this, s, cs); }
Q_REQUIRED_RESULT bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::startsWith(*this, s, cs); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool startsWith(QChar c) const noexcept
+ Q_REQUIRED_RESULT constexpr bool startsWith(QChar c) const noexcept
{ return !isEmpty() && front() == c; }
Q_REQUIRED_RESULT inline bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
{ return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); }
@@ -133,7 +133,7 @@ public:
{ return QtPrivate::endsWith(*this, s, cs); }
Q_REQUIRED_RESULT bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::endsWith(*this, s, cs); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool endsWith(QChar c) const noexcept
+ Q_REQUIRED_RESULT constexpr bool endsWith(QChar c) const noexcept
{ return !isEmpty() && back() == c; }
Q_REQUIRED_RESULT inline bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
{ return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); }
@@ -167,10 +167,10 @@ public:
using difference_type = int; // violates Container concept requirements
using size_type = int; // violates Container concept requirements
- Q_DECL_CONSTEXPR const_iterator begin() const noexcept { return data(); }
- Q_DECL_CONSTEXPR const_iterator cbegin() const noexcept { return data(); }
- Q_DECL_CONSTEXPR const_iterator end() const noexcept { return data() + size(); }
- Q_DECL_CONSTEXPR const_iterator cend() const noexcept { return data() + size(); }
+ constexpr const_iterator begin() const noexcept { return data(); }
+ constexpr const_iterator cbegin() const noexcept { return data(); }
+ constexpr const_iterator end() const noexcept { return data() + size(); }
+ constexpr const_iterator cend() const noexcept { return data() + size(); }
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = reverse_iterator;
@@ -200,12 +200,12 @@ public:
n = size();
return QLatin1String(m_data + m_size - n, n);
}
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QLatin1String chopped(int n) const
+ Q_REQUIRED_RESULT constexpr QLatin1String chopped(int n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QLatin1String(m_data, m_size - n); }
- Q_DECL_RELAXED_CONSTEXPR void chop(int n)
+ constexpr void chop(int n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size -= n; }
- Q_DECL_RELAXED_CONSTEXPR void truncate(int n)
+ constexpr void truncate(int n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size = n; }
Q_REQUIRED_RESULT QLatin1String trimmed() const noexcept { return QtPrivate::trimmed(*this); }
@@ -250,7 +250,7 @@ Q_DECLARE_TYPEINFO(QLatin1String, Q_MOVABLE_TYPE);
//
// QLatin1String inline implementations
//
-Q_DECL_CONSTEXPR bool QtPrivate::isLatin1(QLatin1String) noexcept
+constexpr bool QtPrivate::isLatin1(QLatin1String) noexcept
{ return true; }
//
@@ -1796,13 +1796,13 @@ struct ArgBase {
struct QStringViewArg : ArgBase {
QStringView string;
QStringViewArg() = default;
- Q_DECL_CONSTEXPR explicit QStringViewArg(QStringView v) noexcept : ArgBase{U16}, string{v} {}
+ constexpr explicit QStringViewArg(QStringView v) noexcept : ArgBase{U16}, string{v} {}
};
struct QLatin1StringArg : ArgBase {
QLatin1String string;
QLatin1StringArg() = default;
- Q_DECL_CONSTEXPR explicit QLatin1StringArg(QLatin1String v) noexcept : ArgBase{L1}, string{v} {}
+ constexpr explicit QLatin1StringArg(QLatin1String v) noexcept : ArgBase{L1}, string{v} {}
};
Q_REQUIRED_RESULT Q_CORE_EXPORT QString argToQString(QStringView pattern, size_t n, const ArgBase **args);
@@ -1815,10 +1815,10 @@ Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString argToQStringDispatch(StringView patter
return QtPrivate::argToQString(pattern, sizeof...(Args), argBases);
}
- inline QStringViewArg qStringLikeToArg(const QString &s) noexcept { return QStringViewArg{qToStringViewIgnoringNull(s)}; }
-Q_DECL_CONSTEXPR inline QStringViewArg qStringLikeToArg(QStringView s) noexcept { return QStringViewArg{s}; }
- inline QStringViewArg qStringLikeToArg(const QChar &c) noexcept { return QStringViewArg{QStringView{&c, 1}}; }
-Q_DECL_CONSTEXPR inline QLatin1StringArg qStringLikeToArg(QLatin1String s) noexcept { return QLatin1StringArg{s}; }
+ inline QStringViewArg qStringLikeToArg(const QString &s) noexcept { return QStringViewArg{qToStringViewIgnoringNull(s)}; }
+constexpr inline QStringViewArg qStringLikeToArg(QStringView s) noexcept { return QStringViewArg{s}; }
+ inline QStringViewArg qStringLikeToArg(const QChar &c) noexcept { return QStringViewArg{QStringView{&c, 1}}; }
+constexpr inline QLatin1StringArg qStringLikeToArg(QLatin1String s) noexcept { return QLatin1StringArg{s}; }
} // namespace QtPrivate
diff --git a/src/corelib/text/qstringalgorithms.h b/src/corelib/text/qstringalgorithms.h
index c407c54268..28c0760b61 100644
--- a/src/corelib/text/qstringalgorithms.h
+++ b/src/corelib/text/qstringalgorithms.h
@@ -100,7 +100,7 @@ Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringV
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1String s) noexcept;
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QStringView s) noexcept;
-Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline bool isLatin1(QLatin1String s) noexcept;
+Q_REQUIRED_RESULT constexpr inline bool isLatin1(QLatin1String s) noexcept;
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isLatin1(QStringView s) noexcept;
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept;
diff --git a/src/corelib/text/qstringbuilder.h b/src/corelib/text/qstringbuilder.h
index 512b7e7bf7..da4277f9a8 100644
--- a/src/corelib/text/qstringbuilder.h
+++ b/src/corelib/text/qstringbuilder.h
@@ -193,7 +193,7 @@ template <> struct QConcatenable<char16_t> : private QAbstractConcatenable
typedef char16_t type;
typedef QString ConvertTo;
enum { ExactSize = true };
- static Q_DECL_CONSTEXPR int size(char16_t) { return 1; }
+ static constexpr int size(char16_t) { return 1; }
static inline void appendTo(char16_t c, QChar *&out)
{ *out++ = c; }
};
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 24cea33e7f..f2e9f876f9 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -170,13 +170,13 @@ private:
}
template <typename Container>
- static Q_DECL_CONSTEXPR qsizetype lengthHelperContainer(const Container &c) noexcept
+ static constexpr qsizetype lengthHelperContainer(const Container &c) noexcept
{
return qsizetype(std::size(c));
}
template <typename Char, size_t N>
- static Q_DECL_CONSTEXPR qsizetype lengthHelperContainer(const Char (&)[N]) noexcept
+ static constexpr qsizetype lengthHelperContainer(const Char (&)[N]) noexcept
{
return qsizetype(N - 1);
}
@@ -184,34 +184,34 @@ private:
template <typename Char>
static const storage_type *castHelper(const Char *str) noexcept
{ return reinterpret_cast<const storage_type*>(str); }
- static Q_DECL_CONSTEXPR const storage_type *castHelper(const storage_type *str) noexcept
+ static constexpr const storage_type *castHelper(const storage_type *str) noexcept
{ return str; }
public:
- Q_DECL_CONSTEXPR QStringView() noexcept
+ constexpr QStringView() noexcept
: m_size(0), m_data(nullptr) {}
- Q_DECL_CONSTEXPR QStringView(std::nullptr_t) noexcept
+ constexpr QStringView(std::nullptr_t) noexcept
: QStringView() {}
template <typename Char, if_compatible_char<Char> = true>
- Q_DECL_CONSTEXPR QStringView(const Char *str, qsizetype len)
+ constexpr QStringView(const Char *str, qsizetype len)
: m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)),
m_data(castHelper(str)) {}
template <typename Char, if_compatible_char<Char> = true>
- Q_DECL_CONSTEXPR QStringView(const Char *f, const Char *l)
+ constexpr QStringView(const Char *f, const Char *l)
: QStringView(f, l - f) {}
#ifdef Q_CLANG_QDOC
template <typename Char, size_t N>
- Q_DECL_CONSTEXPR QStringView(const Char (&array)[N]) noexcept;
+ constexpr QStringView(const Char (&array)[N]) noexcept;
template <typename Char>
- Q_DECL_CONSTEXPR QStringView(const Char *str) noexcept;
+ constexpr QStringView(const Char *str) noexcept;
#else
template <typename Pointer, if_compatible_pointer<Pointer> = true>
- Q_DECL_CONSTEXPR QStringView(const Pointer &str) noexcept
+ constexpr QStringView(const Pointer &str) noexcept
: QStringView(str, str ? lengthHelperPointer(str) : 0) {}
#endif
@@ -225,7 +225,7 @@ public:
#endif
template <typename Container, if_compatible_container<Container> = true>
- Q_DECL_CONSTEXPR QStringView(const Container &c) noexcept
+ constexpr QStringView(const Container &c) noexcept
: QStringView(std::data(c), lengthHelperContainer(c)) {}
Q_REQUIRED_RESULT inline QString toString() const; // defined in qstring.h
@@ -235,12 +235,12 @@ public:
Q_REQUIRED_RESULT Q_CORE_EXPORT NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED;
#endif
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const noexcept { return m_size; }
+ Q_REQUIRED_RESULT constexpr qsizetype size() const noexcept { return m_size; }
Q_REQUIRED_RESULT const_pointer data() const noexcept { return reinterpret_cast<const_pointer>(m_data); }
Q_REQUIRED_RESULT const_pointer constData() const noexcept { return data(); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const noexcept { return m_data; }
+ Q_REQUIRED_RESULT constexpr const storage_type *utf16() const noexcept { return m_data; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qsizetype n) const
+ Q_REQUIRED_RESULT constexpr QChar operator[](qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n < size()), QChar(m_data[n]); }
//
@@ -255,7 +255,7 @@ public:
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); }
Q_REQUIRED_RESULT inline QList<uint> toUcs4() const; // defined in qlist.h
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qsizetype n) const { return (*this)[n]; }
+ Q_REQUIRED_RESULT constexpr QChar at(qsizetype n) const { return (*this)[n]; }
Q_REQUIRED_RESULT constexpr QStringView mid(qsizetype pos, qsizetype n = -1) const
{
@@ -284,12 +284,12 @@ public:
{ Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - pos); }
Q_REQUIRED_RESULT constexpr QStringView sliced(qsizetype pos, qsizetype n) const
{ Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QStringView(m_data + pos, n); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qsizetype n) const
+ Q_REQUIRED_RESULT constexpr QStringView chopped(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, m_size - n); }
- Q_DECL_RELAXED_CONSTEXPR void truncate(qsizetype n)
+ constexpr void truncate(qsizetype n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size = n; }
- Q_DECL_RELAXED_CONSTEXPR void chop(qsizetype n)
+ constexpr void chop(qsizetype n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size -= n; }
Q_REQUIRED_RESULT QStringView trimmed() const noexcept { return QtPrivate::trimmed(*this); }
@@ -303,7 +303,7 @@ public:
Q_REQUIRED_RESULT int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::compareStrings(*this, other, cs); }
Q_REQUIRED_RESULT inline int compare(QLatin1String other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR int compare(QChar c) const noexcept
+ Q_REQUIRED_RESULT constexpr int compare(QChar c) const noexcept
{ return size() >= 1 ? compare_single_char_helper(*utf16() - c.unicode()) : -1; }
Q_REQUIRED_RESULT int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
{ return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); }
@@ -392,24 +392,24 @@ public:
Q_REQUIRED_RESULT const_reverse_iterator crbegin() const noexcept { return rbegin(); }
Q_REQUIRED_RESULT const_reverse_iterator crend() const noexcept { return rend(); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool empty() const noexcept { return size() == 0; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar front() const { return Q_ASSERT(!empty()), QChar(m_data[0]); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar back() const { return Q_ASSERT(!empty()), QChar(m_data[m_size - 1]); }
+ Q_REQUIRED_RESULT constexpr bool empty() const noexcept { return size() == 0; }
+ Q_REQUIRED_RESULT constexpr QChar front() const { return Q_ASSERT(!empty()), QChar(m_data[0]); }
+ Q_REQUIRED_RESULT constexpr QChar back() const { return Q_ASSERT(!empty()), QChar(m_data[m_size - 1]); }
//
// Qt compatibility API:
//
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool isNull() const noexcept { return !m_data; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool isEmpty() const noexcept { return empty(); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR int length() const /* not nothrow! */
+ Q_REQUIRED_RESULT constexpr bool isNull() const noexcept { return !m_data; }
+ Q_REQUIRED_RESULT constexpr bool isEmpty() const noexcept { return empty(); }
+ Q_REQUIRED_RESULT constexpr int length() const /* not nothrow! */
{ return Q_ASSERT(int(size()) == size()), int(size()); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar first() const { return front(); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar last() const { return back(); }
+ Q_REQUIRED_RESULT constexpr QChar first() const { return front(); }
+ Q_REQUIRED_RESULT constexpr QChar last() const { return back(); }
private:
qsizetype m_size;
const storage_type *m_data;
- Q_DECL_CONSTEXPR int compare_single_char_helper(int diff) const noexcept
+ constexpr int compare_single_char_helper(int diff) const noexcept
{ return diff ? diff : size() > 1 ? 1 : 0; }
};
Q_DECLARE_TYPEINFO(QStringView, Q_PRIMITIVE_TYPE);
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index 26000ba7df..2080167d2c 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -92,30 +92,30 @@ public:
operator T() const;
QAtomicInteger &operator=(T);
- static Q_DECL_CONSTEXPR bool isReferenceCountingNative();
- static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree();
+ static constexpr bool isReferenceCountingNative();
+ static constexpr bool isReferenceCountingWaitFree();
bool ref();
bool deref();
- static Q_DECL_CONSTEXPR bool isTestAndSetNative();
- static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree();
+ static constexpr bool isTestAndSetNative();
+ static constexpr bool isTestAndSetWaitFree();
bool testAndSetRelaxed(T expectedValue, T newValue);
bool testAndSetAcquire(T expectedValue, T newValue);
bool testAndSetRelease(T expectedValue, T newValue);
bool testAndSetOrdered(T expectedValue, T newValue);
- static Q_DECL_CONSTEXPR bool isFetchAndStoreNative();
- static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree();
+ static constexpr bool isFetchAndStoreNative();
+ static constexpr bool isFetchAndStoreWaitFree();
T fetchAndStoreRelaxed(T newValue);
T fetchAndStoreAcquire(T newValue);
T fetchAndStoreRelease(T newValue);
T fetchAndStoreOrdered(T newValue);
- static Q_DECL_CONSTEXPR bool isFetchAndAddNative();
- static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree();
+ static constexpr bool isFetchAndAddNative();
+ static constexpr bool isFetchAndAddWaitFree();
T fetchAndAddRelaxed(T valueToAdd);
T fetchAndAddAcquire(T valueToAdd);
@@ -199,24 +199,24 @@ public:
void storeRelaxed(T *newValue);
void storeRelease(T *newValue);
- static Q_DECL_CONSTEXPR bool isTestAndSetNative();
- static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree();
+ static constexpr bool isTestAndSetNative();
+ static constexpr bool isTestAndSetWaitFree();
bool testAndSetRelaxed(T *expectedValue, T *newValue);
bool testAndSetAcquire(T *expectedValue, T *newValue);
bool testAndSetRelease(T *expectedValue, T *newValue);
bool testAndSetOrdered(T *expectedValue, T *newValue);
- static Q_DECL_CONSTEXPR bool isFetchAndStoreNative();
- static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree();
+ static constexpr bool isFetchAndStoreNative();
+ static constexpr bool isFetchAndStoreWaitFree();
T *fetchAndStoreRelaxed(T *newValue);
T *fetchAndStoreAcquire(T *newValue);
T *fetchAndStoreRelease(T *newValue);
T *fetchAndStoreOrdered(T *newValue);
- static Q_DECL_CONSTEXPR bool isFetchAndAddNative();
- static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree();
+ static constexpr bool isFetchAndAddNative();
+ static constexpr bool isFetchAndAddWaitFree();
T *fetchAndAddRelaxed(qptrdiff valueToAdd);
T *fetchAndAddAcquire(qptrdiff valueToAdd);
diff --git a/src/corelib/thread/qatomic_cxx11.h b/src/corelib/thread/qatomic_cxx11.h
index 9669554515..89676369f7 100644
--- a/src/corelib/thread/qatomic_cxx11.h
+++ b/src/corelib/thread/qatomic_cxx11.h
@@ -73,7 +73,7 @@ QT_END_NAMESPACE
// ### Qt 6: make non-constexpr (see above)
template <int N> struct QAtomicTraits
-{ static Q_DECL_CONSTEXPR inline bool isLockFree(); };
+{ static constexpr inline bool isLockFree(); };
#define Q_ATOMIC_INT32_IS_SUPPORTED
#if ATOMIC_INT_LOCK_FREE == 2
@@ -86,7 +86,7 @@ template <int N> struct QAtomicTraits
# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_ALWAYS_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<4>::isLockFree()
{ return true; }
#elif ATOMIC_INT_LOCK_FREE == 1
# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
@@ -98,7 +98,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree()
# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<4>::isLockFree()
{ return false; }
#else
# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NEVER_NATIVE
@@ -110,7 +110,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree()
# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_NEVER_NATIVE
# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_NEVER_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<4>::isLockFree()
{ return false; }
#endif
@@ -139,7 +139,7 @@ template<> struct QAtomicOpsSupport<1> { enum { IsSupported = 1 }; };
# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_ALWAYS_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<1>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<1>::isLockFree()
{ return true; }
#elif ATOMIC_CHAR_LOCK_FREE == 1
# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
@@ -147,7 +147,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<1>::isLockFree()
# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<1>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<1>::isLockFree()
{ return false; }
#else
# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_NEVER_NATIVE
@@ -155,7 +155,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<1>::isLockFree()
# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_NEVER_NATIVE
# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_NEVER_NATIVE
-template <> Q_DECL_CONSTEXPR bool QAtomicTraits<1>::isLockFree()
+template <> constexpr bool QAtomicTraits<1>::isLockFree()
{ return false; }
#endif
@@ -167,7 +167,7 @@ template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; };
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<2>::isLockFree()
{ return false; }
#elif ATOMIC_SHORT_LOCK_FREE == 1
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
@@ -175,7 +175,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree()
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<2>::isLockFree()
{ return false; }
#else
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_NEVER_NATIVE
@@ -183,7 +183,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree()
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_NEVER_NATIVE
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_NEVER_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<2>::isLockFree()
{ return false; }
#endif
@@ -196,7 +196,7 @@ template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<8>::isLockFree()
{ return true; }
# elif ATOMIC_LLONG_LOCK_FREE == 1
# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
@@ -204,7 +204,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree()
# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<8>::isLockFree()
{ return false; }
# else
# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_NEVER_NATIVE
@@ -212,7 +212,7 @@ template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree()
# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_NEVER_NATIVE
# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_NEVER_NATIVE
-template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree()
+template <> constexpr inline bool QAtomicTraits<8>::isLockFree()
{ return false; }
# endif
#endif
@@ -275,8 +275,8 @@ template <typename X> struct QAtomicOps
_q_value.store(newValue, std::memory_order_release);
}
- static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept { return isTestAndSetNative(); }
- static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept { return false; }
+ static inline constexpr bool isReferenceCountingNative() noexcept { return isTestAndSetNative(); }
+ static inline constexpr bool isReferenceCountingWaitFree() noexcept { return false; }
template <typename T>
static inline bool ref(std::atomic<T> &_q_value)
{
@@ -289,9 +289,9 @@ template <typename X> struct QAtomicOps
return --_q_value != 0;
}
- static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept
+ static inline constexpr bool isTestAndSetNative() noexcept
{ return QAtomicTraits<sizeof(X)>::isLockFree(); }
- static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return false; }
+ static inline constexpr bool isTestAndSetWaitFree() noexcept { return false; }
template <typename T>
static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept
@@ -329,8 +329,8 @@ template <typename X> struct QAtomicOps
return tmp;
}
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return isTestAndSetNative(); }
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return false; }
+ static inline constexpr bool isFetchAndStoreNative() noexcept { return isTestAndSetNative(); }
+ static inline constexpr bool isFetchAndStoreWaitFree() noexcept { return false; }
template <typename T>
static T fetchAndStoreRelaxed(std::atomic<T> &_q_value, T newValue) noexcept
@@ -356,8 +356,8 @@ template <typename X> struct QAtomicOps
return _q_value.exchange(newValue, std::memory_order_acq_rel);
}
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return isTestAndSetNative(); }
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return false; }
+ static inline constexpr bool isFetchAndAddNative() noexcept { return isTestAndSetNative(); }
+ static inline constexpr bool isFetchAndAddWaitFree() noexcept { return false; }
template <typename T> static inline
T fetchAndAddRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
diff --git a/src/corelib/thread/qatomic_msvc.h b/src/corelib/thread/qatomic_msvc.h
index 54b12f5bb2..c872cd7231 100644
--- a/src/corelib/thread/qatomic_msvc.h
+++ b/src/corelib/thread/qatomic_msvc.h
@@ -269,23 +269,23 @@ template <> struct QAtomicWindowsType<4> { typedef long Type; };
template <int N> struct QAtomicOpsBySize : QGenericAtomicOps<QAtomicOpsBySize<N> >
{
- static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept { return true; }
- static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept { return true; }
+ static inline constexpr bool isReferenceCountingNative() noexcept { return true; }
+ static inline constexpr bool isReferenceCountingWaitFree() noexcept { return true; }
template <typename T> static bool ref(T &_q_value) noexcept;
template <typename T> static bool deref(T &_q_value) noexcept;
- static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return true; }
- static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return true; }
+ static inline constexpr bool isTestAndSetNative() noexcept { return true; }
+ static inline constexpr bool isTestAndSetWaitFree() noexcept { return true; }
template <typename T> static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) noexcept;
template <typename T>
static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) noexcept;
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return true; }
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return true; }
+ static inline constexpr bool isFetchAndStoreNative() noexcept { return true; }
+ static inline constexpr bool isFetchAndStoreWaitFree() noexcept { return true; }
template <typename T> static T fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept;
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return true; }
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return true; }
+ static inline constexpr bool isFetchAndAddNative() noexcept { return true; }
+ static inline constexpr bool isFetchAndAddWaitFree() noexcept { return true; }
template <typename T> static T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept;
private:
@@ -423,17 +423,17 @@ struct QAtomicOps<T *> : QGenericAtomicOps<QAtomicOps<T *> >
{
typedef T *Type;
- static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return true; }
- static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return true; }
+ static inline constexpr bool isTestAndSetNative() noexcept { return true; }
+ static inline constexpr bool isTestAndSetWaitFree() noexcept { return true; }
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) noexcept;
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) noexcept;
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return true; }
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return true; }
+ static inline constexpr bool isFetchAndStoreNative() noexcept { return true; }
+ static inline constexpr bool isFetchAndStoreWaitFree() noexcept { return true; }
static T *fetchAndStoreRelaxed(T *&_q_value, T *newValue) noexcept;
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return true; }
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return true; }
+ static inline constexpr bool isFetchAndAddNative() noexcept { return true; }
+ static inline constexpr bool isFetchAndAddWaitFree() noexcept { return true; }
static T *fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) noexcept;
};
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index c02403d766..8c6440a7d7 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -108,14 +108,14 @@ public:
operator T() const noexcept { return loadAcquire(); }
T operator=(T newValue) noexcept { storeRelease(newValue); return newValue; }
- static Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept { return Ops::isReferenceCountingNative(); }
- static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept { return Ops::isReferenceCountingWaitFree(); }
+ static constexpr bool isReferenceCountingNative() noexcept { return Ops::isReferenceCountingNative(); }
+ static constexpr bool isReferenceCountingWaitFree() noexcept { return Ops::isReferenceCountingWaitFree(); }
bool ref() noexcept { return Ops::ref(_q_value); }
bool deref() noexcept { return Ops::deref(_q_value); }
- static Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); }
- static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); }
+ static constexpr bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); }
+ static constexpr bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); }
bool testAndSetRelaxed(T expectedValue, T newValue) noexcept
{ return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); }
@@ -135,8 +135,8 @@ public:
bool testAndSetOrdered(T expectedValue, T newValue, T &currentValue) noexcept
{ return Ops::testAndSetOrdered(_q_value, expectedValue, newValue, &currentValue); }
- static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); }
- static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); }
+ static constexpr bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); }
+ static constexpr bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); }
T fetchAndStoreRelaxed(T newValue) noexcept
{ return Ops::fetchAndStoreRelaxed(_q_value, newValue); }
@@ -147,8 +147,8 @@ public:
T fetchAndStoreOrdered(T newValue) noexcept
{ return Ops::fetchAndStoreOrdered(_q_value, newValue); }
- static Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); }
- static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); }
+ static constexpr bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); }
+ static constexpr bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); }
T fetchAndAddRelaxed(T valueToAdd) noexcept
{ return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); }
@@ -246,8 +246,8 @@ public:
Type loadAcquire() const noexcept { return Ops::loadAcquire(_q_value); }
void storeRelease(Type newValue) noexcept { Ops::storeRelease(_q_value, newValue); }
- static Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); }
- static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); }
+ static constexpr bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); }
+ static constexpr bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); }
bool testAndSetRelaxed(Type expectedValue, Type newValue) noexcept
{ return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); }
@@ -267,8 +267,8 @@ public:
bool testAndSetOrdered(Type expectedValue, Type newValue, Type &currentValue) noexcept
{ return Ops::testAndSetOrdered(_q_value, expectedValue, newValue, &currentValue); }
- static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); }
- static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); }
+ static constexpr bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); }
+ static constexpr bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); }
Type fetchAndStoreRelaxed(Type newValue) noexcept
{ return Ops::fetchAndStoreRelaxed(_q_value, newValue); }
@@ -279,8 +279,8 @@ public:
Type fetchAndStoreOrdered(Type newValue) noexcept
{ return Ops::fetchAndStoreOrdered(_q_value, newValue); }
- static Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); }
- static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); }
+ static constexpr bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); }
+ static constexpr bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); }
Type fetchAndAddRelaxed(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); }
diff --git a/src/corelib/thread/qfutex_p.h b/src/corelib/thread/qfutex_p.h
index f287b752d7..9ace807b91 100644
--- a/src/corelib/thread/qfutex_p.h
+++ b/src/corelib/thread/qfutex_p.h
@@ -56,7 +56,7 @@
QT_BEGIN_NAMESPACE
namespace QtDummyFutex {
- Q_DECL_CONSTEXPR inline bool futexAvailable() { return false; }
+ constexpr inline bool futexAvailable() { return false; }
template <typename Atomic>
inline bool futexWait(Atomic &, typename Atomic::Type, int = 0)
{ Q_UNREACHABLE(); return false; }
diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h
index e9e5f3c74b..0fa9a9a418 100644
--- a/src/corelib/thread/qgenericatomic.h
+++ b/src/corelib/thread/qgenericatomic.h
@@ -123,9 +123,9 @@ template <typename BaseClass> struct QGenericAtomicOps
*static_cast<volatile T *>(&_q_value) = newValue;
}
- static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept
+ static inline constexpr bool isReferenceCountingNative() noexcept
{ return BaseClass::isFetchAndAddNative(); }
- static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept
+ static inline constexpr bool isReferenceCountingWaitFree() noexcept
{ return BaseClass::isFetchAndAddWaitFree(); }
template <typename T> static Q_ALWAYS_INLINE
bool ref(T &_q_value) noexcept
@@ -142,8 +142,8 @@ template <typename BaseClass> struct QGenericAtomicOps
#if 0
// These functions have no default implementation
// Archictectures must implement them
- static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept;
- static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept;
+ static inline constexpr bool isTestAndSetNative() noexcept;
+ static inline constexpr bool isTestAndSetWaitFree() noexcept;
template <typename T, typename X> static inline
bool testAndSetRelaxed(T &_q_value, X expectedValue, X newValue) noexcept;
template <typename T, typename X> static inline
@@ -194,8 +194,8 @@ template <typename BaseClass> struct QGenericAtomicOps
return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue, currentValue);
}
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return false; }
- static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return false; }
+ static inline constexpr bool isFetchAndStoreNative() noexcept { return false; }
+ static inline constexpr bool isFetchAndStoreWaitFree() noexcept { return false; }
template <typename T, typename X> static Q_ALWAYS_INLINE
T fetchAndStoreRelaxed(T &_q_value, X newValue) noexcept
@@ -230,8 +230,8 @@ template <typename BaseClass> struct QGenericAtomicOps
return BaseClass::fetchAndStoreRelaxed(_q_value, newValue);
}
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return false; }
- static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return false; }
+ static inline constexpr bool isFetchAndAddNative() noexcept { return false; }
+ static inline constexpr bool isFetchAndAddWaitFree() noexcept { return false; }
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index 93c4bf23e8..8ac6088c12 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -287,7 +287,7 @@ class Q_CORE_EXPORT QMutex
public:
enum RecursionMode { NonRecursive, Recursive };
- inline Q_DECL_CONSTEXPR explicit QMutex(RecursionMode = NonRecursive) noexcept { }
+ inline constexpr explicit QMutex(RecursionMode = NonRecursive) noexcept { }
inline void lock() noexcept {}
inline bool tryLock(int timeout = 0) noexcept { Q_UNUSED(timeout); return true; }
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index d4fb756b94..ee4cee5281 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -127,9 +127,9 @@ using namespace QtFutex;
*/
#if defined(FUTEX_OP) && QT_POINTER_SIZE > 4
-static Q_CONSTEXPR bool futexHasWaiterCount = true;
+static constexpr bool futexHasWaiterCount = true;
#else
-static Q_CONSTEXPR bool futexHasWaiterCount = false;
+static constexpr bool futexHasWaiterCount = false;
#endif
static const quintptr futexNeedsWakeAllBit =
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 6337557bc8..b6090047f0 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -2716,20 +2716,20 @@ static inline bool msecsCanBeSmall(qint64 msecs)
return sd.msecs == msecs;
}
-static Q_DECL_CONSTEXPR inline
+static constexpr inline
QDateTimePrivate::StatusFlags mergeSpec(QDateTimePrivate::StatusFlags status, Qt::TimeSpec spec)
{
return QDateTimePrivate::StatusFlags((status & ~QDateTimePrivate::TimeSpecMask) |
(int(spec) << QDateTimePrivate::TimeSpecShift));
}
-static Q_DECL_CONSTEXPR inline Qt::TimeSpec extractSpec(QDateTimePrivate::StatusFlags status)
+static constexpr inline Qt::TimeSpec extractSpec(QDateTimePrivate::StatusFlags status)
{
return Qt::TimeSpec((status & QDateTimePrivate::TimeSpecMask) >> QDateTimePrivate::TimeSpecShift);
}
// Set the Daylight Status if LocalTime set via msecs
-static Q_DECL_RELAXED_CONSTEXPR inline QDateTimePrivate::StatusFlags
+static constexpr inline QDateTimePrivate::StatusFlags
mergeDaylightStatus(QDateTimePrivate::StatusFlags sf, QDateTimePrivate::DaylightStatus status)
{
sf &= ~QDateTimePrivate::DaylightMask;
@@ -2742,7 +2742,7 @@ mergeDaylightStatus(QDateTimePrivate::StatusFlags sf, QDateTimePrivate::Daylight
}
// Get the DST Status if LocalTime set via msecs
-static Q_DECL_RELAXED_CONSTEXPR inline
+static constexpr inline
QDateTimePrivate::DaylightStatus extractDaylightStatus(QDateTimePrivate::StatusFlags status)
{
if (status & QDateTimePrivate::SetToDaylightTime)
diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h
index 62642a5fd2..fedc17c947 100644
--- a/src/corelib/time/qdatetime.h
+++ b/src/corelib/time/qdatetime.h
@@ -62,14 +62,14 @@ class QDateTime;
class Q_CORE_EXPORT QDate // ### Qt 6: change to be used by value, not const &
{
- explicit Q_DECL_CONSTEXPR QDate(qint64 julianDay) : jd(julianDay) {}
+ explicit constexpr QDate(qint64 julianDay) : jd(julianDay) {}
public:
- Q_DECL_CONSTEXPR QDate() : jd(nullJd()) {}
+ constexpr QDate() : jd(nullJd()) {}
QDate(int y, int m, int d);
QDate(int y, int m, int d, QCalendar cal);
- Q_DECL_CONSTEXPR bool isNull() const { return !isValid(); }
- Q_DECL_CONSTEXPR bool isValid() const { return jd >= minJd() && jd <= maxJd(); }
+ constexpr bool isNull() const { return !isValid(); }
+ constexpr bool isValid() const { return jd >= minJd() && jd <= maxJd(); }
// Gregorian-optimized:
int year() const;
@@ -116,12 +116,12 @@ public:
Q_REQUIRED_RESULT QDate addYears(int years, QCalendar cal) const;
qint64 daysTo(QDate d) const;
- Q_DECL_CONSTEXPR bool operator==(QDate other) const { return jd == other.jd; }
- Q_DECL_CONSTEXPR bool operator!=(QDate other) const { return jd != other.jd; }
- Q_DECL_CONSTEXPR bool operator< (QDate other) const { return jd < other.jd; }
- Q_DECL_CONSTEXPR bool operator<=(QDate other) const { return jd <= other.jd; }
- Q_DECL_CONSTEXPR bool operator> (QDate other) const { return jd > other.jd; }
- Q_DECL_CONSTEXPR bool operator>=(QDate other) const { return jd >= other.jd; }
+ constexpr bool operator==(QDate other) const { return jd == other.jd; }
+ constexpr bool operator!=(QDate other) const { return jd != other.jd; }
+ constexpr bool operator< (QDate other) const { return jd < other.jd; }
+ constexpr bool operator<=(QDate other) const { return jd <= other.jd; }
+ constexpr bool operator> (QDate other) const { return jd > other.jd; }
+ constexpr bool operator>=(QDate other) const { return jd >= other.jd; }
static QDate currentDate();
#if QT_CONFIG(datestring)
@@ -135,15 +135,15 @@ public:
static bool isValid(int y, int m, int d);
static bool isLeapYear(int year);
- static Q_DECL_CONSTEXPR inline QDate fromJulianDay(qint64 jd_)
+ static constexpr inline QDate fromJulianDay(qint64 jd_)
{ return jd_ >= minJd() && jd_ <= maxJd() ? QDate(jd_) : QDate() ; }
- Q_DECL_CONSTEXPR inline qint64 toJulianDay() const { return jd; }
+ constexpr inline qint64 toJulianDay() const { return jd; }
private:
// using extra parentheses around min to avoid expanding it if it is a macro
- static Q_DECL_CONSTEXPR inline qint64 nullJd() { return (std::numeric_limits<qint64>::min)(); }
- static Q_DECL_CONSTEXPR inline qint64 minJd() { return Q_INT64_C(-784350574879); }
- static Q_DECL_CONSTEXPR inline qint64 maxJd() { return Q_INT64_C( 784354017364); }
+ static constexpr inline qint64 nullJd() { return (std::numeric_limits<qint64>::min)(); }
+ static constexpr inline qint64 minJd() { return Q_INT64_C(-784350574879); }
+ static constexpr inline qint64 maxJd() { return Q_INT64_C( 784354017364); }
qint64 jd;
@@ -158,14 +158,14 @@ Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE);
class Q_CORE_EXPORT QTime // ### Qt 6: change to be used by value, not const &
{
- explicit Q_DECL_CONSTEXPR QTime(int ms) : mds(ms)
+ explicit constexpr QTime(int ms) : mds(ms)
{}
public:
- Q_DECL_CONSTEXPR QTime(): mds(NullTime)
+ constexpr QTime(): mds(NullTime)
{}
QTime(int h, int m, int s = 0, int ms = 0);
- Q_DECL_CONSTEXPR bool isNull() const { return mds == NullTime; }
+ constexpr bool isNull() const { return mds == NullTime; }
bool isValid() const;
int hour() const;
@@ -186,15 +186,15 @@ public:
Q_REQUIRED_RESULT QTime addMSecs(int ms) const;
int msecsTo(QTime t) const;
- Q_DECL_CONSTEXPR bool operator==(QTime other) const { return mds == other.mds; }
- Q_DECL_CONSTEXPR bool operator!=(QTime other) const { return mds != other.mds; }
- Q_DECL_CONSTEXPR bool operator< (QTime other) const { return mds < other.mds; }
- Q_DECL_CONSTEXPR bool operator<=(QTime other) const { return mds <= other.mds; }
- Q_DECL_CONSTEXPR bool operator> (QTime other) const { return mds > other.mds; }
- Q_DECL_CONSTEXPR bool operator>=(QTime other) const { return mds >= other.mds; }
+ constexpr bool operator==(QTime other) const { return mds == other.mds; }
+ constexpr bool operator!=(QTime other) const { return mds != other.mds; }
+ constexpr bool operator< (QTime other) const { return mds < other.mds; }
+ constexpr bool operator<=(QTime other) const { return mds <= other.mds; }
+ constexpr bool operator> (QTime other) const { return mds > other.mds; }
+ constexpr bool operator>=(QTime other) const { return mds >= other.mds; }
- static Q_DECL_CONSTEXPR inline QTime fromMSecsSinceStartOfDay(int msecs) { return QTime(msecs); }
- Q_DECL_CONSTEXPR inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; }
+ static constexpr inline QTime fromMSecsSinceStartOfDay(int msecs) { return QTime(msecs); }
+ constexpr inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; }
static QTime currentTime();
#if QT_CONFIG(datestring)
@@ -205,7 +205,7 @@ public:
private:
enum TimeFlag { NullTime = -1 };
- Q_DECL_CONSTEXPR inline int ds() const { return mds == -1 ? 0 : mds; }
+ constexpr inline int ds() const { return mds == -1 ? 0 : mds; }
int mds;
friend class QDateTime;
diff --git a/src/corelib/time/qdatetimeparser_p.h b/src/corelib/time/qdatetimeparser_p.h
index 94358b092d..0cee907ff5 100644
--- a/src/corelib/time/qdatetimeparser_p.h
+++ b/src/corelib/time/qdatetimeparser_p.h
@@ -206,7 +206,7 @@ private:
int used;
int zeroes;
State state;
- Q_DECL_CONSTEXPR ParsedSection(State ok = Invalid,
+ constexpr ParsedSection(State ok = Invalid,
int val = 0, int read = 0, int zs = 0)
: value(ok == Invalid ? -1 : val), used(read), zeroes(zs), state(ok)
{}
diff --git a/src/corelib/time/qtimezoneprivate_p.h b/src/corelib/time/qtimezoneprivate_p.h
index 3f08fc15a6..70d6d8b088 100644
--- a/src/corelib/time/qtimezoneprivate_p.h
+++ b/src/corelib/time/qtimezoneprivate_p.h
@@ -285,9 +285,9 @@ struct QTzTransitionRule
quint8 abbreviationIndex;
};
Q_DECLARE_TYPEINFO(QTzTransitionRule, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline bool operator==(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) noexcept
+constexpr inline bool operator==(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) noexcept
{ return lhs.stdOffset == rhs.stdOffset && lhs.dstOffset == rhs.dstOffset && lhs.abbreviationIndex == rhs.abbreviationIndex; }
-Q_DECL_CONSTEXPR inline bool operator!=(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) noexcept
+constexpr inline bool operator!=(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) noexcept
{ return !operator==(lhs, rhs); }
// These are stored separately from QTzTimeZonePrivate so that they can be
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 838e8472d8..1445de1008 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -533,7 +533,7 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera
#if defined QT_HAS_CONSTEXPR_BUILTINS
#if defined(Q_CC_GNU) || defined(Q_CC_CLANG)
# define QT_HAS_BUILTIN_CTZS
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
{
# if __has_builtin(__builtin_ctzs)
return __builtin_ctzs(v);
@@ -542,7 +542,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
# endif
}
#define QT_HAS_BUILTIN_CLZS
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept
{
# if __has_builtin(__builtin_clzs)
return __builtin_clzs(v);
@@ -551,40 +551,40 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept
# endif
}
#define QT_HAS_BUILTIN_CTZ
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctz(quint32 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_ctz(quint32 v) noexcept
{
return __builtin_ctz(v);
}
#define QT_HAS_BUILTIN_CLZ
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clz(quint32 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_clz(quint32 v) noexcept
{
return __builtin_clz(v);
}
#define QT_HAS_BUILTIN_CTZLL
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzll(quint64 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_ctzll(quint64 v) noexcept
{
return __builtin_ctzll(v);
}
#define QT_HAS_BUILTIN_CLZLL
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzll(quint64 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_clzll(quint64 v) noexcept
{
return __builtin_clzll(v);
}
#define QALGORITHMS_USE_BUILTIN_POPCOUNT
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) noexcept
{
return __builtin_popcount(v);
}
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) noexcept
{
return __builtin_popcount(v);
}
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) noexcept
{
return __builtin_popcount(v);
}
#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) noexcept
+constexpr Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) noexcept
{
return __builtin_popcountll(v);
}
@@ -679,8 +679,8 @@ Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) noexcept
#endif // QT_HAS_CONSTEXPR_BUILTINS
#ifndef QT_POPCOUNT_CONSTEXPR
-#define QT_POPCOUNT_CONSTEXPR Q_DECL_CONSTEXPR
-#define QT_POPCOUNT_RELAXED_CONSTEXPR Q_DECL_RELAXED_CONSTEXPR
+#define QT_POPCOUNT_CONSTEXPR constexpr
+#define QT_POPCOUNT_RELAXED_CONSTEXPR constexpr
#endif
} //namespace QAlgorithmsPrivate
@@ -836,7 +836,7 @@ constexpr inline uint qCountTrailingZeroBits(unsigned long v) noexcept
return qCountTrailingZeroBits(QIntegerForSizeof<long>::Unsigned(v));
}
-Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) noexcept
+constexpr inline uint qCountLeadingZeroBits(quint32 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CLZ)
return v ? QAlgorithmsPrivate::qt_builtin_clz(v) : 32U;
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index 5ba23b344b..c49473802a 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -190,7 +190,7 @@ class QFreeList
Q_DISABLE_COPY_MOVE(QFreeList)
public:
- Q_DECL_CONSTEXPR inline QFreeList();
+ constexpr inline QFreeList();
inline ~QFreeList();
// returns the payload for the given index \a x
@@ -206,7 +206,7 @@ public:
};
template <typename T, typename ConstantsType>
-Q_DECL_CONSTEXPR inline QFreeList<T, ConstantsType>::QFreeList()
+constexpr inline QFreeList<T, ConstantsType>::QFreeList()
:
#if defined(Q_COMPILER_CONSTEXPR)
_v{}, // uniform initialization required
diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h
index e8e93206ce..27dafd4d87 100644
--- a/src/corelib/tools/qhashfunctions.h
+++ b/src/corelib/tools/qhashfunctions.h
@@ -96,25 +96,25 @@ Q_DECL_CONST_FUNCTION constexpr size_t hash(size_t key, size_t seed) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHashBits(const void *p, size_t size, size_t seed = 0) noexcept;
// C++ builtin types
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(char key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(uchar key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(uchar key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(signed char key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(signed char key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(ushort key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(ushort key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(short key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(short key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(uint key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(uint key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(int key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(int key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(ulong key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(ulong key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(long key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(long key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(quint64 key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(quint64 key, size_t seed = 0) noexcept
{
if constexpr (sizeof(quint64) > sizeof(size_t))
key ^= (key >> 32);
@@ -133,14 +133,14 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(double key, size_t seed = 0) no
#if !defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(long double key, size_t seed = 0) noexcept;
#endif
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(wchar_t key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(wchar_t key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(char16_t key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char16_t key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(char32_t key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char32_t key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
#ifdef __cpp_char8_t
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(char8_t key, size_t seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char8_t key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
#endif
template <class T> inline size_t qHash(const T *key, size_t seed = 0) noexcept
diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h
index c4665c7c87..c315b77c85 100644
--- a/src/corelib/tools/qiterator.h
+++ b/src/corelib/tools/qiterator.h
@@ -198,7 +198,7 @@ public:
typedef const value_type &reference;
QKeyValueIterator() = default;
- Q_DECL_CONSTEXPR explicit QKeyValueIterator(Iterator o) noexcept(std::is_nothrow_move_constructible<Iterator>::value)
+ constexpr explicit QKeyValueIterator(Iterator o) noexcept(std::is_nothrow_move_constructible<Iterator>::value)
: i(std::move(o)) {}
std::pair<Key, T> operator*() const {
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index 8d0e10b669..2798f7015e 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -52,39 +52,39 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QLine
{
public:
- Q_DECL_CONSTEXPR inline QLine();
- Q_DECL_CONSTEXPR inline QLine(const QPoint &pt1, const QPoint &pt2);
- Q_DECL_CONSTEXPR inline QLine(int x1, int y1, int x2, int y2);
+ constexpr inline QLine();
+ constexpr inline QLine(const QPoint &pt1, const QPoint &pt2);
+ constexpr inline QLine(int x1, int y1, int x2, int y2);
- Q_DECL_CONSTEXPR inline bool isNull() const;
+ constexpr inline bool isNull() const;
- Q_DECL_CONSTEXPR inline QPoint p1() const;
- Q_DECL_CONSTEXPR inline QPoint p2() const;
+ constexpr inline QPoint p1() const;
+ constexpr inline QPoint p2() const;
- Q_DECL_CONSTEXPR inline int x1() const;
- Q_DECL_CONSTEXPR inline int y1() const;
+ constexpr inline int x1() const;
+ constexpr inline int y1() const;
- Q_DECL_CONSTEXPR inline int x2() const;
- Q_DECL_CONSTEXPR inline int y2() const;
+ constexpr inline int x2() const;
+ constexpr inline int y2() const;
- Q_DECL_CONSTEXPR inline int dx() const;
- Q_DECL_CONSTEXPR inline int dy() const;
+ constexpr inline int dx() const;
+ constexpr inline int dy() const;
inline void translate(const QPoint &p);
inline void translate(int dx, int dy);
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLine translated(const QPoint &p) const;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLine translated(int dx, int dy) const;
+ Q_REQUIRED_RESULT constexpr inline QLine translated(const QPoint &p) const;
+ Q_REQUIRED_RESULT constexpr inline QLine translated(int dx, int dy) const;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QPoint center() const;
+ Q_REQUIRED_RESULT constexpr inline QPoint center() const;
inline void setP1(const QPoint &p1);
inline void setP2(const QPoint &p2);
inline void setPoints(const QPoint &p1, const QPoint &p2);
inline void setLine(int x1, int y1, int x2, int y2);
- Q_DECL_CONSTEXPR inline bool operator==(const QLine &d) const;
- Q_DECL_CONSTEXPR inline bool operator!=(const QLine &d) const { return !(*this == d); }
+ constexpr inline bool operator==(const QLine &d) const;
+ constexpr inline bool operator!=(const QLine &d) const { return !(*this == d); }
private:
QPoint pt1, pt2;
@@ -95,53 +95,53 @@ Q_DECLARE_TYPEINFO(QLine, Q_MOVABLE_TYPE);
* class QLine inline members
*******************************************************************************/
-Q_DECL_CONSTEXPR inline QLine::QLine() { }
+constexpr inline QLine::QLine() { }
-Q_DECL_CONSTEXPR inline QLine::QLine(const QPoint &pt1_, const QPoint &pt2_) : pt1(pt1_), pt2(pt2_) { }
+constexpr inline QLine::QLine(const QPoint &pt1_, const QPoint &pt2_) : pt1(pt1_), pt2(pt2_) { }
-Q_DECL_CONSTEXPR inline QLine::QLine(int x1pos, int y1pos, int x2pos, int y2pos) : pt1(QPoint(x1pos, y1pos)), pt2(QPoint(x2pos, y2pos)) { }
+constexpr inline QLine::QLine(int x1pos, int y1pos, int x2pos, int y2pos) : pt1(QPoint(x1pos, y1pos)), pt2(QPoint(x2pos, y2pos)) { }
-Q_DECL_CONSTEXPR inline bool QLine::isNull() const
+constexpr inline bool QLine::isNull() const
{
return pt1 == pt2;
}
-Q_DECL_CONSTEXPR inline int QLine::x1() const
+constexpr inline int QLine::x1() const
{
return pt1.x();
}
-Q_DECL_CONSTEXPR inline int QLine::y1() const
+constexpr inline int QLine::y1() const
{
return pt1.y();
}
-Q_DECL_CONSTEXPR inline int QLine::x2() const
+constexpr inline int QLine::x2() const
{
return pt2.x();
}
-Q_DECL_CONSTEXPR inline int QLine::y2() const
+constexpr inline int QLine::y2() const
{
return pt2.y();
}
-Q_DECL_CONSTEXPR inline QPoint QLine::p1() const
+constexpr inline QPoint QLine::p1() const
{
return pt1;
}
-Q_DECL_CONSTEXPR inline QPoint QLine::p2() const
+constexpr inline QPoint QLine::p2() const
{
return pt2;
}
-Q_DECL_CONSTEXPR inline int QLine::dx() const
+constexpr inline int QLine::dx() const
{
return pt2.x() - pt1.x();
}
-Q_DECL_CONSTEXPR inline int QLine::dy() const
+constexpr inline int QLine::dy() const
{
return pt2.y() - pt1.y();
}
@@ -157,17 +157,17 @@ inline void QLine::translate(int adx, int ady)
this->translate(QPoint(adx, ady));
}
-Q_DECL_CONSTEXPR inline QLine QLine::translated(const QPoint &p) const
+constexpr inline QLine QLine::translated(const QPoint &p) const
{
return QLine(pt1 + p, pt2 + p);
}
-Q_DECL_CONSTEXPR inline QLine QLine::translated(int adx, int ady) const
+constexpr inline QLine QLine::translated(int adx, int ady) const
{
return translated(QPoint(adx, ady));
}
-Q_DECL_CONSTEXPR inline QPoint QLine::center() const
+constexpr inline QPoint QLine::center() const
{
return QPoint(int((qint64(pt1.x()) + pt2.x()) / 2), int((qint64(pt1.y()) + pt2.y()) / 2));
}
@@ -194,7 +194,7 @@ inline void QLine::setLine(int aX1, int aY1, int aX2, int aY2)
pt2 = QPoint(aX2, aY2);
}
-Q_DECL_CONSTEXPR inline bool QLine::operator==(const QLine &d) const
+constexpr inline bool QLine::operator==(const QLine &d) const
{
return pt1 == d.pt1 && pt2 == d.pt2;
}
@@ -217,26 +217,26 @@ public:
enum IntersectType { NoIntersection, BoundedIntersection, UnboundedIntersection };
using IntersectionType = IntersectType;
- Q_DECL_CONSTEXPR inline QLineF();
- Q_DECL_CONSTEXPR inline QLineF(const QPointF &pt1, const QPointF &pt2);
- Q_DECL_CONSTEXPR inline QLineF(qreal x1, qreal y1, qreal x2, qreal y2);
- Q_DECL_CONSTEXPR inline QLineF(const QLine &line) : pt1(line.p1()), pt2(line.p2()) { }
+ constexpr inline QLineF();
+ constexpr inline QLineF(const QPointF &pt1, const QPointF &pt2);
+ constexpr inline QLineF(qreal x1, qreal y1, qreal x2, qreal y2);
+ constexpr inline QLineF(const QLine &line) : pt1(line.p1()), pt2(line.p2()) { }
Q_REQUIRED_RESULT static QLineF fromPolar(qreal length, qreal angle);
- Q_DECL_CONSTEXPR bool isNull() const;
+ constexpr bool isNull() const;
- Q_DECL_CONSTEXPR inline QPointF p1() const;
- Q_DECL_CONSTEXPR inline QPointF p2() const;
+ constexpr inline QPointF p1() const;
+ constexpr inline QPointF p2() const;
- Q_DECL_CONSTEXPR inline qreal x1() const;
- Q_DECL_CONSTEXPR inline qreal y1() const;
+ constexpr inline qreal x1() const;
+ constexpr inline qreal y1() const;
- Q_DECL_CONSTEXPR inline qreal x2() const;
- Q_DECL_CONSTEXPR inline qreal y2() const;
+ constexpr inline qreal x2() const;
+ constexpr inline qreal y2() const;
- Q_DECL_CONSTEXPR inline qreal dx() const;
- Q_DECL_CONSTEXPR inline qreal dy() const;
+ constexpr inline qreal dx() const;
+ constexpr inline qreal dy() const;
qreal length() const;
void setLength(qreal len);
@@ -247,28 +247,28 @@ public:
qreal angleTo(const QLineF &l) const;
Q_REQUIRED_RESULT QLineF unitVector() const;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF normalVector() const;
+ Q_REQUIRED_RESULT constexpr inline QLineF normalVector() const;
IntersectionType intersects(const QLineF &l, QPointF *intersectionPoint) const;
- Q_DECL_CONSTEXPR inline QPointF pointAt(qreal t) const;
+ constexpr inline QPointF pointAt(qreal t) const;
inline void translate(const QPointF &p);
inline void translate(qreal dx, qreal dy);
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF translated(const QPointF &p) const;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF translated(qreal dx, qreal dy) const;
+ Q_REQUIRED_RESULT constexpr inline QLineF translated(const QPointF &p) const;
+ Q_REQUIRED_RESULT constexpr inline QLineF translated(qreal dx, qreal dy) const;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QPointF center() const;
+ Q_REQUIRED_RESULT constexpr inline QPointF center() const;
inline void setP1(const QPointF &p1);
inline void setP2(const QPointF &p2);
inline void setPoints(const QPointF &p1, const QPointF &p2);
inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2);
- Q_DECL_CONSTEXPR inline bool operator==(const QLineF &d) const;
- Q_DECL_CONSTEXPR inline bool operator!=(const QLineF &d) const { return !(*this == d); }
+ constexpr inline bool operator==(const QLineF &d) const;
+ constexpr inline bool operator!=(const QLineF &d) const { return !(*this == d); }
- Q_DECL_CONSTEXPR QLine toLine() const;
+ constexpr QLine toLine() const;
private:
QPointF pt1, pt2;
@@ -279,66 +279,66 @@ Q_DECLARE_TYPEINFO(QLineF, Q_MOVABLE_TYPE);
* class QLineF inline members
*******************************************************************************/
-Q_DECL_CONSTEXPR inline QLineF::QLineF()
+constexpr inline QLineF::QLineF()
{
}
-Q_DECL_CONSTEXPR inline QLineF::QLineF(const QPointF &apt1, const QPointF &apt2)
+constexpr inline QLineF::QLineF(const QPointF &apt1, const QPointF &apt2)
: pt1(apt1), pt2(apt2)
{
}
-Q_DECL_CONSTEXPR inline QLineF::QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos)
+constexpr inline QLineF::QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos)
: pt1(x1pos, y1pos), pt2(x2pos, y2pos)
{
}
-Q_DECL_CONSTEXPR inline qreal QLineF::x1() const
+constexpr inline qreal QLineF::x1() const
{
return pt1.x();
}
-Q_DECL_CONSTEXPR inline qreal QLineF::y1() const
+constexpr inline qreal QLineF::y1() const
{
return pt1.y();
}
-Q_DECL_CONSTEXPR inline qreal QLineF::x2() const
+constexpr inline qreal QLineF::x2() const
{
return pt2.x();
}
-Q_DECL_CONSTEXPR inline qreal QLineF::y2() const
+constexpr inline qreal QLineF::y2() const
{
return pt2.y();
}
-Q_DECL_CONSTEXPR inline bool QLineF::isNull() const
+constexpr inline bool QLineF::isNull() const
{
return qFuzzyCompare(pt1.x(), pt2.x()) && qFuzzyCompare(pt1.y(), pt2.y());
}
-Q_DECL_CONSTEXPR inline QPointF QLineF::p1() const
+constexpr inline QPointF QLineF::p1() const
{
return pt1;
}
-Q_DECL_CONSTEXPR inline QPointF QLineF::p2() const
+constexpr inline QPointF QLineF::p2() const
{
return pt2;
}
-Q_DECL_CONSTEXPR inline qreal QLineF::dx() const
+constexpr inline qreal QLineF::dx() const
{
return pt2.x() - pt1.x();
}
-Q_DECL_CONSTEXPR inline qreal QLineF::dy() const
+constexpr inline qreal QLineF::dy() const
{
return pt2.y() - pt1.y();
}
-Q_DECL_CONSTEXPR inline QLineF QLineF::normalVector() const
+constexpr inline QLineF QLineF::normalVector() const
{
return QLineF(p1(), p1() + QPointF(dy(), -dx()));
}
@@ -354,17 +354,17 @@ inline void QLineF::translate(qreal adx, qreal ady)
this->translate(QPointF(adx, ady));
}
-Q_DECL_CONSTEXPR inline QLineF QLineF::translated(const QPointF &p) const
+constexpr inline QLineF QLineF::translated(const QPointF &p) const
{
return QLineF(pt1 + p, pt2 + p);
}
-Q_DECL_CONSTEXPR inline QLineF QLineF::translated(qreal adx, qreal ady) const
+constexpr inline QLineF QLineF::translated(qreal adx, qreal ady) const
{
return translated(QPointF(adx, ady));
}
-Q_DECL_CONSTEXPR inline QPointF QLineF::center() const
+constexpr inline QPointF QLineF::center() const
{
return QPointF(0.5 * pt1.x() + 0.5 * pt2.x(), 0.5 * pt1.y() + 0.5 * pt2.y());
}
@@ -377,12 +377,12 @@ inline void QLineF::setLength(qreal len)
pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len);
}
-Q_DECL_CONSTEXPR inline QPointF QLineF::pointAt(qreal t) const
+constexpr inline QPointF QLineF::pointAt(qreal t) const
{
return QPointF(pt1.x() + (pt2.x() - pt1.x()) * t, pt1.y() + (pt2.y() - pt1.y()) * t);
}
-Q_DECL_CONSTEXPR inline QLine QLineF::toLine() const
+constexpr inline QLine QLineF::toLine() const
{
return QLine(pt1.toPoint(), pt2.toPoint());
}
@@ -411,7 +411,7 @@ inline void QLineF::setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2)
}
-Q_DECL_CONSTEXPR inline bool QLineF::operator==(const QLineF &d) const
+constexpr inline bool QLineF::operator==(const QLineF &d) const
{
return pt1 == d.pt1 && pt2 == d.pt2;
}
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index bc1fa3cb61..de7a96e458 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -51,29 +51,29 @@ QT_BEGIN_NAMESPACE
class QMargins
{
public:
- Q_DECL_CONSTEXPR QMargins() noexcept;
- Q_DECL_CONSTEXPR QMargins(int left, int top, int right, int bottom) noexcept;
-
- Q_DECL_CONSTEXPR bool isNull() const noexcept;
-
- Q_DECL_CONSTEXPR int left() const noexcept;
- Q_DECL_CONSTEXPR int top() const noexcept;
- Q_DECL_CONSTEXPR int right() const noexcept;
- Q_DECL_CONSTEXPR int bottom() const noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR void setLeft(int left) noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setTop(int top) noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setRight(int right) noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setBottom(int bottom) noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator+=(const QMargins &margins) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator-=(const QMargins &margins) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator+=(int) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator-=(int) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator*=(int) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator/=(int);
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator*=(qreal) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMargins &operator/=(qreal);
+ constexpr QMargins() noexcept;
+ constexpr QMargins(int left, int top, int right, int bottom) noexcept;
+
+ constexpr bool isNull() const noexcept;
+
+ constexpr int left() const noexcept;
+ constexpr int top() const noexcept;
+ constexpr int right() const noexcept;
+ constexpr int bottom() const noexcept;
+
+ constexpr void setLeft(int left) noexcept;
+ constexpr void setTop(int top) noexcept;
+ constexpr void setRight(int right) noexcept;
+ constexpr void setBottom(int bottom) noexcept;
+
+ constexpr QMargins &operator+=(const QMargins &margins) noexcept;
+ constexpr QMargins &operator-=(const QMargins &margins) noexcept;
+ constexpr QMargins &operator+=(int) noexcept;
+ constexpr QMargins &operator-=(int) noexcept;
+ constexpr QMargins &operator*=(int) noexcept;
+ constexpr QMargins &operator/=(int);
+ constexpr QMargins &operator*=(qreal) noexcept;
+ constexpr QMargins &operator/=(qreal);
private:
int m_left;
@@ -81,8 +81,8 @@ private:
int m_right;
int m_bottom;
- friend Q_DECL_CONSTEXPR inline bool operator==(const QMargins &, const QMargins &) noexcept;
- friend Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &, const QMargins &) noexcept;
+ friend constexpr inline bool operator==(const QMargins &, const QMargins &) noexcept;
+ friend constexpr inline bool operator!=(const QMargins &, const QMargins &) noexcept;
};
Q_DECLARE_TYPEINFO(QMargins, Q_MOVABLE_TYPE);
@@ -99,40 +99,40 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMargins &);
QMargins inline functions
*****************************************************************************/
-Q_DECL_CONSTEXPR inline QMargins::QMargins() noexcept : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
+constexpr inline QMargins::QMargins() noexcept : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
-Q_DECL_CONSTEXPR inline QMargins::QMargins(int aleft, int atop, int aright, int abottom) noexcept
+constexpr inline QMargins::QMargins(int aleft, int atop, int aright, int abottom) noexcept
: m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
-Q_DECL_CONSTEXPR inline bool QMargins::isNull() const noexcept
+constexpr inline bool QMargins::isNull() const noexcept
{ return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; }
-Q_DECL_CONSTEXPR inline int QMargins::left() const noexcept
+constexpr inline int QMargins::left() const noexcept
{ return m_left; }
-Q_DECL_CONSTEXPR inline int QMargins::top() const noexcept
+constexpr inline int QMargins::top() const noexcept
{ return m_top; }
-Q_DECL_CONSTEXPR inline int QMargins::right() const noexcept
+constexpr inline int QMargins::right() const noexcept
{ return m_right; }
-Q_DECL_CONSTEXPR inline int QMargins::bottom() const noexcept
+constexpr inline int QMargins::bottom() const noexcept
{ return m_bottom; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setLeft(int aleft) noexcept
+constexpr inline void QMargins::setLeft(int aleft) noexcept
{ m_left = aleft; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setTop(int atop) noexcept
+constexpr inline void QMargins::setTop(int atop) noexcept
{ m_top = atop; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setRight(int aright) noexcept
+constexpr inline void QMargins::setRight(int aright) noexcept
{ m_right = aright; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setBottom(int abottom) noexcept
+constexpr inline void QMargins::setBottom(int abottom) noexcept
{ m_bottom = abottom; }
-Q_DECL_CONSTEXPR inline bool operator==(const QMargins &m1, const QMargins &m2) noexcept
+constexpr inline bool operator==(const QMargins &m1, const QMargins &m2) noexcept
{
return
m1.m_left == m2.m_left &&
@@ -141,7 +141,7 @@ Q_DECL_CONSTEXPR inline bool operator==(const QMargins &m1, const QMargins &m2)
m1.m_bottom == m2.m_bottom;
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &m1, const QMargins &m2) noexcept
+constexpr inline bool operator!=(const QMargins &m1, const QMargins &m2) noexcept
{
return
m1.m_left != m2.m_left ||
@@ -150,89 +150,89 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &m1, const QMargins &m2)
m1.m_bottom != m2.m_bottom;
}
-Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept
+constexpr inline QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept
{
return QMargins(m1.left() + m2.left(), m1.top() + m2.top(),
m1.right() + m2.right(), m1.bottom() + m2.bottom());
}
-Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept
+constexpr inline QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept
{
return QMargins(m1.left() - m2.left(), m1.top() - m2.top(),
m1.right() - m2.right(), m1.bottom() - m2.bottom());
}
-Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &lhs, int rhs) noexcept
+constexpr inline QMargins operator+(const QMargins &lhs, int rhs) noexcept
{
return QMargins(lhs.left() + rhs, lhs.top() + rhs,
lhs.right() + rhs, lhs.bottom() + rhs);
}
-Q_DECL_CONSTEXPR inline QMargins operator+(int lhs, const QMargins &rhs) noexcept
+constexpr inline QMargins operator+(int lhs, const QMargins &rhs) noexcept
{
return QMargins(rhs.left() + lhs, rhs.top() + lhs,
rhs.right() + lhs, rhs.bottom() + lhs);
}
-Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &lhs, int rhs) noexcept
+constexpr inline QMargins operator-(const QMargins &lhs, int rhs) noexcept
{
return QMargins(lhs.left() - rhs, lhs.top() - rhs,
lhs.right() - rhs, lhs.bottom() - rhs);
}
-Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, int factor) noexcept
+constexpr inline QMargins operator*(const QMargins &margins, int factor) noexcept
{
return QMargins(margins.left() * factor, margins.top() * factor,
margins.right() * factor, margins.bottom() * factor);
}
-Q_DECL_CONSTEXPR inline QMargins operator*(int factor, const QMargins &margins) noexcept
+constexpr inline QMargins operator*(int factor, const QMargins &margins) noexcept
{
return QMargins(margins.left() * factor, margins.top() * factor,
margins.right() * factor, margins.bottom() * factor);
}
-Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, qreal factor) noexcept
+constexpr inline QMargins operator*(const QMargins &margins, qreal factor) noexcept
{
return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor),
qRound(margins.right() * factor), qRound(margins.bottom() * factor));
}
-Q_DECL_CONSTEXPR inline QMargins operator*(qreal factor, const QMargins &margins) noexcept
+constexpr inline QMargins operator*(qreal factor, const QMargins &margins) noexcept
{
return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor),
qRound(margins.right() * factor), qRound(margins.bottom() * factor));
}
-Q_DECL_CONSTEXPR inline QMargins operator/(const QMargins &margins, int divisor)
+constexpr inline QMargins operator/(const QMargins &margins, int divisor)
{
return QMargins(margins.left() / divisor, margins.top() / divisor,
margins.right() / divisor, margins.bottom() / divisor);
}
-Q_DECL_CONSTEXPR inline QMargins operator/(const QMargins &margins, qreal divisor)
+constexpr inline QMargins operator/(const QMargins &margins, qreal divisor)
{
return QMargins(qRound(margins.left() / divisor), qRound(margins.top() / divisor),
qRound(margins.right() / divisor), qRound(margins.bottom() / divisor));
}
-Q_DECL_CONSTEXPR inline QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept
+constexpr inline QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept
{
return QMargins(qMax(m1.left(), m2.left()), qMax(m1.top(), m2.top()),
qMax(m1.right(), m2.right()), qMax(m1.bottom(), m2.bottom()));
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(const QMargins &margins) noexcept
+constexpr inline QMargins &QMargins::operator+=(const QMargins &margins) noexcept
{
return *this = *this + margins;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(const QMargins &margins) noexcept
+constexpr inline QMargins &QMargins::operator-=(const QMargins &margins) noexcept
{
return *this = *this - margins;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(int margin) noexcept
+constexpr inline QMargins &QMargins::operator+=(int margin) noexcept
{
m_left += margin;
m_top += margin;
@@ -241,7 +241,7 @@ Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(int margin) noexc
return *this;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(int margin) noexcept
+constexpr inline QMargins &QMargins::operator-=(int margin) noexcept
{
m_left -= margin;
m_top -= margin;
@@ -250,32 +250,32 @@ Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(int margin) noexc
return *this;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator*=(int factor) noexcept
+constexpr inline QMargins &QMargins::operator*=(int factor) noexcept
{
return *this = *this * factor;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator/=(int divisor)
+constexpr inline QMargins &QMargins::operator/=(int divisor)
{
return *this = *this / divisor;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator*=(qreal factor) noexcept
+constexpr inline QMargins &QMargins::operator*=(qreal factor) noexcept
{
return *this = *this * factor;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator/=(qreal divisor)
+constexpr inline QMargins &QMargins::operator/=(qreal divisor)
{
return *this = *this / divisor;
}
-Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &margins) noexcept
+constexpr inline QMargins operator+(const QMargins &margins) noexcept
{
return margins;
}
-Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &margins) noexcept
+constexpr inline QMargins operator-(const QMargins &margins) noexcept
{
return QMargins(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
}
@@ -291,30 +291,30 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &);
class QMarginsF
{
public:
- Q_DECL_CONSTEXPR QMarginsF() noexcept;
- Q_DECL_CONSTEXPR QMarginsF(qreal left, qreal top, qreal right, qreal bottom) noexcept;
- Q_DECL_CONSTEXPR QMarginsF(const QMargins &margins) noexcept;
+ constexpr QMarginsF() noexcept;
+ constexpr QMarginsF(qreal left, qreal top, qreal right, qreal bottom) noexcept;
+ constexpr QMarginsF(const QMargins &margins) noexcept;
- Q_DECL_CONSTEXPR bool isNull() const noexcept;
+ constexpr bool isNull() const noexcept;
- Q_DECL_CONSTEXPR qreal left() const noexcept;
- Q_DECL_CONSTEXPR qreal top() const noexcept;
- Q_DECL_CONSTEXPR qreal right() const noexcept;
- Q_DECL_CONSTEXPR qreal bottom() const noexcept;
+ constexpr qreal left() const noexcept;
+ constexpr qreal top() const noexcept;
+ constexpr qreal right() const noexcept;
+ constexpr qreal bottom() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setLeft(qreal left) noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setTop(qreal top) noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setRight(qreal right) noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setBottom(qreal bottom) noexcept;
+ constexpr void setLeft(qreal left) noexcept;
+ constexpr void setTop(qreal top) noexcept;
+ constexpr void setRight(qreal right) noexcept;
+ constexpr void setBottom(qreal bottom) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator+=(const QMarginsF &margins) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator-=(const QMarginsF &margins) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator+=(qreal addend) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator-=(qreal subtrahend) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator*=(qreal factor) noexcept;
- Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator/=(qreal divisor);
+ constexpr QMarginsF &operator+=(const QMarginsF &margins) noexcept;
+ constexpr QMarginsF &operator-=(const QMarginsF &margins) noexcept;
+ constexpr QMarginsF &operator+=(qreal addend) noexcept;
+ constexpr QMarginsF &operator-=(qreal subtrahend) noexcept;
+ constexpr QMarginsF &operator*=(qreal factor) noexcept;
+ constexpr QMarginsF &operator/=(qreal divisor);
- Q_DECL_CONSTEXPR inline QMargins toMargins() const noexcept;
+ constexpr inline QMargins toMargins() const noexcept;
private:
qreal m_left;
@@ -338,44 +338,44 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMarginsF &);
QMarginsF inline functions
*****************************************************************************/
-Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF() noexcept
+constexpr inline QMarginsF::QMarginsF() noexcept
: m_left(0), m_top(0), m_right(0), m_bottom(0) {}
-Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom) noexcept
+constexpr inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom) noexcept
: m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
-Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(const QMargins &margins) noexcept
+constexpr inline QMarginsF::QMarginsF(const QMargins &margins) noexcept
: m_left(margins.left()), m_top(margins.top()), m_right(margins.right()), m_bottom(margins.bottom()) {}
-Q_DECL_CONSTEXPR inline bool QMarginsF::isNull() const noexcept
+constexpr inline bool QMarginsF::isNull() const noexcept
{ return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); }
-Q_DECL_CONSTEXPR inline qreal QMarginsF::left() const noexcept
+constexpr inline qreal QMarginsF::left() const noexcept
{ return m_left; }
-Q_DECL_CONSTEXPR inline qreal QMarginsF::top() const noexcept
+constexpr inline qreal QMarginsF::top() const noexcept
{ return m_top; }
-Q_DECL_CONSTEXPR inline qreal QMarginsF::right() const noexcept
+constexpr inline qreal QMarginsF::right() const noexcept
{ return m_right; }
-Q_DECL_CONSTEXPR inline qreal QMarginsF::bottom() const noexcept
+constexpr inline qreal QMarginsF::bottom() const noexcept
{ return m_bottom; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setLeft(qreal aleft) noexcept
+constexpr inline void QMarginsF::setLeft(qreal aleft) noexcept
{ m_left = aleft; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setTop(qreal atop) noexcept
+constexpr inline void QMarginsF::setTop(qreal atop) noexcept
{ m_top = atop; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setRight(qreal aright) noexcept
+constexpr inline void QMarginsF::setRight(qreal aright) noexcept
{ m_right = aright; }
-Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setBottom(qreal abottom) noexcept
+constexpr inline void QMarginsF::setBottom(qreal abottom) noexcept
{ m_bottom = abottom; }
-Q_DECL_CONSTEXPR inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
+constexpr inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
{
return qFuzzyCompare(lhs.left(), rhs.left())
&& qFuzzyCompare(lhs.top(), rhs.top())
@@ -383,76 +383,76 @@ Q_DECL_CONSTEXPR inline bool operator==(const QMarginsF &lhs, const QMarginsF &r
&& qFuzzyCompare(lhs.bottom(), rhs.bottom());
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
+constexpr inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
{
return !operator==(lhs, rhs);
}
-Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
+constexpr inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
{
return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(),
lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom());
}
-Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
+constexpr inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
{
return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(),
lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom());
}
-Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs) noexcept
+constexpr inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs) noexcept
{
return QMarginsF(lhs.left() + rhs, lhs.top() + rhs,
lhs.right() + rhs, lhs.bottom() + rhs);
}
-Q_DECL_CONSTEXPR inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs) noexcept
+constexpr inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs) noexcept
{
return QMarginsF(rhs.left() + lhs, rhs.top() + lhs,
rhs.right() + lhs, rhs.bottom() + lhs);
}
-Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs) noexcept
+constexpr inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs) noexcept
{
return QMarginsF(lhs.left() - rhs, lhs.top() - rhs,
lhs.right() - rhs, lhs.bottom() - rhs);
}
-Q_DECL_CONSTEXPR inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept
+constexpr inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept
{
return QMarginsF(lhs.left() * rhs, lhs.top() * rhs,
lhs.right() * rhs, lhs.bottom() * rhs);
}
-Q_DECL_CONSTEXPR inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs) noexcept
+constexpr inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs) noexcept
{
return QMarginsF(rhs.left() * lhs, rhs.top() * lhs,
rhs.right() * lhs, rhs.bottom() * lhs);
}
-Q_DECL_CONSTEXPR inline QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
+constexpr inline QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
{
return QMarginsF(lhs.left() / divisor, lhs.top() / divisor,
lhs.right() / divisor, lhs.bottom() / divisor);
}
-Q_DECL_CONSTEXPR inline QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2) noexcept
+constexpr inline QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2) noexcept
{
return QMarginsF(qMax(m1.left(), m2.left()), qMax(m1.top(), m2.top()),
qMax(m1.right(), m2.right()), qMax(m1.bottom(), m2.bottom()));
}
-Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) noexcept
+constexpr inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) noexcept
{
return *this = *this + margins;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) noexcept
+constexpr inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) noexcept
{
return *this = *this - margins;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(qreal addend) noexcept
+constexpr inline QMarginsF &QMarginsF::operator+=(qreal addend) noexcept
{
m_left += addend;
m_top += addend;
@@ -461,7 +461,7 @@ Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(qreal addend) n
return *this;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(qreal subtrahend) noexcept
+constexpr inline QMarginsF &QMarginsF::operator-=(qreal subtrahend) noexcept
{
m_left -= subtrahend;
m_top -= subtrahend;
@@ -470,27 +470,27 @@ Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(qreal subtrahen
return *this;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator*=(qreal factor) noexcept
+constexpr inline QMarginsF &QMarginsF::operator*=(qreal factor) noexcept
{
return *this = *this * factor;
}
-Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator/=(qreal divisor)
+constexpr inline QMarginsF &QMarginsF::operator/=(qreal divisor)
{
return *this = *this / divisor;
}
-Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &margins) noexcept
+constexpr inline QMarginsF operator+(const QMarginsF &margins) noexcept
{
return margins;
}
-Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &margins) noexcept
+constexpr inline QMarginsF operator-(const QMarginsF &margins) noexcept
{
return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
}
-Q_DECL_CONSTEXPR inline QMargins QMarginsF::toMargins() const noexcept
+constexpr inline QMargins QMarginsF::toMargins() const noexcept
{
return QMargins(qRound(m_left), qRound(m_top), qRound(m_right), qRound(m_bottom));
}
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index b07e134dd7..cfe92e81e6 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -58,75 +58,75 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QRect
{
public:
- Q_DECL_CONSTEXPR QRect() noexcept : x1(0), y1(0), x2(-1), y2(-1) {}
- Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QPoint &bottomright) noexcept;
- Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QSize &size) noexcept;
- Q_DECL_CONSTEXPR QRect(int left, int top, int width, int height) noexcept;
-
- Q_DECL_CONSTEXPR inline bool isNull() const noexcept;
- Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept;
- Q_DECL_CONSTEXPR inline bool isValid() const noexcept;
-
- Q_DECL_CONSTEXPR inline int left() const noexcept;
- Q_DECL_CONSTEXPR inline int top() const noexcept;
- Q_DECL_CONSTEXPR inline int right() const noexcept;
- Q_DECL_CONSTEXPR inline int bottom() const noexcept;
+ constexpr QRect() noexcept : x1(0), y1(0), x2(-1), y2(-1) {}
+ constexpr QRect(const QPoint &topleft, const QPoint &bottomright) noexcept;
+ constexpr QRect(const QPoint &topleft, const QSize &size) noexcept;
+ constexpr QRect(int left, int top, int width, int height) noexcept;
+
+ constexpr inline bool isNull() const noexcept;
+ constexpr inline bool isEmpty() const noexcept;
+ constexpr inline bool isValid() const noexcept;
+
+ constexpr inline int left() const noexcept;
+ constexpr inline int top() const noexcept;
+ constexpr inline int right() const noexcept;
+ constexpr inline int bottom() const noexcept;
Q_REQUIRED_RESULT QRect normalized() const noexcept;
- Q_DECL_CONSTEXPR inline int x() const noexcept;
- Q_DECL_CONSTEXPR inline int y() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setLeft(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setTop(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setRight(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setBottom(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setX(int x) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setY(int y) noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void setTopLeft(const QPoint &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setBottomRight(const QPoint &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setTopRight(const QPoint &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setBottomLeft(const QPoint &p) noexcept;
-
- Q_DECL_CONSTEXPR inline QPoint topLeft() const noexcept;
- Q_DECL_CONSTEXPR inline QPoint bottomRight() const noexcept;
- Q_DECL_CONSTEXPR inline QPoint topRight() const noexcept;
- Q_DECL_CONSTEXPR inline QPoint bottomLeft() const noexcept;
- Q_DECL_CONSTEXPR inline QPoint center() const noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void moveLeft(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTop(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveRight(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveBottom(int pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTopLeft(const QPoint &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveBottomRight(const QPoint &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTopRight(const QPoint &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveBottomLeft(const QPoint &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveCenter(const QPoint &p) noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void translate(int dx, int dy) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPoint &p) noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(int dx, int dy) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(const QPoint &p) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect transposed() const noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void moveTo(int x, int t) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPoint &p) noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void setRect(int x, int y, int w, int h) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void getRect(int *x, int *y, int *w, int *h) const;
-
- Q_DECL_RELAXED_CONSTEXPR inline void setCoords(int x1, int y1, int x2, int y2) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void getCoords(int *x1, int *y1, int *x2, int *y2) const;
-
- Q_DECL_RELAXED_CONSTEXPR inline void adjust(int x1, int y1, int x2, int y2) noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect adjusted(int x1, int y1, int x2, int y2) const noexcept;
-
- Q_DECL_CONSTEXPR inline QSize size() const noexcept;
- Q_DECL_CONSTEXPR inline int width() const noexcept;
- Q_DECL_CONSTEXPR inline int height() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setSize(const QSize &s) noexcept;
+ constexpr inline int x() const noexcept;
+ constexpr inline int y() const noexcept;
+ constexpr inline void setLeft(int pos) noexcept;
+ constexpr inline void setTop(int pos) noexcept;
+ constexpr inline void setRight(int pos) noexcept;
+ constexpr inline void setBottom(int pos) noexcept;
+ constexpr inline void setX(int x) noexcept;
+ constexpr inline void setY(int y) noexcept;
+
+ constexpr inline void setTopLeft(const QPoint &p) noexcept;
+ constexpr inline void setBottomRight(const QPoint &p) noexcept;
+ constexpr inline void setTopRight(const QPoint &p) noexcept;
+ constexpr inline void setBottomLeft(const QPoint &p) noexcept;
+
+ constexpr inline QPoint topLeft() const noexcept;
+ constexpr inline QPoint bottomRight() const noexcept;
+ constexpr inline QPoint topRight() const noexcept;
+ constexpr inline QPoint bottomLeft() const noexcept;
+ constexpr inline QPoint center() const noexcept;
+
+ constexpr inline void moveLeft(int pos) noexcept;
+ constexpr inline void moveTop(int pos) noexcept;
+ constexpr inline void moveRight(int pos) noexcept;
+ constexpr inline void moveBottom(int pos) noexcept;
+ constexpr inline void moveTopLeft(const QPoint &p) noexcept;
+ constexpr inline void moveBottomRight(const QPoint &p) noexcept;
+ constexpr inline void moveTopRight(const QPoint &p) noexcept;
+ constexpr inline void moveBottomLeft(const QPoint &p) noexcept;
+ constexpr inline void moveCenter(const QPoint &p) noexcept;
+
+ constexpr inline void translate(int dx, int dy) noexcept;
+ constexpr inline void translate(const QPoint &p) noexcept;
+ Q_REQUIRED_RESULT constexpr inline QRect translated(int dx, int dy) const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QRect translated(const QPoint &p) const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QRect transposed() const noexcept;
+
+ constexpr inline void moveTo(int x, int t) noexcept;
+ constexpr inline void moveTo(const QPoint &p) noexcept;
+
+ constexpr inline void setRect(int x, int y, int w, int h) noexcept;
+ constexpr inline void getRect(int *x, int *y, int *w, int *h) const;
+
+ constexpr inline void setCoords(int x1, int y1, int x2, int y2) noexcept;
+ constexpr inline void getCoords(int *x1, int *y1, int *x2, int *y2) const;
+
+ constexpr inline void adjust(int x1, int y1, int x2, int y2) noexcept;
+ Q_REQUIRED_RESULT constexpr inline QRect adjusted(int x1, int y1, int x2, int y2) const noexcept;
+
+ constexpr inline QSize size() const noexcept;
+ constexpr inline int width() const noexcept;
+ constexpr inline int height() const noexcept;
+ constexpr inline void setWidth(int w) noexcept;
+ constexpr inline void setHeight(int h) noexcept;
+ constexpr inline void setSize(const QSize &s) noexcept;
QRect operator|(const QRect &r) const noexcept;
QRect operator&(const QRect &r) const noexcept;
@@ -141,14 +141,14 @@ public:
Q_REQUIRED_RESULT inline QRect intersected(const QRect &other) const noexcept;
bool intersects(const QRect &r) const noexcept;
- Q_DECL_CONSTEXPR inline QRect marginsAdded(const QMargins &margins) const noexcept;
- Q_DECL_CONSTEXPR inline QRect marginsRemoved(const QMargins &margins) const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QRect &operator+=(const QMargins &margins) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QRect &operator-=(const QMargins &margins) noexcept;
+ constexpr inline QRect marginsAdded(const QMargins &margins) const noexcept;
+ constexpr inline QRect marginsRemoved(const QMargins &margins) const noexcept;
+ constexpr inline QRect &operator+=(const QMargins &margins) noexcept;
+ constexpr inline QRect &operator-=(const QMargins &margins) noexcept;
- friend Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) noexcept;
- friend Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) noexcept;
- friend Q_DECL_CONSTEXPR inline size_t qHash(const QRect &, size_t) noexcept;
+ friend constexpr inline bool operator==(const QRect &, const QRect &) noexcept;
+ friend constexpr inline bool operator!=(const QRect &, const QRect &) noexcept;
+ friend constexpr inline size_t qHash(const QRect &, size_t) noexcept;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_REQUIRED_RESULT CGRect toCGRect() const noexcept;
@@ -162,8 +162,8 @@ private:
};
Q_DECLARE_TYPEINFO(QRect, Q_MOVABLE_TYPE);
-Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) noexcept;
-Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) noexcept;
+constexpr inline bool operator==(const QRect &, const QRect &) noexcept;
+constexpr inline bool operator!=(const QRect &, const QRect &) noexcept;
/*****************************************************************************
@@ -178,97 +178,97 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRect &);
QRect inline member functions
*****************************************************************************/
-Q_DECL_CONSTEXPR inline QRect::QRect(int aleft, int atop, int awidth, int aheight) noexcept
+constexpr inline QRect::QRect(int aleft, int atop, int awidth, int aheight) noexcept
: x1(aleft), y1(atop), x2(aleft + awidth - 1), y2(atop + aheight - 1) {}
-Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight) noexcept
+constexpr inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight) noexcept
: x1(atopLeft.x()), y1(atopLeft.y()), x2(abottomRight.x()), y2(abottomRight.y()) {}
-Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QSize &asize) noexcept
+constexpr inline QRect::QRect(const QPoint &atopLeft, const QSize &asize) noexcept
: x1(atopLeft.x()), y1(atopLeft.y()), x2(atopLeft.x()+asize.width() - 1), y2(atopLeft.y()+asize.height() - 1) {}
-Q_DECL_CONSTEXPR inline bool QRect::isNull() const noexcept
+constexpr inline bool QRect::isNull() const noexcept
{ return x2 == x1 - 1 && y2 == y1 - 1; }
-Q_DECL_CONSTEXPR inline bool QRect::isEmpty() const noexcept
+constexpr inline bool QRect::isEmpty() const noexcept
{ return x1 > x2 || y1 > y2; }
-Q_DECL_CONSTEXPR inline bool QRect::isValid() const noexcept
+constexpr inline bool QRect::isValid() const noexcept
{ return x1 <= x2 && y1 <= y2; }
-Q_DECL_CONSTEXPR inline int QRect::left() const noexcept
+constexpr inline int QRect::left() const noexcept
{ return x1; }
-Q_DECL_CONSTEXPR inline int QRect::top() const noexcept
+constexpr inline int QRect::top() const noexcept
{ return y1; }
-Q_DECL_CONSTEXPR inline int QRect::right() const noexcept
+constexpr inline int QRect::right() const noexcept
{ return x2; }
-Q_DECL_CONSTEXPR inline int QRect::bottom() const noexcept
+constexpr inline int QRect::bottom() const noexcept
{ return y2; }
-Q_DECL_CONSTEXPR inline int QRect::x() const noexcept
+constexpr inline int QRect::x() const noexcept
{ return x1; }
-Q_DECL_CONSTEXPR inline int QRect::y() const noexcept
+constexpr inline int QRect::y() const noexcept
{ return y1; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setLeft(int pos) noexcept
+constexpr inline void QRect::setLeft(int pos) noexcept
{ x1 = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTop(int pos) noexcept
+constexpr inline void QRect::setTop(int pos) noexcept
{ y1 = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setRight(int pos) noexcept
+constexpr inline void QRect::setRight(int pos) noexcept
{ x2 = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottom(int pos) noexcept
+constexpr inline void QRect::setBottom(int pos) noexcept
{ y2 = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTopLeft(const QPoint &p) noexcept
+constexpr inline void QRect::setTopLeft(const QPoint &p) noexcept
{ x1 = p.x(); y1 = p.y(); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottomRight(const QPoint &p) noexcept
+constexpr inline void QRect::setBottomRight(const QPoint &p) noexcept
{ x2 = p.x(); y2 = p.y(); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTopRight(const QPoint &p) noexcept
+constexpr inline void QRect::setTopRight(const QPoint &p) noexcept
{ x2 = p.x(); y1 = p.y(); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottomLeft(const QPoint &p) noexcept
+constexpr inline void QRect::setBottomLeft(const QPoint &p) noexcept
{ x1 = p.x(); y2 = p.y(); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setX(int ax) noexcept
+constexpr inline void QRect::setX(int ax) noexcept
{ x1 = ax; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setY(int ay) noexcept
+constexpr inline void QRect::setY(int ay) noexcept
{ y1 = ay; }
-Q_DECL_CONSTEXPR inline QPoint QRect::topLeft() const noexcept
+constexpr inline QPoint QRect::topLeft() const noexcept
{ return QPoint(x1, y1); }
-Q_DECL_CONSTEXPR inline QPoint QRect::bottomRight() const noexcept
+constexpr inline QPoint QRect::bottomRight() const noexcept
{ return QPoint(x2, y2); }
-Q_DECL_CONSTEXPR inline QPoint QRect::topRight() const noexcept
+constexpr inline QPoint QRect::topRight() const noexcept
{ return QPoint(x2, y1); }
-Q_DECL_CONSTEXPR inline QPoint QRect::bottomLeft() const noexcept
+constexpr inline QPoint QRect::bottomLeft() const noexcept
{ return QPoint(x1, y2); }
-Q_DECL_CONSTEXPR inline QPoint QRect::center() const noexcept
+constexpr inline QPoint QRect::center() const noexcept
{ return QPoint(int((qint64(x1)+x2)/2), int((qint64(y1)+y2)/2)); } // cast avoids overflow on addition
-Q_DECL_CONSTEXPR inline int QRect::width() const noexcept
+constexpr inline int QRect::width() const noexcept
{ return x2 - x1 + 1; }
-Q_DECL_CONSTEXPR inline int QRect::height() const noexcept
+constexpr inline int QRect::height() const noexcept
{ return y2 - y1 + 1; }
-Q_DECL_CONSTEXPR inline QSize QRect::size() const noexcept
+constexpr inline QSize QRect::size() const noexcept
{ return QSize(width(), height()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(int dx, int dy) noexcept
+constexpr inline void QRect::translate(int dx, int dy) noexcept
{
x1 += dx;
y1 += dy;
@@ -276,7 +276,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(int dx, int dy) noexcept
y2 += dy;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(const QPoint &p) noexcept
+constexpr inline void QRect::translate(const QPoint &p) noexcept
{
x1 += p.x();
y1 += p.y();
@@ -284,16 +284,16 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(const QPoint &p) noexcept
y2 += p.y();
}
-Q_DECL_CONSTEXPR inline QRect QRect::translated(int dx, int dy) const noexcept
+constexpr inline QRect QRect::translated(int dx, int dy) const noexcept
{ return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); }
-Q_DECL_CONSTEXPR inline QRect QRect::translated(const QPoint &p) const noexcept
+constexpr inline QRect QRect::translated(const QPoint &p) const noexcept
{ return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); }
-Q_DECL_CONSTEXPR inline QRect QRect::transposed() const noexcept
+constexpr inline QRect QRect::transposed() const noexcept
{ return QRect(topLeft(), size().transposed()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(int ax, int ay) noexcept
+constexpr inline void QRect::moveTo(int ax, int ay) noexcept
{
x2 += ax - x1;
y2 += ay - y1;
@@ -301,7 +301,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(int ax, int ay) noexcept
y1 = ay;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(const QPoint &p) noexcept
+constexpr inline void QRect::moveTo(const QPoint &p) noexcept
{
x2 += p.x() - x1;
y2 += p.y() - y1;
@@ -309,49 +309,49 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(const QPoint &p) noexcept
y1 = p.y();
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveLeft(int pos) noexcept
+constexpr inline void QRect::moveLeft(int pos) noexcept
{ x2 += (pos - x1); x1 = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTop(int pos) noexcept
+constexpr inline void QRect::moveTop(int pos) noexcept
{ y2 += (pos - y1); y1 = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveRight(int pos) noexcept
+constexpr inline void QRect::moveRight(int pos) noexcept
{
x1 += (pos - x2);
x2 = pos;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottom(int pos) noexcept
+constexpr inline void QRect::moveBottom(int pos) noexcept
{
y1 += (pos - y2);
y2 = pos;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTopLeft(const QPoint &p) noexcept
+constexpr inline void QRect::moveTopLeft(const QPoint &p) noexcept
{
moveLeft(p.x());
moveTop(p.y());
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottomRight(const QPoint &p) noexcept
+constexpr inline void QRect::moveBottomRight(const QPoint &p) noexcept
{
moveRight(p.x());
moveBottom(p.y());
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTopRight(const QPoint &p) noexcept
+constexpr inline void QRect::moveTopRight(const QPoint &p) noexcept
{
moveRight(p.x());
moveTop(p.y());
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottomLeft(const QPoint &p) noexcept
+constexpr inline void QRect::moveBottomLeft(const QPoint &p) noexcept
{
moveLeft(p.x());
moveBottom(p.y());
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveCenter(const QPoint &p) noexcept
+constexpr inline void QRect::moveCenter(const QPoint &p) noexcept
{
int w = x2 - x1;
int h = y2 - y1;
@@ -361,7 +361,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveCenter(const QPoint &p) noexcept
y2 = y1 + h;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::getRect(int *ax, int *ay, int *aw, int *ah) const
+constexpr inline void QRect::getRect(int *ax, int *ay, int *aw, int *ah) const
{
*ax = x1;
*ay = y1;
@@ -369,7 +369,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::getRect(int *ax, int *ay, int *aw, i
*ah = y2 - y1 + 1;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setRect(int ax, int ay, int aw, int ah) noexcept
+constexpr inline void QRect::setRect(int ax, int ay, int aw, int ah) noexcept
{
x1 = ax;
y1 = ay;
@@ -377,7 +377,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::setRect(int ax, int ay, int aw, int
y2 = (ay + ah - 1);
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const
+constexpr inline void QRect::getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const
{
*xp1 = x1;
*yp1 = y1;
@@ -385,7 +385,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::getCoords(int *xp1, int *yp1, int *x
*yp2 = y2;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2) noexcept
+constexpr inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2) noexcept
{
x1 = xp1;
y1 = yp1;
@@ -393,10 +393,10 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::setCoords(int xp1, int yp1, int xp2,
y2 = yp2;
}
-Q_DECL_CONSTEXPR inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const noexcept
+constexpr inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const noexcept
{ return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2) noexcept
+constexpr inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2) noexcept
{
x1 += dx1;
y1 += dy1;
@@ -404,13 +404,13 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::adjust(int dx1, int dy1, int dx2, in
y2 += dy2;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setWidth(int w) noexcept
+constexpr inline void QRect::setWidth(int w) noexcept
{ x2 = (x1 + w - 1); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setHeight(int h) noexcept
+constexpr inline void QRect::setHeight(int h) noexcept
{ y2 = (y1 + h - 1); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRect::setSize(const QSize &s) noexcept
+constexpr inline void QRect::setSize(const QSize &s) noexcept
{
x2 = (s.width() + x1 - 1);
y2 = (s.height() + y1 - 1);
@@ -448,58 +448,58 @@ inline QRect QRect::united(const QRect &r) const noexcept
return *this | r;
}
-Q_DECL_CONSTEXPR inline bool operator==(const QRect &r1, const QRect &r2) noexcept
+constexpr inline bool operator==(const QRect &r1, const QRect &r2) noexcept
{
return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QRect &r1, const QRect &r2) noexcept
+constexpr inline bool operator!=(const QRect &r1, const QRect &r2) noexcept
{
return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2;
}
-Q_DECL_CONSTEXPR inline size_t qHash(const QRect &r, size_t seed = 0) noexcept
+constexpr inline size_t qHash(const QRect &r, size_t seed = 0) noexcept
{
return qHashMulti(seed, r.x1, r.x2, r.y1, r.y2);
}
-Q_DECL_CONSTEXPR inline QRect operator+(const QRect &rectangle, const QMargins &margins) noexcept
+constexpr inline QRect operator+(const QRect &rectangle, const QMargins &margins) noexcept
{
return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
}
-Q_DECL_CONSTEXPR inline QRect operator+(const QMargins &margins, const QRect &rectangle) noexcept
+constexpr inline QRect operator+(const QMargins &margins, const QRect &rectangle) noexcept
{
return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
}
-Q_DECL_CONSTEXPR inline QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept
+constexpr inline QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept
{
return QRect(QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom()));
}
-Q_DECL_CONSTEXPR inline QRect QRect::marginsAdded(const QMargins &margins) const noexcept
+constexpr inline QRect QRect::marginsAdded(const QMargins &margins) const noexcept
{
return QRect(QPoint(x1 - margins.left(), y1 - margins.top()),
QPoint(x2 + margins.right(), y2 + margins.bottom()));
}
-Q_DECL_CONSTEXPR inline QRect QRect::marginsRemoved(const QMargins &margins) const noexcept
+constexpr inline QRect QRect::marginsRemoved(const QMargins &margins) const noexcept
{
return QRect(QPoint(x1 + margins.left(), y1 + margins.top()),
QPoint(x2 - margins.right(), y2 - margins.bottom()));
}
-Q_DECL_RELAXED_CONSTEXPR inline QRect &QRect::operator+=(const QMargins &margins) noexcept
+constexpr inline QRect &QRect::operator+=(const QMargins &margins) noexcept
{
*this = marginsAdded(margins);
return *this;
}
-Q_DECL_RELAXED_CONSTEXPR inline QRect &QRect::operator-=(const QMargins &margins) noexcept
+constexpr inline QRect &QRect::operator-=(const QMargins &margins) noexcept
{
*this = marginsRemoved(margins);
return *this;
@@ -513,78 +513,78 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &);
class Q_CORE_EXPORT QRectF
{
public:
- Q_DECL_CONSTEXPR QRectF() noexcept : xp(0.), yp(0.), w(0.), h(0.) {}
- Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QSizeF &size) noexcept;
- Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QPointF &bottomRight) noexcept;
- Q_DECL_CONSTEXPR QRectF(qreal left, qreal top, qreal width, qreal height) noexcept;
- Q_DECL_CONSTEXPR QRectF(const QRect &rect) noexcept;
-
- Q_DECL_CONSTEXPR inline bool isNull() const noexcept;
- Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept;
- Q_DECL_CONSTEXPR inline bool isValid() const noexcept;
+ constexpr QRectF() noexcept : xp(0.), yp(0.), w(0.), h(0.) {}
+ constexpr QRectF(const QPointF &topleft, const QSizeF &size) noexcept;
+ constexpr QRectF(const QPointF &topleft, const QPointF &bottomRight) noexcept;
+ constexpr QRectF(qreal left, qreal top, qreal width, qreal height) noexcept;
+ constexpr QRectF(const QRect &rect) noexcept;
+
+ constexpr inline bool isNull() const noexcept;
+ constexpr inline bool isEmpty() const noexcept;
+ constexpr inline bool isValid() const noexcept;
Q_REQUIRED_RESULT QRectF normalized() const noexcept;
- Q_DECL_CONSTEXPR inline qreal left() const noexcept { return xp; }
- Q_DECL_CONSTEXPR inline qreal top() const noexcept { return yp; }
- Q_DECL_CONSTEXPR inline qreal right() const noexcept { return xp + w; }
- Q_DECL_CONSTEXPR inline qreal bottom() const noexcept { return yp + h; }
-
- Q_DECL_CONSTEXPR inline qreal x() const noexcept;
- Q_DECL_CONSTEXPR inline qreal y() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setLeft(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setTop(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setRight(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setBottom(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setX(qreal pos) noexcept { setLeft(pos); }
- Q_DECL_RELAXED_CONSTEXPR inline void setY(qreal pos) noexcept { setTop(pos); }
-
- Q_DECL_CONSTEXPR inline QPointF topLeft() const noexcept { return QPointF(xp, yp); }
- Q_DECL_CONSTEXPR inline QPointF bottomRight() const noexcept { return QPointF(xp+w, yp+h); }
- Q_DECL_CONSTEXPR inline QPointF topRight() const noexcept { return QPointF(xp+w, yp); }
- Q_DECL_CONSTEXPR inline QPointF bottomLeft() const noexcept { return QPointF(xp, yp+h); }
- Q_DECL_CONSTEXPR inline QPointF center() const noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void setTopLeft(const QPointF &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setBottomRight(const QPointF &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setTopRight(const QPointF &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setBottomLeft(const QPointF &p) noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void moveLeft(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTop(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveRight(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveBottom(qreal pos) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTopLeft(const QPointF &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveBottomRight(const QPointF &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTopRight(const QPointF &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveBottomLeft(const QPointF &p) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveCenter(const QPointF &p) noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void translate(qreal dx, qreal dy) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPointF &p) noexcept;
-
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(qreal dx, qreal dy) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(const QPointF &p) const noexcept;
-
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF transposed() const noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void moveTo(qreal x, qreal y) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPointF &p) noexcept;
-
- Q_DECL_RELAXED_CONSTEXPR inline void setRect(qreal x, qreal y, qreal w, qreal h) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const;
-
- Q_DECL_RELAXED_CONSTEXPR inline void setCoords(qreal x1, qreal y1, qreal x2, qreal y2) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const;
-
- Q_DECL_RELAXED_CONSTEXPR inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept;
-
- Q_DECL_CONSTEXPR inline QSizeF size() const noexcept;
- Q_DECL_CONSTEXPR inline qreal width() const noexcept;
- Q_DECL_CONSTEXPR inline qreal height() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setSize(const QSizeF &s) noexcept;
+ constexpr inline qreal left() const noexcept { return xp; }
+ constexpr inline qreal top() const noexcept { return yp; }
+ constexpr inline qreal right() const noexcept { return xp + w; }
+ constexpr inline qreal bottom() const noexcept { return yp + h; }
+
+ constexpr inline qreal x() const noexcept;
+ constexpr inline qreal y() const noexcept;
+ constexpr inline void setLeft(qreal pos) noexcept;
+ constexpr inline void setTop(qreal pos) noexcept;
+ constexpr inline void setRight(qreal pos) noexcept;
+ constexpr inline void setBottom(qreal pos) noexcept;
+ constexpr inline void setX(qreal pos) noexcept { setLeft(pos); }
+ constexpr inline void setY(qreal pos) noexcept { setTop(pos); }
+
+ constexpr inline QPointF topLeft() const noexcept { return QPointF(xp, yp); }
+ constexpr inline QPointF bottomRight() const noexcept { return QPointF(xp+w, yp+h); }
+ constexpr inline QPointF topRight() const noexcept { return QPointF(xp+w, yp); }
+ constexpr inline QPointF bottomLeft() const noexcept { return QPointF(xp, yp+h); }
+ constexpr inline QPointF center() const noexcept;
+
+ constexpr inline void setTopLeft(const QPointF &p) noexcept;
+ constexpr inline void setBottomRight(const QPointF &p) noexcept;
+ constexpr inline void setTopRight(const QPointF &p) noexcept;
+ constexpr inline void setBottomLeft(const QPointF &p) noexcept;
+
+ constexpr inline void moveLeft(qreal pos) noexcept;
+ constexpr inline void moveTop(qreal pos) noexcept;
+ constexpr inline void moveRight(qreal pos) noexcept;
+ constexpr inline void moveBottom(qreal pos) noexcept;
+ constexpr inline void moveTopLeft(const QPointF &p) noexcept;
+ constexpr inline void moveBottomRight(const QPointF &p) noexcept;
+ constexpr inline void moveTopRight(const QPointF &p) noexcept;
+ constexpr inline void moveBottomLeft(const QPointF &p) noexcept;
+ constexpr inline void moveCenter(const QPointF &p) noexcept;
+
+ constexpr inline void translate(qreal dx, qreal dy) noexcept;
+ constexpr inline void translate(const QPointF &p) noexcept;
+
+ Q_REQUIRED_RESULT constexpr inline QRectF translated(qreal dx, qreal dy) const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QRectF translated(const QPointF &p) const noexcept;
+
+ Q_REQUIRED_RESULT constexpr inline QRectF transposed() const noexcept;
+
+ constexpr inline void moveTo(qreal x, qreal y) noexcept;
+ constexpr inline void moveTo(const QPointF &p) noexcept;
+
+ constexpr inline void setRect(qreal x, qreal y, qreal w, qreal h) noexcept;
+ constexpr inline void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const;
+
+ constexpr inline void setCoords(qreal x1, qreal y1, qreal x2, qreal y2) noexcept;
+ constexpr inline void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const;
+
+ constexpr inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept;
+ Q_REQUIRED_RESULT constexpr inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept;
+
+ constexpr inline QSizeF size() const noexcept;
+ constexpr inline qreal width() const noexcept;
+ constexpr inline qreal height() const noexcept;
+ constexpr inline void setWidth(qreal w) noexcept;
+ constexpr inline void setHeight(qreal h) noexcept;
+ constexpr inline void setSize(const QSizeF &s) noexcept;
QRectF operator|(const QRectF &r) const noexcept;
QRectF operator&(const QRectF &r) const noexcept;
@@ -598,15 +598,15 @@ public:
Q_REQUIRED_RESULT inline QRectF intersected(const QRectF &other) const noexcept;
bool intersects(const QRectF &r) const noexcept;
- Q_DECL_CONSTEXPR inline QRectF marginsAdded(const QMarginsF &margins) const noexcept;
- Q_DECL_CONSTEXPR inline QRectF marginsRemoved(const QMarginsF &margins) const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator+=(const QMarginsF &margins) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator-=(const QMarginsF &margins) noexcept;
+ constexpr inline QRectF marginsAdded(const QMarginsF &margins) const noexcept;
+ constexpr inline QRectF marginsRemoved(const QMarginsF &margins) const noexcept;
+ constexpr inline QRectF &operator+=(const QMarginsF &margins) noexcept;
+ constexpr inline QRectF &operator-=(const QMarginsF &margins) noexcept;
- friend Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &) noexcept;
- friend Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &) noexcept;
+ friend constexpr inline bool operator==(const QRectF &, const QRectF &) noexcept;
+ friend constexpr inline bool operator!=(const QRectF &, const QRectF &) noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect toRect() const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QRect toRect() const noexcept;
Q_REQUIRED_RESULT QRect toAlignedRect() const noexcept;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
@@ -622,8 +622,8 @@ private:
};
Q_DECLARE_TYPEINFO(QRectF, Q_MOVABLE_TYPE);
-Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &) noexcept;
-Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &) noexcept;
+constexpr inline bool operator==(const QRectF &, const QRectF &) noexcept;
+constexpr inline bool operator!=(const QRectF &, const QRectF &) noexcept;
/*****************************************************************************
@@ -638,23 +638,23 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRectF &);
QRectF inline member functions
*****************************************************************************/
-Q_DECL_CONSTEXPR inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight) noexcept
+constexpr inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight) noexcept
: xp(aleft), yp(atop), w(awidth), h(aheight)
{
}
-Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize) noexcept
+constexpr inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize) noexcept
: xp(atopLeft.x()), yp(atopLeft.y()), w(asize.width()), h(asize.height())
{
}
-Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight) noexcept
+constexpr inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight) noexcept
: xp(atopLeft.x()), yp(atopLeft.y()), w(abottomRight.x() - atopLeft.x()), h(abottomRight.y() - atopLeft.y())
{
}
-Q_DECL_CONSTEXPR inline QRectF::QRectF(const QRect &r) noexcept
+constexpr inline QRectF::QRectF(const QRect &r) noexcept
: xp(r.x()), yp(r.y()), w(r.width()), h(r.height())
{
}
@@ -662,120 +662,120 @@ Q_DECL_CONSTEXPR inline QRectF::QRectF(const QRect &r) noexcept
QT_WARNING_PUSH
QT_WARNING_DISABLE_FLOAT_COMPARE
-Q_DECL_CONSTEXPR inline bool QRectF::isNull() const noexcept
+constexpr inline bool QRectF::isNull() const noexcept
{ return w == 0. && h == 0.; }
-Q_DECL_CONSTEXPR inline bool QRectF::isEmpty() const noexcept
+constexpr inline bool QRectF::isEmpty() const noexcept
{ return w <= 0. || h <= 0.; }
QT_WARNING_POP
-Q_DECL_CONSTEXPR inline bool QRectF::isValid() const noexcept
+constexpr inline bool QRectF::isValid() const noexcept
{ return w > 0. && h > 0.; }
-Q_DECL_CONSTEXPR inline qreal QRectF::x() const noexcept
+constexpr inline qreal QRectF::x() const noexcept
{ return xp; }
-Q_DECL_CONSTEXPR inline qreal QRectF::y() const noexcept
+constexpr inline qreal QRectF::y() const noexcept
{ return yp; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setLeft(qreal pos) noexcept
+constexpr inline void QRectF::setLeft(qreal pos) noexcept
{ qreal diff = pos - xp; xp += diff; w -= diff; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setRight(qreal pos) noexcept
+constexpr inline void QRectF::setRight(qreal pos) noexcept
{ w = pos - xp; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTop(qreal pos) noexcept
+constexpr inline void QRectF::setTop(qreal pos) noexcept
{ qreal diff = pos - yp; yp += diff; h -= diff; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottom(qreal pos) noexcept
+constexpr inline void QRectF::setBottom(qreal pos) noexcept
{ h = pos - yp; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTopLeft(const QPointF &p) noexcept
+constexpr inline void QRectF::setTopLeft(const QPointF &p) noexcept
{ setLeft(p.x()); setTop(p.y()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTopRight(const QPointF &p) noexcept
+constexpr inline void QRectF::setTopRight(const QPointF &p) noexcept
{ setRight(p.x()); setTop(p.y()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottomLeft(const QPointF &p) noexcept
+constexpr inline void QRectF::setBottomLeft(const QPointF &p) noexcept
{ setLeft(p.x()); setBottom(p.y()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottomRight(const QPointF &p) noexcept
+constexpr inline void QRectF::setBottomRight(const QPointF &p) noexcept
{ setRight(p.x()); setBottom(p.y()); }
-Q_DECL_CONSTEXPR inline QPointF QRectF::center() const noexcept
+constexpr inline QPointF QRectF::center() const noexcept
{ return QPointF(xp + w/2, yp + h/2); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveLeft(qreal pos) noexcept
+constexpr inline void QRectF::moveLeft(qreal pos) noexcept
{ xp = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTop(qreal pos) noexcept
+constexpr inline void QRectF::moveTop(qreal pos) noexcept
{ yp = pos; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveRight(qreal pos) noexcept
+constexpr inline void QRectF::moveRight(qreal pos) noexcept
{ xp = pos - w; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottom(qreal pos) noexcept
+constexpr inline void QRectF::moveBottom(qreal pos) noexcept
{ yp = pos - h; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTopLeft(const QPointF &p) noexcept
+constexpr inline void QRectF::moveTopLeft(const QPointF &p) noexcept
{ moveLeft(p.x()); moveTop(p.y()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTopRight(const QPointF &p) noexcept
+constexpr inline void QRectF::moveTopRight(const QPointF &p) noexcept
{ moveRight(p.x()); moveTop(p.y()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottomLeft(const QPointF &p) noexcept
+constexpr inline void QRectF::moveBottomLeft(const QPointF &p) noexcept
{ moveLeft(p.x()); moveBottom(p.y()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottomRight(const QPointF &p) noexcept
+constexpr inline void QRectF::moveBottomRight(const QPointF &p) noexcept
{ moveRight(p.x()); moveBottom(p.y()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveCenter(const QPointF &p) noexcept
+constexpr inline void QRectF::moveCenter(const QPointF &p) noexcept
{ xp = p.x() - w/2; yp = p.y() - h/2; }
-Q_DECL_CONSTEXPR inline qreal QRectF::width() const noexcept
+constexpr inline qreal QRectF::width() const noexcept
{ return w; }
-Q_DECL_CONSTEXPR inline qreal QRectF::height() const noexcept
+constexpr inline qreal QRectF::height() const noexcept
{ return h; }
-Q_DECL_CONSTEXPR inline QSizeF QRectF::size() const noexcept
+constexpr inline QSizeF QRectF::size() const noexcept
{ return QSizeF(w, h); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::translate(qreal dx, qreal dy) noexcept
+constexpr inline void QRectF::translate(qreal dx, qreal dy) noexcept
{
xp += dx;
yp += dy;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::translate(const QPointF &p) noexcept
+constexpr inline void QRectF::translate(const QPointF &p) noexcept
{
xp += p.x();
yp += p.y();
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTo(qreal ax, qreal ay) noexcept
+constexpr inline void QRectF::moveTo(qreal ax, qreal ay) noexcept
{
xp = ax;
yp = ay;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTo(const QPointF &p) noexcept
+constexpr inline void QRectF::moveTo(const QPointF &p) noexcept
{
xp = p.x();
yp = p.y();
}
-Q_DECL_CONSTEXPR inline QRectF QRectF::translated(qreal dx, qreal dy) const noexcept
+constexpr inline QRectF QRectF::translated(qreal dx, qreal dy) const noexcept
{ return QRectF(xp + dx, yp + dy, w, h); }
-Q_DECL_CONSTEXPR inline QRectF QRectF::translated(const QPointF &p) const noexcept
+constexpr inline QRectF QRectF::translated(const QPointF &p) const noexcept
{ return QRectF(xp + p.x(), yp + p.y(), w, h); }
-Q_DECL_CONSTEXPR inline QRectF QRectF::transposed() const noexcept
+constexpr inline QRectF QRectF::transposed() const noexcept
{ return QRectF(topLeft(), size().transposed()); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const
+constexpr inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const
{
*ax = this->xp;
*ay = this->yp;
@@ -783,7 +783,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRectF::getRect(qreal *ax, qreal *ay, qreal
*aah = this->h;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah) noexcept
+constexpr inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah) noexcept
{
this->xp = ax;
this->yp = ay;
@@ -791,7 +791,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setRect(qreal ax, qreal ay, qreal a
this->h = aah;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const
+constexpr inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const
{
*xp1 = xp;
*yp1 = yp;
@@ -799,7 +799,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRectF::getCoords(qreal *xp1, qreal *yp1, q
*yp2 = yp + h;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept
+constexpr inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept
{
xp = xp1;
yp = yp1;
@@ -807,19 +807,19 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setCoords(qreal xp1, qreal yp1, qre
h = yp2 - yp1;
}
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept
+constexpr inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept
{ xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; }
-Q_DECL_CONSTEXPR inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const noexcept
+constexpr inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const noexcept
{ return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setWidth(qreal aw) noexcept
+constexpr inline void QRectF::setWidth(qreal aw) noexcept
{ this->w = aw; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setHeight(qreal ah) noexcept
+constexpr inline void QRectF::setHeight(qreal ah) noexcept
{ this->h = ah; }
-Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setSize(const QSizeF &s) noexcept
+constexpr inline void QRectF::setSize(const QSizeF &s) noexcept
{
w = s.width();
h = s.height();
@@ -852,60 +852,60 @@ inline QRectF QRectF::united(const QRectF &r) const noexcept
return *this | r;
}
-Q_DECL_CONSTEXPR inline bool operator==(const QRectF &r1, const QRectF &r2) noexcept
+constexpr inline bool operator==(const QRectF &r1, const QRectF &r2) noexcept
{
return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp)
&& qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h);
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &r1, const QRectF &r2) noexcept
+constexpr inline bool operator!=(const QRectF &r1, const QRectF &r2) noexcept
{
return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp)
|| !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h);
}
-Q_DECL_CONSTEXPR inline QRect QRectF::toRect() const noexcept
+constexpr inline QRect QRectF::toRect() const noexcept
{
return QRect(QPoint(qRound(xp), qRound(yp)), QPoint(qRound(xp + w) - 1, qRound(yp + h) - 1));
}
-Q_DECL_CONSTEXPR inline QRectF operator+(const QRectF &lhs, const QMarginsF &rhs) noexcept
+constexpr inline QRectF operator+(const QRectF &lhs, const QMarginsF &rhs) noexcept
{
return QRectF(QPointF(lhs.left() - rhs.left(), lhs.top() - rhs.top()),
QSizeF(lhs.width() + rhs.left() + rhs.right(), lhs.height() + rhs.top() + rhs.bottom()));
}
-Q_DECL_CONSTEXPR inline QRectF operator+(const QMarginsF &lhs, const QRectF &rhs) noexcept
+constexpr inline QRectF operator+(const QMarginsF &lhs, const QRectF &rhs) noexcept
{
return QRectF(QPointF(rhs.left() - lhs.left(), rhs.top() - lhs.top()),
QSizeF(rhs.width() + lhs.left() + lhs.right(), rhs.height() + lhs.top() + lhs.bottom()));
}
-Q_DECL_CONSTEXPR inline QRectF operator-(const QRectF &lhs, const QMarginsF &rhs) noexcept
+constexpr inline QRectF operator-(const QRectF &lhs, const QMarginsF &rhs) noexcept
{
return QRectF(QPointF(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
QSizeF(lhs.width() - rhs.left() - rhs.right(), lhs.height() - rhs.top() - rhs.bottom()));
}
-Q_DECL_CONSTEXPR inline QRectF QRectF::marginsAdded(const QMarginsF &margins) const noexcept
+constexpr inline QRectF QRectF::marginsAdded(const QMarginsF &margins) const noexcept
{
return QRectF(QPointF(xp - margins.left(), yp - margins.top()),
QSizeF(w + margins.left() + margins.right(), h + margins.top() + margins.bottom()));
}
-Q_DECL_CONSTEXPR inline QRectF QRectF::marginsRemoved(const QMarginsF &margins) const noexcept
+constexpr inline QRectF QRectF::marginsRemoved(const QMarginsF &margins) const noexcept
{
return QRectF(QPointF(xp + margins.left(), yp + margins.top()),
QSizeF(w - margins.left() - margins.right(), h - margins.top() - margins.bottom()));
}
-Q_DECL_RELAXED_CONSTEXPR inline QRectF &QRectF::operator+=(const QMarginsF &margins) noexcept
+constexpr inline QRectF &QRectF::operator+=(const QMarginsF &margins) noexcept
{
*this = marginsAdded(margins);
return *this;
}
-Q_DECL_RELAXED_CONSTEXPR inline QRectF &QRectF::operator-=(const QMarginsF &margins) noexcept
+constexpr inline QRectF &QRectF::operator-=(const QMarginsF &margins) noexcept
{
*this = marginsRemoved(margins);
return *this;
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 5441b10989..235cbe144b 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -306,10 +306,10 @@ public:
T &operator*() const { return *data(); }
T *operator->() const noexcept { return data(); }
- Q_DECL_CONSTEXPR QSharedPointer() noexcept : value(nullptr), d(nullptr) { }
+ constexpr QSharedPointer() noexcept : value(nullptr), d(nullptr) { }
~QSharedPointer() { deref(); }
- Q_DECL_CONSTEXPR QSharedPointer(std::nullptr_t) noexcept : value(nullptr), d(nullptr) { }
+ constexpr QSharedPointer(std::nullptr_t) noexcept : value(nullptr), d(nullptr) { }
template <class X, IfCompatible<X> = true>
inline explicit QSharedPointer(X *ptr) : value(ptr) // noexcept
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index da778954ed..d2598afbea 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -54,48 +54,48 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QSize
{
public:
- Q_DECL_CONSTEXPR QSize() noexcept;
- Q_DECL_CONSTEXPR QSize(int w, int h) noexcept;
+ constexpr QSize() noexcept;
+ constexpr QSize(int w, int h) noexcept;
- Q_DECL_CONSTEXPR inline bool isNull() const noexcept;
- Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept;
- Q_DECL_CONSTEXPR inline bool isValid() const noexcept;
+ constexpr inline bool isNull() const noexcept;
+ constexpr inline bool isEmpty() const noexcept;
+ constexpr inline bool isValid() const noexcept;
- Q_DECL_CONSTEXPR inline int width() const noexcept;
- Q_DECL_CONSTEXPR inline int height() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) noexcept;
+ constexpr inline int width() const noexcept;
+ constexpr inline int height() const noexcept;
+ constexpr inline void setWidth(int w) noexcept;
+ constexpr inline void setHeight(int h) noexcept;
void transpose() noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize transposed() const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QSize transposed() const noexcept;
inline void scale(int w, int h, Qt::AspectRatioMode mode) noexcept;
inline void scale(const QSize &s, Qt::AspectRatioMode mode) noexcept;
Q_REQUIRED_RESULT QSize scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept;
Q_REQUIRED_RESULT QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize expandedTo(const QSize &) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize boundedTo(const QSize &) const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QSize expandedTo(const QSize &) const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QSize boundedTo(const QSize &) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QSize grownBy(QMargins m) const noexcept
+ Q_REQUIRED_RESULT constexpr QSize grownBy(QMargins m) const noexcept
{ return {width() + m.left() + m.right(), height() + m.top() + m.bottom()}; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QSize shrunkBy(QMargins m) const noexcept
+ Q_REQUIRED_RESULT constexpr QSize shrunkBy(QMargins m) const noexcept
{ return {width() - m.left() - m.right(), height() - m.top() - m.bottom()}; }
- Q_DECL_RELAXED_CONSTEXPR inline int &rwidth() noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline int &rheight() noexcept;
+ constexpr inline int &rwidth() noexcept;
+ constexpr inline int &rheight() noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QSize &operator+=(const QSize &) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QSize &operator-=(const QSize &) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QSize &operator*=(qreal c) noexcept;
+ constexpr inline QSize &operator+=(const QSize &) noexcept;
+ constexpr inline QSize &operator-=(const QSize &) noexcept;
+ constexpr inline QSize &operator*=(qreal c) noexcept;
inline QSize &operator/=(qreal c);
- friend inline Q_DECL_CONSTEXPR bool operator==(const QSize &, const QSize &) noexcept;
- friend inline Q_DECL_CONSTEXPR bool operator!=(const QSize &, const QSize &) noexcept;
- friend inline Q_DECL_CONSTEXPR size_t qHash(const QSize &, size_t) noexcept;
- friend inline Q_DECL_CONSTEXPR const QSize operator+(const QSize &, const QSize &) noexcept;
- friend inline Q_DECL_CONSTEXPR const QSize operator-(const QSize &, const QSize &) noexcept;
- friend inline Q_DECL_CONSTEXPR const QSize operator*(const QSize &, qreal) noexcept;
- friend inline Q_DECL_CONSTEXPR const QSize operator*(qreal, const QSize &) noexcept;
+ friend inline constexpr bool operator==(const QSize &, const QSize &) noexcept;
+ friend inline constexpr bool operator!=(const QSize &, const QSize &) noexcept;
+ friend inline constexpr size_t qHash(const QSize &, size_t) noexcept;
+ friend inline constexpr const QSize operator+(const QSize &, const QSize &) noexcept;
+ friend inline constexpr const QSize operator-(const QSize &, const QSize &) noexcept;
+ friend inline constexpr const QSize operator*(const QSize &, qreal) noexcept;
+ friend inline constexpr const QSize operator*(qreal, const QSize &) noexcept;
friend inline const QSize operator/(const QSize &, qreal);
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
@@ -122,32 +122,32 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSize &);
QSize inline functions
*****************************************************************************/
-Q_DECL_CONSTEXPR inline QSize::QSize() noexcept : wd(-1), ht(-1) {}
+constexpr inline QSize::QSize() noexcept : wd(-1), ht(-1) {}
-Q_DECL_CONSTEXPR inline QSize::QSize(int w, int h) noexcept : wd(w), ht(h) {}
+constexpr inline QSize::QSize(int w, int h) noexcept : wd(w), ht(h) {}
-Q_DECL_CONSTEXPR inline bool QSize::isNull() const noexcept
+constexpr inline bool QSize::isNull() const noexcept
{ return wd==0 && ht==0; }
-Q_DECL_CONSTEXPR inline bool QSize::isEmpty() const noexcept
+constexpr inline bool QSize::isEmpty() const noexcept
{ return wd<1 || ht<1; }
-Q_DECL_CONSTEXPR inline bool QSize::isValid() const noexcept
+constexpr inline bool QSize::isValid() const noexcept
{ return wd>=0 && ht>=0; }
-Q_DECL_CONSTEXPR inline int QSize::width() const noexcept
+constexpr inline int QSize::width() const noexcept
{ return wd; }
-Q_DECL_CONSTEXPR inline int QSize::height() const noexcept
+constexpr inline int QSize::height() const noexcept
{ return ht; }
-Q_DECL_RELAXED_CONSTEXPR inline void QSize::setWidth(int w) noexcept
+constexpr inline void QSize::setWidth(int w) noexcept
{ wd = w; }
-Q_DECL_RELAXED_CONSTEXPR inline void QSize::setHeight(int h) noexcept
+constexpr inline void QSize::setHeight(int h) noexcept
{ ht = h; }
-Q_DECL_CONSTEXPR inline QSize QSize::transposed() const noexcept
+constexpr inline QSize QSize::transposed() const noexcept
{ return QSize(ht, wd); }
inline void QSize::scale(int w, int h, Qt::AspectRatioMode mode) noexcept
@@ -159,40 +159,40 @@ inline void QSize::scale(const QSize &s, Qt::AspectRatioMode mode) noexcept
inline QSize QSize::scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept
{ return scaled(QSize(w, h), mode); }
-Q_DECL_RELAXED_CONSTEXPR inline int &QSize::rwidth() noexcept
+constexpr inline int &QSize::rwidth() noexcept
{ return wd; }
-Q_DECL_RELAXED_CONSTEXPR inline int &QSize::rheight() noexcept
+constexpr inline int &QSize::rheight() noexcept
{ return ht; }
-Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator+=(const QSize &s) noexcept
+constexpr inline QSize &QSize::operator+=(const QSize &s) noexcept
{ wd+=s.wd; ht+=s.ht; return *this; }
-Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator-=(const QSize &s) noexcept
+constexpr inline QSize &QSize::operator-=(const QSize &s) noexcept
{ wd-=s.wd; ht-=s.ht; return *this; }
-Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator*=(qreal c) noexcept
+constexpr inline QSize &QSize::operator*=(qreal c) noexcept
{ wd = qRound(wd*c); ht = qRound(ht*c); return *this; }
-Q_DECL_CONSTEXPR inline bool operator==(const QSize &s1, const QSize &s2) noexcept
+constexpr inline bool operator==(const QSize &s1, const QSize &s2) noexcept
{ return s1.wd == s2.wd && s1.ht == s2.ht; }
-Q_DECL_CONSTEXPR inline bool operator!=(const QSize &s1, const QSize &s2) noexcept
+constexpr inline bool operator!=(const QSize &s1, const QSize &s2) noexcept
{ return s1.wd != s2.wd || s1.ht != s2.ht; }
-Q_DECL_CONSTEXPR inline size_t qHash(const QSize &s, size_t seed = 0) noexcept
+constexpr inline size_t qHash(const QSize &s, size_t seed = 0) noexcept
{ return qHashMulti(seed, s.wd, s.ht); }
-Q_DECL_CONSTEXPR inline const QSize operator+(const QSize & s1, const QSize & s2) noexcept
+constexpr inline const QSize operator+(const QSize & s1, const QSize & s2) noexcept
{ return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
-Q_DECL_CONSTEXPR inline const QSize operator-(const QSize &s1, const QSize &s2) noexcept
+constexpr inline const QSize operator-(const QSize &s1, const QSize &s2) noexcept
{ return QSize(s1.wd-s2.wd, s1.ht-s2.ht); }
-Q_DECL_CONSTEXPR inline const QSize operator*(const QSize &s, qreal c) noexcept
+constexpr inline const QSize operator*(const QSize &s, qreal c) noexcept
{ return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
-Q_DECL_CONSTEXPR inline const QSize operator*(qreal c, const QSize &s) noexcept
+constexpr inline const QSize operator*(qreal c, const QSize &s) noexcept
{ return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
inline QSize &QSize::operator/=(qreal c)
@@ -208,12 +208,12 @@ inline const QSize operator/(const QSize &s, qreal c)
return QSize(qRound(s.wd/c), qRound(s.ht/c));
}
-Q_DECL_CONSTEXPR inline QSize QSize::expandedTo(const QSize & otherSize) const noexcept
+constexpr inline QSize QSize::expandedTo(const QSize & otherSize) const noexcept
{
return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht));
}
-Q_DECL_CONSTEXPR inline QSize QSize::boundedTo(const QSize & otherSize) const noexcept
+constexpr inline QSize QSize::boundedTo(const QSize & otherSize) const noexcept
{
return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht));
}
@@ -226,51 +226,51 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QSize &);
class Q_CORE_EXPORT QSizeF
{
public:
- Q_DECL_CONSTEXPR QSizeF() noexcept;
- Q_DECL_CONSTEXPR QSizeF(const QSize &sz) noexcept;
- Q_DECL_CONSTEXPR QSizeF(qreal w, qreal h) noexcept;
+ constexpr QSizeF() noexcept;
+ constexpr QSizeF(const QSize &sz) noexcept;
+ constexpr QSizeF(qreal w, qreal h) noexcept;
inline bool isNull() const noexcept;
- Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept;
- Q_DECL_CONSTEXPR inline bool isValid() const noexcept;
+ constexpr inline bool isEmpty() const noexcept;
+ constexpr inline bool isValid() const noexcept;
- Q_DECL_CONSTEXPR inline qreal width() const noexcept;
- Q_DECL_CONSTEXPR inline qreal height() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) noexcept;
+ constexpr inline qreal width() const noexcept;
+ constexpr inline qreal height() const noexcept;
+ constexpr inline void setWidth(qreal w) noexcept;
+ constexpr inline void setHeight(qreal h) noexcept;
void transpose() noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF transposed() const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QSizeF transposed() const noexcept;
inline void scale(qreal w, qreal h, Qt::AspectRatioMode mode) noexcept;
inline void scale(const QSizeF &s, Qt::AspectRatioMode mode) noexcept;
Q_REQUIRED_RESULT QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept;
Q_REQUIRED_RESULT QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF expandedTo(const QSizeF &) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF boundedTo(const QSizeF &) const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QSizeF expandedTo(const QSizeF &) const noexcept;
+ Q_REQUIRED_RESULT constexpr inline QSizeF boundedTo(const QSizeF &) const noexcept;
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QSizeF grownBy(QMarginsF m) const noexcept
+ Q_REQUIRED_RESULT constexpr QSizeF grownBy(QMarginsF m) const noexcept
{ return {width() + m.left() + m.right(), height() + m.top() + m.bottom()}; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QSizeF shrunkBy(QMarginsF m) const noexcept
+ Q_REQUIRED_RESULT constexpr QSizeF shrunkBy(QMarginsF m) const noexcept
{ return {width() - m.left() - m.right(), height() - m.top() - m.bottom()}; }
- Q_DECL_RELAXED_CONSTEXPR inline qreal &rwidth() noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline qreal &rheight() noexcept;
+ constexpr inline qreal &rwidth() noexcept;
+ constexpr inline qreal &rheight() noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator+=(const QSizeF &) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator-=(const QSizeF &) noexcept;
- Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator*=(qreal c) noexcept;
+ constexpr inline QSizeF &operator+=(const QSizeF &) noexcept;
+ constexpr inline QSizeF &operator-=(const QSizeF &) noexcept;
+ constexpr inline QSizeF &operator*=(qreal c) noexcept;
inline QSizeF &operator/=(qreal c);
- friend Q_DECL_CONSTEXPR inline bool operator==(const QSizeF &, const QSizeF &) noexcept;
- friend Q_DECL_CONSTEXPR inline bool operator!=(const QSizeF &, const QSizeF &) noexcept;
- friend Q_DECL_CONSTEXPR inline const QSizeF operator+(const QSizeF &, const QSizeF &) noexcept;
- friend Q_DECL_CONSTEXPR inline const QSizeF operator-(const QSizeF &, const QSizeF &) noexcept;
- friend Q_DECL_CONSTEXPR inline const QSizeF operator*(const QSizeF &, qreal) noexcept;
- friend Q_DECL_CONSTEXPR inline const QSizeF operator*(qreal, const QSizeF &) noexcept;
+ friend constexpr inline bool operator==(const QSizeF &, const QSizeF &) noexcept;
+ friend constexpr inline bool operator!=(const QSizeF &, const QSizeF &) noexcept;
+ friend constexpr inline const QSizeF operator+(const QSizeF &, const QSizeF &) noexcept;
+ friend constexpr inline const QSizeF operator-(const QSizeF &, const QSizeF &) noexcept;
+ friend constexpr inline const QSizeF operator*(const QSizeF &, qreal) noexcept;
+ friend constexpr inline const QSizeF operator*(qreal, const QSizeF &) noexcept;
friend inline const QSizeF operator/(const QSizeF &, qreal);
- Q_DECL_CONSTEXPR inline QSize toSize() const noexcept;
+ constexpr inline QSize toSize() const noexcept;
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_REQUIRED_RESULT static QSizeF fromCGSize(CGSize size) noexcept;
@@ -298,34 +298,34 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSizeF &);
QSizeF inline functions
*****************************************************************************/
-Q_DECL_CONSTEXPR inline QSizeF::QSizeF() noexcept : wd(-1.), ht(-1.) {}
+constexpr inline QSizeF::QSizeF() noexcept : wd(-1.), ht(-1.) {}
-Q_DECL_CONSTEXPR inline QSizeF::QSizeF(const QSize &sz) noexcept : wd(sz.width()), ht(sz.height()) {}
+constexpr inline QSizeF::QSizeF(const QSize &sz) noexcept : wd(sz.width()), ht(sz.height()) {}
-Q_DECL_CONSTEXPR inline QSizeF::QSizeF(qreal w, qreal h) noexcept : wd(w), ht(h) {}
+constexpr inline QSizeF::QSizeF(qreal w, qreal h) noexcept : wd(w), ht(h) {}
inline bool QSizeF::isNull() const noexcept
{ return qIsNull(wd) && qIsNull(ht); }
-Q_DECL_CONSTEXPR inline bool QSizeF::isEmpty() const noexcept
+constexpr inline bool QSizeF::isEmpty() const noexcept
{ return wd <= 0. || ht <= 0.; }
-Q_DECL_CONSTEXPR inline bool QSizeF::isValid() const noexcept
+constexpr inline bool QSizeF::isValid() const noexcept
{ return wd >= 0. && ht >= 0.; }
-Q_DECL_CONSTEXPR inline qreal QSizeF::width() const noexcept
+constexpr inline qreal QSizeF::width() const noexcept
{ return wd; }
-Q_DECL_CONSTEXPR inline qreal QSizeF::height() const noexcept
+constexpr inline qreal QSizeF::height() const noexcept
{ return ht; }
-Q_DECL_RELAXED_CONSTEXPR inline void QSizeF::setWidth(qreal w) noexcept
+constexpr inline void QSizeF::setWidth(qreal w) noexcept
{ wd = w; }
-Q_DECL_RELAXED_CONSTEXPR inline void QSizeF::setHeight(qreal h) noexcept
+constexpr inline void QSizeF::setHeight(qreal h) noexcept
{ ht = h; }
-Q_DECL_CONSTEXPR inline QSizeF QSizeF::transposed() const noexcept
+constexpr inline QSizeF QSizeF::transposed() const noexcept
{ return QSizeF(ht, wd); }
inline void QSizeF::scale(qreal w, qreal h, Qt::AspectRatioMode mode) noexcept
@@ -337,37 +337,37 @@ inline void QSizeF::scale(const QSizeF &s, Qt::AspectRatioMode mode) noexcept
inline QSizeF QSizeF::scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept
{ return scaled(QSizeF(w, h), mode); }
-Q_DECL_RELAXED_CONSTEXPR inline qreal &QSizeF::rwidth() noexcept
+constexpr inline qreal &QSizeF::rwidth() noexcept
{ return wd; }
-Q_DECL_RELAXED_CONSTEXPR inline qreal &QSizeF::rheight() noexcept
+constexpr inline qreal &QSizeF::rheight() noexcept
{ return ht; }
-Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator+=(const QSizeF &s) noexcept
+constexpr inline QSizeF &QSizeF::operator+=(const QSizeF &s) noexcept
{ wd += s.wd; ht += s.ht; return *this; }
-Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator-=(const QSizeF &s) noexcept
+constexpr inline QSizeF &QSizeF::operator-=(const QSizeF &s) noexcept
{ wd -= s.wd; ht -= s.ht; return *this; }
-Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator*=(qreal c) noexcept
+constexpr inline QSizeF &QSizeF::operator*=(qreal c) noexcept
{ wd *= c; ht *= c; return *this; }
-Q_DECL_CONSTEXPR inline bool operator==(const QSizeF &s1, const QSizeF &s2) noexcept
+constexpr inline bool operator==(const QSizeF &s1, const QSizeF &s2) noexcept
{ return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht); }
-Q_DECL_CONSTEXPR inline bool operator!=(const QSizeF &s1, const QSizeF &s2) noexcept
+constexpr inline bool operator!=(const QSizeF &s1, const QSizeF &s2) noexcept
{ return !qFuzzyCompare(s1.wd, s2.wd) || !qFuzzyCompare(s1.ht, s2.ht); }
-Q_DECL_CONSTEXPR inline const QSizeF operator+(const QSizeF & s1, const QSizeF & s2) noexcept
+constexpr inline const QSizeF operator+(const QSizeF & s1, const QSizeF & s2) noexcept
{ return QSizeF(s1.wd+s2.wd, s1.ht+s2.ht); }
-Q_DECL_CONSTEXPR inline const QSizeF operator-(const QSizeF &s1, const QSizeF &s2) noexcept
+constexpr inline const QSizeF operator-(const QSizeF &s1, const QSizeF &s2) noexcept
{ return QSizeF(s1.wd-s2.wd, s1.ht-s2.ht); }
-Q_DECL_CONSTEXPR inline const QSizeF operator*(const QSizeF &s, qreal c) noexcept
+constexpr inline const QSizeF operator*(const QSizeF &s, qreal c) noexcept
{ return QSizeF(s.wd*c, s.ht*c); }
-Q_DECL_CONSTEXPR inline const QSizeF operator*(qreal c, const QSizeF &s) noexcept
+constexpr inline const QSizeF operator*(qreal c, const QSizeF &s) noexcept
{ return QSizeF(s.wd*c, s.ht*c); }
inline QSizeF &QSizeF::operator/=(qreal c)
@@ -383,17 +383,17 @@ inline const QSizeF operator/(const QSizeF &s, qreal c)
return QSizeF(s.wd/c, s.ht/c);
}
-Q_DECL_CONSTEXPR inline QSizeF QSizeF::expandedTo(const QSizeF & otherSize) const noexcept
+constexpr inline QSizeF QSizeF::expandedTo(const QSizeF & otherSize) const noexcept
{
return QSizeF(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht));
}
-Q_DECL_CONSTEXPR inline QSizeF QSizeF::boundedTo(const QSizeF & otherSize) const noexcept
+constexpr inline QSizeF QSizeF::boundedTo(const QSizeF & otherSize) const noexcept
{
return QSizeF(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht));
}
-Q_DECL_CONSTEXPR inline QSize QSizeF::toSize() const noexcept
+constexpr inline QSize QSizeF::toSize() const noexcept
{
return QSize(qRound(wd), qRound(ht));
}
diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h
index 49c51b4711..a86a55646d 100644
--- a/src/corelib/tools/qtools_p.h
+++ b/src/corelib/tools/qtools_p.h
@@ -57,17 +57,17 @@
QT_BEGIN_NAMESPACE
namespace QtMiscUtils {
-Q_DECL_CONSTEXPR inline char toHexUpper(uint value) noexcept
+constexpr inline char toHexUpper(uint value) noexcept
{
return "0123456789ABCDEF"[value & 0xF];
}
-Q_DECL_CONSTEXPR inline char toHexLower(uint value) noexcept
+constexpr inline char toHexLower(uint value) noexcept
{
return "0123456789abcdef"[value & 0xF];
}
-Q_DECL_CONSTEXPR inline int fromHex(uint c) noexcept
+constexpr inline int fromHex(uint c) noexcept
{
return ((c >= '0') && (c <= '9')) ? int(c - '0') :
((c >= 'A') && (c <= 'F')) ? int(c - 'A' + 10) :
@@ -75,12 +75,12 @@ Q_DECL_CONSTEXPR inline int fromHex(uint c) noexcept
/* otherwise */ -1;
}
-Q_DECL_CONSTEXPR inline char toOct(uint value) noexcept
+constexpr inline char toOct(uint value) noexcept
{
return char('0' + (value & 0x7));
}
-Q_DECL_CONSTEXPR inline int fromOct(uint c) noexcept
+constexpr inline int fromOct(uint c) noexcept
{
return ((c >= '0') && (c <= '7')) ? int(c - '0') : -1;
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 84d8c5a705..188fb42b28 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4884,7 +4884,7 @@ QDebug operator<<(QDebug dbg, const QImage &i)
}
#endif
-static Q_CONSTEXPR QPixelFormat pixelformats[] = {
+static constexpr QPixelFormat pixelformats[] = {
//QImage::Format_Invalid:
QPixelFormat(),
//QImage::Format_Mono:
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index f0c1951b94..cb34dcf9b8 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -622,7 +622,7 @@ static bool convert_ARGB_to_RGBA_inplace(QImageData *data, Qt::ImageConversionFl
const int pad = (data->bytes_per_line >> 2) - data->width;
quint32 *rgb_data = (quint32 *) data->data;
- Q_CONSTEXPR uint mask = (DestFormat == QImage::Format_RGBX8888) ? 0xff000000 : 0;
+ constexpr uint mask = (DestFormat == QImage::Format_RGBX8888) ? 0xff000000 : 0;
for (int i = 0; i < data->height; ++i) {
const quint32 *end = rgb_data + data->width;
@@ -668,7 +668,7 @@ static bool convert_RGBA_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFl
const int pad = (data->bytes_per_line >> 2) - data->width;
QRgb *rgb_data = (QRgb *) data->data;
- Q_CONSTEXPR uint mask = (DestFormat == QImage::Format_RGB32) ? 0xff000000 : 0;
+ constexpr uint mask = (DestFormat == QImage::Format_RGB32) ? 0xff000000 : 0;
for (int i = 0; i < data->height; ++i) {
const QRgb *end = rgb_data + data->width;
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index 4fe39da532..1211266721 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1041,7 +1041,7 @@ bool qt_read_xpm_image_or_array(QIODevice *device, const char * const * source,
if ((readBytes = device->readLine(buf.data(), buf.size())) < 0)
return false;
- static Q_RELAXED_CONSTEXPR auto matcher = qMakeStaticByteArrayMatcher("/* XPM");
+ static constexpr auto matcher = qMakeStaticByteArrayMatcher("/* XPM");
if (matcher.indexIn(buf) != 0) {
while (readBytes > 0) {
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index aa09ab8427..649673003d 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -701,7 +701,7 @@ static const struct {
{ Qt::Key_TouchpadOff, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Off") },
};
-static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
+static constexpr int numKeyNames = sizeof keyname / sizeof *keyname;
/*!
\enum QKeySequence::StandardKey
diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h
index a0bb300c12..b48ed40812 100644
--- a/src/gui/kernel/qpixelformat.h
+++ b/src/gui/kernel/qpixelformat.h
@@ -95,9 +95,9 @@ class QPixelFormat
static_assert(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
static_assert(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
- Q_DECL_CONSTEXPR inline uchar get(Field offset, FieldWidth width) const noexcept
+ constexpr inline uchar get(Field offset, FieldWidth width) const noexcept
{ return uchar((data >> uint(offset)) & ((Q_UINT64_C(1) << uint(width)) - Q_UINT64_C(1))); }
- Q_DECL_CONSTEXPR static inline quint64 set(Field offset, FieldWidth width, uchar value)
+ constexpr static inline quint64 set(Field offset, FieldWidth width, uchar value)
{ return (quint64(value) & ((Q_UINT64_C(1) << uint(width)) - Q_UINT64_C(1))) << uint(offset); }
public:
@@ -160,8 +160,8 @@ public:
CurrentSystemEndian
};
- Q_DECL_CONSTEXPR inline QPixelFormat() noexcept : data(0) {}
- Q_DECL_CONSTEXPR inline QPixelFormat(ColorModel colorModel,
+ constexpr inline QPixelFormat() noexcept : data(0) {}
+ constexpr inline QPixelFormat(ColorModel colorModel,
uchar firstSize,
uchar secondSize,
uchar thirdSize,
@@ -175,57 +175,57 @@ public:
ByteOrder byteOrder = CurrentSystemEndian,
uchar subEnum = 0) noexcept;
- Q_DECL_CONSTEXPR inline ColorModel colorModel() const noexcept { return ColorModel(get(ModelField, ModelFieldWidth)); }
- Q_DECL_CONSTEXPR inline uchar channelCount() const noexcept { return (get(FirstField, FirstFieldWidth) > 0) +
+ constexpr inline ColorModel colorModel() const noexcept { return ColorModel(get(ModelField, ModelFieldWidth)); }
+ constexpr inline uchar channelCount() const noexcept { return (get(FirstField, FirstFieldWidth) > 0) +
(get(SecondField, SecondFieldWidth) > 0) +
(get(ThirdField, ThirdFieldWidth) > 0) +
(get(FourthField, FourthFieldWidth) > 0) +
(get(FifthField, FifthFieldWidth) > 0) +
(get(AlphaField, AlphaFieldWidth) > 0); }
- Q_DECL_CONSTEXPR inline uchar redSize() const noexcept { return get(FirstField, FirstFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar greenSize() const noexcept { return get(SecondField, SecondFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar blueSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar redSize() const noexcept { return get(FirstField, FirstFieldWidth); }
+ constexpr inline uchar greenSize() const noexcept { return get(SecondField, SecondFieldWidth); }
+ constexpr inline uchar blueSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar cyanSize() const noexcept { return get(FirstField, FirstFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar magentaSize() const noexcept { return get(SecondField, SecondFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar yellowSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar blackSize() const noexcept { return get(FourthField, FourthFieldWidth); }
+ constexpr inline uchar cyanSize() const noexcept { return get(FirstField, FirstFieldWidth); }
+ constexpr inline uchar magentaSize() const noexcept { return get(SecondField, SecondFieldWidth); }
+ constexpr inline uchar yellowSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar blackSize() const noexcept { return get(FourthField, FourthFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar hueSize() const noexcept { return get(FirstField, FirstFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar saturationSize() const noexcept { return get(SecondField, SecondFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar lightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar brightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar hueSize() const noexcept { return get(FirstField, FirstFieldWidth); }
+ constexpr inline uchar saturationSize() const noexcept { return get(SecondField, SecondFieldWidth); }
+ constexpr inline uchar lightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar brightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar alphaSize() const noexcept { return get(AlphaField, AlphaFieldWidth); }
+ constexpr inline uchar alphaSize() const noexcept { return get(AlphaField, AlphaFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar bitsPerPixel() const noexcept { return get(FirstField, FirstFieldWidth) +
+ constexpr inline uchar bitsPerPixel() const noexcept { return get(FirstField, FirstFieldWidth) +
get(SecondField, SecondFieldWidth) +
get(ThirdField, ThirdFieldWidth) +
get(FourthField, FourthFieldWidth) +
get(FifthField, FifthFieldWidth) +
get(AlphaField, AlphaFieldWidth); }
- Q_DECL_CONSTEXPR inline AlphaUsage alphaUsage() const noexcept { return AlphaUsage(get(AlphaUsageField, AlphaUsageFieldWidth)); }
- Q_DECL_CONSTEXPR inline AlphaPosition alphaPosition() const noexcept { return AlphaPosition(get(AlphaPositionField, AlphaPositionFieldWidth)); }
- Q_DECL_CONSTEXPR inline AlphaPremultiplied premultiplied() const noexcept { return AlphaPremultiplied(get(PremulField, PremulFieldWidth)); }
- Q_DECL_CONSTEXPR inline TypeInterpretation typeInterpretation() const noexcept { return TypeInterpretation(get(TypeInterpretationField, TypeInterpretationFieldWidth)); }
- Q_DECL_CONSTEXPR inline ByteOrder byteOrder() const noexcept { return ByteOrder(get(ByteOrderField, ByteOrderFieldWidth)); }
+ constexpr inline AlphaUsage alphaUsage() const noexcept { return AlphaUsage(get(AlphaUsageField, AlphaUsageFieldWidth)); }
+ constexpr inline AlphaPosition alphaPosition() const noexcept { return AlphaPosition(get(AlphaPositionField, AlphaPositionFieldWidth)); }
+ constexpr inline AlphaPremultiplied premultiplied() const noexcept { return AlphaPremultiplied(get(PremulField, PremulFieldWidth)); }
+ constexpr inline TypeInterpretation typeInterpretation() const noexcept { return TypeInterpretation(get(TypeInterpretationField, TypeInterpretationFieldWidth)); }
+ constexpr inline ByteOrder byteOrder() const noexcept { return ByteOrder(get(ByteOrderField, ByteOrderFieldWidth)); }
- Q_DECL_CONSTEXPR inline YUVLayout yuvLayout() const noexcept { return YUVLayout(get(SubEnumField, SubEnumFieldWidth)); }
- Q_DECL_CONSTEXPR inline uchar subEnum() const noexcept { return get(SubEnumField, SubEnumFieldWidth); }
+ constexpr inline YUVLayout yuvLayout() const noexcept { return YUVLayout(get(SubEnumField, SubEnumFieldWidth)); }
+ constexpr inline uchar subEnum() const noexcept { return get(SubEnumField, SubEnumFieldWidth); }
private:
- Q_DECL_CONSTEXPR static inline ByteOrder resolveByteOrder(ByteOrder bo)
+ constexpr static inline ByteOrder resolveByteOrder(ByteOrder bo)
{ return bo == CurrentSystemEndian ? Q_BYTE_ORDER == Q_LITTLE_ENDIAN ? LittleEndian : BigEndian : bo ; }
private:
quint64 data;
- friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator==(QPixelFormat fmt1, QPixelFormat fmt2)
+ friend Q_DECL_CONST_FUNCTION constexpr inline bool operator==(QPixelFormat fmt1, QPixelFormat fmt2)
{ return fmt1.data == fmt2.data; }
- friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator!=(QPixelFormat fmt1, QPixelFormat fmt2)
+ friend Q_DECL_CONST_FUNCTION constexpr inline bool operator!=(QPixelFormat fmt1, QPixelFormat fmt2)
{ return !(fmt1 == fmt2); }
};
static_assert(sizeof(QPixelFormat) == sizeof(quint64));
@@ -242,20 +242,19 @@ namespace QtPrivate {
QPixelFormat::ByteOrder byteOrder);
}
-Q_DECL_CONSTEXPR
-QPixelFormat::QPixelFormat(ColorModel mdl,
- uchar firstSize,
- uchar secondSize,
- uchar thirdSize,
- uchar fourthSize,
- uchar fifthSize,
- uchar alfa,
- AlphaUsage usage,
- AlphaPosition position,
- AlphaPremultiplied premult,
- TypeInterpretation typeInterp,
- ByteOrder b_order,
- uchar s_enum) noexcept
+constexpr QPixelFormat::QPixelFormat(ColorModel mdl,
+ uchar firstSize,
+ uchar secondSize,
+ uchar thirdSize,
+ uchar fourthSize,
+ uchar fifthSize,
+ uchar alfa,
+ AlphaUsage usage,
+ AlphaPosition position,
+ AlphaPremultiplied premult,
+ TypeInterpretation typeInterp,
+ ByteOrder b_order,
+ uchar s_enum) noexcept
: data(set(ModelField, ModelFieldWidth, uchar(mdl)) |
set(FirstField, FirstFieldWidth, firstSize) |
set(SecondField, SecondFieldWidth, secondSize) |
@@ -273,14 +272,14 @@ QPixelFormat::QPixelFormat(ColorModel mdl,
{
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatRgba(uchar red,
- uchar green,
- uchar blue,
- uchar alfa,
- QPixelFormat::AlphaUsage usage,
- QPixelFormat::AlphaPosition position,
- QPixelFormat::AlphaPremultiplied pmul=QPixelFormat::NotPremultiplied,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatRgba(uchar red,
+ uchar green,
+ uchar blue,
+ uchar alfa,
+ QPixelFormat::AlphaUsage usage,
+ QPixelFormat::AlphaPosition position,
+ QPixelFormat::AlphaPremultiplied pmul=QPixelFormat::NotPremultiplied,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::RGB,
red,
@@ -295,8 +294,8 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatRgba(uchar red,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::Grayscale,
channelSize,
@@ -311,8 +310,8 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatAlpha(uchar channelSize,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatAlpha(uchar channelSize,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::Alpha,
0,
@@ -327,11 +326,11 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatAlpha(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
- uchar alfa=0,
- QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
- QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
+ uchar alfa=0,
+ QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
+ QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::CMYK,
channelSize,
@@ -346,11 +345,11 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsl(uchar channelSize,
- uchar alfa=0,
- QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
- QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
+constexpr inline QPixelFormat qPixelFormatHsl(uchar channelSize,
+ uchar alfa=0,
+ QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
+ QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
{
return QPixelFormat(QPixelFormat::HSL,
channelSize,
@@ -365,11 +364,11 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsl(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsv(uchar channelSize,
- uchar alfa=0,
- QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
- QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
+constexpr inline QPixelFormat qPixelFormatHsv(uchar channelSize,
+ uchar alfa=0,
+ QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
+ QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
{
return QPixelFormat(QPixelFormat::HSV,
channelSize,
diff --git a/src/gui/kernel/qpointingdevice.h b/src/gui/kernel/qpointingdevice.h
index cdc31fa914..37851d70a7 100644
--- a/src/gui/kernel/qpointingdevice.h
+++ b/src/gui/kernel/qpointingdevice.h
@@ -56,13 +56,13 @@ class Q_GUI_EXPORT QPointingDeviceUniqueId
Q_PROPERTY(qint64 numericId READ numericId CONSTANT)
public:
Q_ALWAYS_INLINE
- Q_DECL_CONSTEXPR QPointingDeviceUniqueId() noexcept : m_numericId(-1) {}
+ constexpr QPointingDeviceUniqueId() noexcept : m_numericId(-1) {}
// compiler-generated copy/move ctor/assignment operators are ok!
// compiler-generated dtor is ok!
static QPointingDeviceUniqueId fromNumericId(qint64 id);
- Q_ALWAYS_INLINE Q_DECL_CONSTEXPR bool isValid() const noexcept { return m_numericId != -1; }
+ Q_ALWAYS_INLINE constexpr bool isValid() const noexcept { return m_numericId != -1; }
qint64 numericId() const noexcept;
private:
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index f862e6174c..12d62e8f50 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -85,7 +85,7 @@ public:
void setZ(float z);
void setScalar(float scalar);
- Q_DECL_CONSTEXPR static inline float dotProduct(const QQuaternion &q1, const QQuaternion &q2);
+ constexpr static inline float dotProduct(const QQuaternion &q1, const QQuaternion &q2);
float length() const;
float lengthSquared() const;
@@ -197,7 +197,7 @@ inline void QQuaternion::setY(float aY) { yp = aY; }
inline void QQuaternion::setZ(float aZ) { zp = aZ; }
inline void QQuaternion::setScalar(float aScalar) { wp = aScalar; }
-Q_DECL_CONSTEXPR inline float QQuaternion::dotProduct(const QQuaternion &q1, const QQuaternion &q2)
+constexpr inline float QQuaternion::dotProduct(const QQuaternion &q1, const QQuaternion &q2)
{
return q1.wp * q2.wp + q1.xp * q2.xp + q1.yp * q2.yp + q1.zp * q2.zp;
}
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index 65ad2a3afd..983f236f84 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -56,11 +56,11 @@ class QVariant;
class Q_GUI_EXPORT QVector2D
{
public:
- Q_DECL_CONSTEXPR QVector2D();
+ constexpr QVector2D();
explicit QVector2D(Qt::Initialization) {}
- Q_DECL_CONSTEXPR QVector2D(float xpos, float ypos);
- Q_DECL_CONSTEXPR explicit QVector2D(const QPoint& point);
- Q_DECL_CONSTEXPR explicit QVector2D(const QPointF& point);
+ constexpr QVector2D(float xpos, float ypos);
+ constexpr explicit QVector2D(const QPoint& point);
+ constexpr explicit QVector2D(const QPointF& point);
#ifndef QT_NO_VECTOR3D
explicit QVector2D(const QVector3D& vector);
#endif
@@ -70,8 +70,8 @@ public:
bool isNull() const;
- Q_DECL_CONSTEXPR float x() const;
- Q_DECL_CONSTEXPR float y() const;
+ constexpr float x() const;
+ constexpr float y() const;
void setX(float x);
void setY(float y);
@@ -97,18 +97,18 @@ public:
static float dotProduct(const QVector2D& v1, const QVector2D& v2); //In Qt 6 convert to inline and constexpr
- Q_DECL_CONSTEXPR friend inline bool operator==(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator*(float factor, const QVector2D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator*(const QVector2D &vector, float factor);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator-(const QVector2D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator/(const QVector2D &vector, float divisor);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator/(const QVector2D &vector, const QVector2D &divisor);
+ constexpr friend inline bool operator==(const QVector2D &v1, const QVector2D &v2);
+ constexpr friend inline bool operator!=(const QVector2D &v1, const QVector2D &v2);
+ constexpr friend inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2);
+ constexpr friend inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2);
+ constexpr friend inline const QVector2D operator*(float factor, const QVector2D &vector);
+ constexpr friend inline const QVector2D operator*(const QVector2D &vector, float factor);
+ constexpr friend inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2);
+ constexpr friend inline const QVector2D operator-(const QVector2D &vector);
+ constexpr friend inline const QVector2D operator/(const QVector2D &vector, float divisor);
+ constexpr friend inline const QVector2D operator/(const QVector2D &vector, const QVector2D &divisor);
- Q_DECL_CONSTEXPR friend inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2);
+ constexpr friend inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2);
#ifndef QT_NO_VECTOR3D
QVector3D toVector3D() const;
@@ -117,8 +117,8 @@ public:
QVector4D toVector4D() const;
#endif
- Q_DECL_CONSTEXPR QPoint toPoint() const;
- Q_DECL_CONSTEXPR QPointF toPointF() const;
+ constexpr QPoint toPoint() const;
+ constexpr QPointF toPointF() const;
operator QVariant() const;
@@ -131,21 +131,21 @@ private:
Q_DECLARE_TYPEINFO(QVector2D, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D() : v{0.0f, 0.0f} {}
+constexpr inline QVector2D::QVector2D() : v{0.0f, 0.0f} {}
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D(float xpos, float ypos) : v{xpos, ypos} {}
+constexpr inline QVector2D::QVector2D(float xpos, float ypos) : v{xpos, ypos} {}
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D(const QPoint& point) : v{float(point.x()), float(point.y())} {}
+constexpr inline QVector2D::QVector2D(const QPoint& point) : v{float(point.x()), float(point.y())} {}
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D(const QPointF& point) : v{float(point.x()), float(point.y())} {}
+constexpr inline QVector2D::QVector2D(const QPointF& point) : v{float(point.x()), float(point.y())} {}
inline bool QVector2D::isNull() const
{
return qIsNull(v[0]) && qIsNull(v[1]);
}
-Q_DECL_CONSTEXPR inline float QVector2D::x() const { return v[0]; }
-Q_DECL_CONSTEXPR inline float QVector2D::y() const { return v[1]; }
+constexpr inline float QVector2D::x() const { return v[0]; }
+constexpr inline float QVector2D::y() const { return v[1]; }
inline void QVector2D::setX(float aX) { v[0] = aX; }
inline void QVector2D::setY(float aY) { v[1] = aY; }
@@ -207,68 +207,68 @@ inline QVector2D &QVector2D::operator/=(const QVector2D &vector)
QT_WARNING_PUSH
QT_WARNING_DISABLE_FLOAT_COMPARE
-Q_DECL_CONSTEXPR inline bool operator==(const QVector2D &v1, const QVector2D &v2)
+constexpr inline bool operator==(const QVector2D &v1, const QVector2D &v2)
{
return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1];
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QVector2D &v1, const QVector2D &v2)
+constexpr inline bool operator!=(const QVector2D &v1, const QVector2D &v2)
{
return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1];
}
QT_WARNING_POP
-Q_DECL_CONSTEXPR inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2)
+constexpr inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2)
{
return QVector2D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1]);
}
-Q_DECL_CONSTEXPR inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2)
+constexpr inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2)
{
return QVector2D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1]);
}
-Q_DECL_CONSTEXPR inline const QVector2D operator*(float factor, const QVector2D &vector)
+constexpr inline const QVector2D operator*(float factor, const QVector2D &vector)
{
return QVector2D(vector.v[0] * factor, vector.v[1] * factor);
}
-Q_DECL_CONSTEXPR inline const QVector2D operator*(const QVector2D &vector, float factor)
+constexpr inline const QVector2D operator*(const QVector2D &vector, float factor)
{
return QVector2D(vector.v[0] * factor, vector.v[1] * factor);
}
-Q_DECL_CONSTEXPR inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2)
+constexpr inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2)
{
return QVector2D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1]);
}
-Q_DECL_CONSTEXPR inline const QVector2D operator-(const QVector2D &vector)
+constexpr inline const QVector2D operator-(const QVector2D &vector)
{
return QVector2D(-vector.v[0], -vector.v[1]);
}
-Q_DECL_CONSTEXPR inline const QVector2D operator/(const QVector2D &vector, float divisor)
+constexpr inline const QVector2D operator/(const QVector2D &vector, float divisor)
{
return QVector2D(vector.v[0] / divisor, vector.v[1] / divisor);
}
-Q_DECL_CONSTEXPR inline const QVector2D operator/(const QVector2D &vector, const QVector2D &divisor)
+constexpr inline const QVector2D operator/(const QVector2D &vector, const QVector2D &divisor)
{
return QVector2D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1]);
}
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2)
+constexpr inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2)
{
return qFuzzyCompare(v1.v[0], v2.v[0]) && qFuzzyCompare(v1.v[1], v2.v[1]);
}
-Q_DECL_CONSTEXPR inline QPoint QVector2D::toPoint() const
+constexpr inline QPoint QVector2D::toPoint() const
{
return QPoint(qRound(v[0]), qRound(v[1]));
}
-Q_DECL_CONSTEXPR inline QPointF QVector2D::toPointF() const
+constexpr inline QPointF QVector2D::toPointF() const
{
return QPointF(qreal(v[0]), qreal(v[1]));
}
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index 9eb2e7e7e6..ecfdf82239 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -57,12 +57,12 @@ class QRect;
class Q_GUI_EXPORT QVector3D
{
public:
- Q_DECL_CONSTEXPR QVector3D();
+ constexpr QVector3D();
explicit QVector3D(Qt::Initialization) {}
- Q_DECL_CONSTEXPR QVector3D(float xpos, float ypos, float zpos) : v{xpos, ypos, zpos} {}
+ constexpr QVector3D(float xpos, float ypos, float zpos) : v{xpos, ypos, zpos} {}
- Q_DECL_CONSTEXPR explicit QVector3D(const QPoint& point);
- Q_DECL_CONSTEXPR explicit QVector3D(const QPointF& point);
+ constexpr explicit QVector3D(const QPoint& point);
+ constexpr explicit QVector3D(const QPointF& point);
#ifndef QT_NO_VECTOR2D
QVector3D(const QVector2D& vector);
QVector3D(const QVector2D& vector, float zpos);
@@ -73,9 +73,9 @@ public:
bool isNull() const;
- Q_DECL_CONSTEXPR float x() const;
- Q_DECL_CONSTEXPR float y() const;
- Q_DECL_CONSTEXPR float z() const;
+ constexpr float x() const;
+ constexpr float y() const;
+ constexpr float z() const;
void setX(float x);
void setY(float y);
@@ -112,18 +112,18 @@ public:
float distanceToPlane(const QVector3D& plane1, const QVector3D& plane2, const QVector3D& plane3) const;
float distanceToLine(const QVector3D& point, const QVector3D& direction) const;
- Q_DECL_CONSTEXPR friend inline bool operator==(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator*(float factor, const QVector3D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator*(const QVector3D &vector, float factor);
- Q_DECL_CONSTEXPR friend const QVector3D operator*(const QVector3D &v1, const QVector3D& v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator-(const QVector3D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator/(const QVector3D &vector, float divisor);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator/(const QVector3D &vector, const QVector3D &divisor);
+ constexpr friend inline bool operator==(const QVector3D &v1, const QVector3D &v2);
+ constexpr friend inline bool operator!=(const QVector3D &v1, const QVector3D &v2);
+ constexpr friend inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2);
+ constexpr friend inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2);
+ constexpr friend inline const QVector3D operator*(float factor, const QVector3D &vector);
+ constexpr friend inline const QVector3D operator*(const QVector3D &vector, float factor);
+ constexpr friend const QVector3D operator*(const QVector3D &v1, const QVector3D& v2);
+ constexpr friend inline const QVector3D operator-(const QVector3D &vector);
+ constexpr friend inline const QVector3D operator/(const QVector3D &vector, float divisor);
+ constexpr friend inline const QVector3D operator/(const QVector3D &vector, const QVector3D &divisor);
- Q_DECL_CONSTEXPR friend inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2);
+ constexpr friend inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2);
#ifndef QT_NO_VECTOR2D
QVector2D toVector2D() const;
@@ -132,8 +132,8 @@ public:
QVector4D toVector4D() const;
#endif
- Q_DECL_CONSTEXPR QPoint toPoint() const;
- Q_DECL_CONSTEXPR QPointF toPointF() const;
+ constexpr QPoint toPoint() const;
+ constexpr QPointF toPointF() const;
operator QVariant() const;
@@ -150,20 +150,20 @@ private:
Q_DECLARE_TYPEINFO(QVector3D, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QVector3D::QVector3D() : v{0.0f, 0.0f, 0.0f} {}
+constexpr inline QVector3D::QVector3D() : v{0.0f, 0.0f, 0.0f} {}
-Q_DECL_CONSTEXPR inline QVector3D::QVector3D(const QPoint& point) : v{float(point.x()), float(point.y()), float(0.0f)} {}
+constexpr inline QVector3D::QVector3D(const QPoint& point) : v{float(point.x()), float(point.y()), float(0.0f)} {}
-Q_DECL_CONSTEXPR inline QVector3D::QVector3D(const QPointF& point) : v{float(point.x()), float(point.y()), 0.0f} {}
+constexpr inline QVector3D::QVector3D(const QPointF& point) : v{float(point.x()), float(point.y()), 0.0f} {}
inline bool QVector3D::isNull() const
{
return qIsNull(v[0]) && qIsNull(v[1]) && qIsNull(v[2]);
}
-Q_DECL_CONSTEXPR inline float QVector3D::x() const { return v[0]; }
-Q_DECL_CONSTEXPR inline float QVector3D::y() const { return v[1]; }
-Q_DECL_CONSTEXPR inline float QVector3D::z() const { return v[2]; }
+constexpr inline float QVector3D::x() const { return v[0]; }
+constexpr inline float QVector3D::y() const { return v[1]; }
+constexpr inline float QVector3D::z() const { return v[2]; }
inline void QVector3D::setX(float aX) { v[0] = aX; }
inline void QVector3D::setY(float aY) { v[1] = aY; }
@@ -232,70 +232,70 @@ inline QVector3D &QVector3D::operator/=(const QVector3D &vector)
QT_WARNING_PUSH
QT_WARNING_DISABLE_FLOAT_COMPARE
-Q_DECL_CONSTEXPR inline bool operator==(const QVector3D &v1, const QVector3D &v2)
+constexpr inline bool operator==(const QVector3D &v1, const QVector3D &v2)
{
return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2];
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QVector3D &v1, const QVector3D &v2)
+constexpr inline bool operator!=(const QVector3D &v1, const QVector3D &v2)
{
return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1] || v1.v[2] != v2.v[2];
}
QT_WARNING_POP
-Q_DECL_CONSTEXPR inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2)
+constexpr inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2)
{
return QVector3D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1], v1.v[2] + v2.v[2]);
}
-Q_DECL_CONSTEXPR inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2)
+constexpr inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2)
{
return QVector3D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1], v1.v[2] - v2.v[2]);
}
-Q_DECL_CONSTEXPR inline const QVector3D operator*(float factor, const QVector3D &vector)
+constexpr inline const QVector3D operator*(float factor, const QVector3D &vector)
{
return QVector3D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor);
}
-Q_DECL_CONSTEXPR inline const QVector3D operator*(const QVector3D &vector, float factor)
+constexpr inline const QVector3D operator*(const QVector3D &vector, float factor)
{
return QVector3D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor);
}
-Q_DECL_CONSTEXPR inline const QVector3D operator*(const QVector3D &v1, const QVector3D& v2)
+constexpr inline const QVector3D operator*(const QVector3D &v1, const QVector3D& v2)
{
return QVector3D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1], v1.v[2] * v2.v[2]);
}
-Q_DECL_CONSTEXPR inline const QVector3D operator-(const QVector3D &vector)
+constexpr inline const QVector3D operator-(const QVector3D &vector)
{
return QVector3D(-vector.v[0], -vector.v[1], -vector.v[2]);
}
-Q_DECL_CONSTEXPR inline const QVector3D operator/(const QVector3D &vector, float divisor)
+constexpr inline const QVector3D operator/(const QVector3D &vector, float divisor)
{
return QVector3D(vector.v[0] / divisor, vector.v[1] / divisor, vector.v[2] / divisor);
}
-Q_DECL_CONSTEXPR inline const QVector3D operator/(const QVector3D &vector, const QVector3D &divisor)
+constexpr inline const QVector3D operator/(const QVector3D &vector, const QVector3D &divisor)
{
return QVector3D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1], vector.v[2] / divisor.v[2]);
}
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2)
+constexpr inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2)
{
return qFuzzyCompare(v1.v[0], v2.v[0]) &&
qFuzzyCompare(v1.v[1], v2.v[1]) &&
qFuzzyCompare(v1.v[2], v2.v[2]);
}
-Q_DECL_CONSTEXPR inline QPoint QVector3D::toPoint() const
+constexpr inline QPoint QVector3D::toPoint() const
{
return QPoint(qRound(v[0]), qRound(v[1]));
}
-Q_DECL_CONSTEXPR inline QPointF QVector3D::toPointF() const
+constexpr inline QPointF QVector3D::toPointF() const
{
return QPointF(qreal(v[0]), qreal(v[1]));
}
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index 495a0b7e23..6f6ec213b9 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -56,11 +56,11 @@ class QVector3D;
class Q_GUI_EXPORT QVector4D
{
public:
- Q_DECL_CONSTEXPR QVector4D();
+ constexpr QVector4D();
explicit QVector4D(Qt::Initialization) {}
- Q_DECL_CONSTEXPR QVector4D(float xpos, float ypos, float zpos, float wpos);
- Q_DECL_CONSTEXPR explicit QVector4D(const QPoint& point);
- Q_DECL_CONSTEXPR explicit QVector4D(const QPointF& point);
+ constexpr QVector4D(float xpos, float ypos, float zpos, float wpos);
+ constexpr explicit QVector4D(const QPoint& point);
+ constexpr explicit QVector4D(const QPointF& point);
#ifndef QT_NO_VECTOR2D
QVector4D(const QVector2D& vector);
QVector4D(const QVector2D& vector, float zpos, float wpos);
@@ -72,10 +72,10 @@ public:
bool isNull() const;
- Q_DECL_CONSTEXPR float x() const;
- Q_DECL_CONSTEXPR float y() const;
- Q_DECL_CONSTEXPR float z() const;
- Q_DECL_CONSTEXPR float w() const;
+ constexpr float x() const;
+ constexpr float y() const;
+ constexpr float z() const;
+ constexpr float w() const;
void setX(float x);
void setY(float y);
@@ -100,18 +100,18 @@ public:
static float dotProduct(const QVector4D& v1, const QVector4D& v2); //In Qt 6 convert to inline and constexpr
- Q_DECL_CONSTEXPR friend inline bool operator==(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator*(float factor, const QVector4D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator*(const QVector4D &vector, float factor);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator-(const QVector4D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator/(const QVector4D &vector, float divisor);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor);
+ constexpr friend inline bool operator==(const QVector4D &v1, const QVector4D &v2);
+ constexpr friend inline bool operator!=(const QVector4D &v1, const QVector4D &v2);
+ constexpr friend inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2);
+ constexpr friend inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2);
+ constexpr friend inline const QVector4D operator*(float factor, const QVector4D &vector);
+ constexpr friend inline const QVector4D operator*(const QVector4D &vector, float factor);
+ constexpr friend inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2);
+ constexpr friend inline const QVector4D operator-(const QVector4D &vector);
+ constexpr friend inline const QVector4D operator/(const QVector4D &vector, float divisor);
+ constexpr friend inline const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor);
- Q_DECL_CONSTEXPR friend inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2);
+ constexpr friend inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2);
#ifndef QT_NO_VECTOR2D
QVector2D toVector2D() const;
@@ -122,8 +122,8 @@ public:
QVector3D toVector3DAffine() const;
#endif
- Q_DECL_CONSTEXPR QPoint toPoint() const;
- Q_DECL_CONSTEXPR QPointF toPointF() const;
+ constexpr QPoint toPoint() const;
+ constexpr QPointF toPointF() const;
operator QVariant() const;
@@ -140,23 +140,23 @@ private:
Q_DECLARE_TYPEINFO(QVector4D, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D() : v{0.0f, 0.0f, 0.0f, 0.0f} {}
+constexpr inline QVector4D::QVector4D() : v{0.0f, 0.0f, 0.0f, 0.0f} {}
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D(float xpos, float ypos, float zpos, float wpos) : v{xpos, ypos, zpos, wpos} {}
+constexpr inline QVector4D::QVector4D(float xpos, float ypos, float zpos, float wpos) : v{xpos, ypos, zpos, wpos} {}
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D(const QPoint& point) : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
+constexpr inline QVector4D::QVector4D(const QPoint& point) : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D(const QPointF& point) : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
+constexpr inline QVector4D::QVector4D(const QPointF& point) : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
inline bool QVector4D::isNull() const
{
return qIsNull(v[0]) && qIsNull(v[1]) && qIsNull(v[2]) && qIsNull(v[3]);
}
-Q_DECL_CONSTEXPR inline float QVector4D::x() const { return v[0]; }
-Q_DECL_CONSTEXPR inline float QVector4D::y() const { return v[1]; }
-Q_DECL_CONSTEXPR inline float QVector4D::z() const { return v[2]; }
-Q_DECL_CONSTEXPR inline float QVector4D::w() const { return v[3]; }
+constexpr inline float QVector4D::x() const { return v[0]; }
+constexpr inline float QVector4D::y() const { return v[1]; }
+constexpr inline float QVector4D::z() const { return v[2]; }
+constexpr inline float QVector4D::w() const { return v[3]; }
inline void QVector4D::setX(float aX) { v[0] = aX; }
inline void QVector4D::setY(float aY) { v[1] = aY; }
@@ -232,58 +232,58 @@ inline QVector4D &QVector4D::operator/=(const QVector4D &vector)
QT_WARNING_PUSH
QT_WARNING_DISABLE_FLOAT_COMPARE
-Q_DECL_CONSTEXPR inline bool operator==(const QVector4D &v1, const QVector4D &v2)
+constexpr inline bool operator==(const QVector4D &v1, const QVector4D &v2)
{
return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2] && v1.v[3] == v2.v[3];
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QVector4D &v1, const QVector4D &v2)
+constexpr inline bool operator!=(const QVector4D &v1, const QVector4D &v2)
{
return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1] || v1.v[2] != v2.v[2] || v1.v[3] != v2.v[3];
}
QT_WARNING_POP
-Q_DECL_CONSTEXPR inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2)
+constexpr inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2)
{
return QVector4D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1], v1.v[2] + v2.v[2], v1.v[3] + v2.v[3]);
}
-Q_DECL_CONSTEXPR inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2)
+constexpr inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2)
{
return QVector4D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1], v1.v[2] - v2.v[2], v1.v[3] - v2.v[3]);
}
-Q_DECL_CONSTEXPR inline const QVector4D operator*(float factor, const QVector4D &vector)
+constexpr inline const QVector4D operator*(float factor, const QVector4D &vector)
{
return QVector4D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor, vector.v[3] * factor);
}
-Q_DECL_CONSTEXPR inline const QVector4D operator*(const QVector4D &vector, float factor)
+constexpr inline const QVector4D operator*(const QVector4D &vector, float factor)
{
return QVector4D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor, vector.v[3] * factor);
}
-Q_DECL_CONSTEXPR inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2)
+constexpr inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2)
{
return QVector4D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1], v1.v[2] * v2.v[2], v1.v[3] * v2.v[3]);
}
-Q_DECL_CONSTEXPR inline const QVector4D operator-(const QVector4D &vector)
+constexpr inline const QVector4D operator-(const QVector4D &vector)
{
return QVector4D(-vector.v[0], -vector.v[1], -vector.v[2], -vector.v[3]);
}
-Q_DECL_CONSTEXPR inline const QVector4D operator/(const QVector4D &vector, float divisor)
+constexpr inline const QVector4D operator/(const QVector4D &vector, float divisor)
{
return QVector4D(vector.v[0] / divisor, vector.v[1] / divisor, vector.v[2] / divisor, vector.v[3] / divisor);
}
-Q_DECL_CONSTEXPR inline const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor)
+constexpr inline const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor)
{
return QVector4D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1], vector.v[2] / divisor.v[2], vector.v[3] / divisor.v[3]);
}
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2)
+constexpr inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2)
{
return qFuzzyCompare(v1.v[0], v2.v[0]) &&
qFuzzyCompare(v1.v[1], v2.v[1]) &&
@@ -291,12 +291,12 @@ Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D&
qFuzzyCompare(v1.v[3], v2.v[3]);
}
-Q_DECL_CONSTEXPR inline QPoint QVector4D::toPoint() const
+constexpr inline QPoint QVector4D::toPoint() const
{
return QPoint(qRound(v[0]), qRound(v[1]));
}
-Q_DECL_CONSTEXPR inline QPointF QVector4D::toPointF() const
+constexpr inline QPointF QVector4D::toPointF() const
{
return QPointF(qreal(v[0]), qreal(v[1]));
}
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index c9113cdc75..b2f610c188 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -576,7 +576,7 @@ void QBrush::cleanUp(QBrushData *x)
QBrushDataPointerDeleter::deleteData(x);
}
-static Q_DECL_CONSTEXPR inline bool use_same_brushdata(Qt::BrushStyle lhs, Qt::BrushStyle rhs)
+static constexpr inline bool use_same_brushdata(Qt::BrushStyle lhs, Qt::BrushStyle rhs)
{
return lhs == rhs // includes Qt::TexturePattern
|| (lhs >= Qt::NoBrush && lhs <= Qt::DiagCrossPattern && rhs >= Qt::NoBrush && rhs <= Qt::DiagCrossPattern)
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 683826fbe7..dbced35996 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -69,10 +69,10 @@ public:
enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl, ExtendedRgb };
enum NameFormat { HexRgb, HexArgb };
- Q_DECL_CONSTEXPR QColor() noexcept
+ constexpr QColor() noexcept
: cspec(Invalid), ct(USHRT_MAX, 0, 0, 0, 0) {}
QColor(Qt::GlobalColor color) noexcept;
- Q_DECL_CONSTEXPR QColor(int r, int g, int b, int a = 255) noexcept
+ constexpr QColor(int r, int g, int b, int a = 255) noexcept
: cspec(isRgbaValid(r, g, b, a) ? Rgb : Invalid),
ct(ushort(cspec == Rgb ? a * 0x0101 : 0),
ushort(cspec == Rgb ? r * 0x0101 : 0),
@@ -235,7 +235,7 @@ private:
template <typename String>
bool setColorFromString(String name);
- static Q_DECL_CONSTEXPR bool isRgbaValid(int r, int g, int b, int a = 255) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr bool isRgbaValid(int r, int g, int b, int a = 255) noexcept Q_DECL_CONST_FUNCTION
{
return uint(r) <= 255 && uint(g) <= 255 && uint(b) <= 255 && uint(a) <= 255;
}
@@ -244,7 +244,7 @@ private:
union CT {
#ifdef Q_COMPILER_UNIFORM_INIT
CT() {} // doesn't init anything, thus can't be constexpr
- Q_DECL_CONSTEXPR explicit CT(ushort a1, ushort a2, ushort a3, ushort a4, ushort a5) noexcept
+ constexpr explicit CT(ushort a1, ushort a2, ushort a3, ushort a4, ushort a5) noexcept
: array{a1, a2, a3, a4, a5} {}
#endif
struct {
@@ -293,7 +293,7 @@ private:
#ifdef Q_COMPILER_UNIFORM_INIT
public: // can't give friendship to a namespace, so it needs to be public
- Q_DECL_CONSTEXPR explicit QColor(Spec spec, ushort a1, ushort a2, ushort a3, ushort a4, ushort a5=0) noexcept
+ constexpr explicit QColor(Spec spec, ushort a1, ushort a2, ushort a3, ushort a4, ushort a5=0) noexcept
: cspec(spec), ct(a1, a2, a3, a4, a5) {}
#endif // Q_COMPILER_UNIFORM_INIT
};
diff --git a/src/gui/painting/qcolormatrix_p.h b/src/gui/painting/qcolormatrix_p.h
index 749aad3b2c..87a61ab219 100644
--- a/src/gui/painting/qcolormatrix_p.h
+++ b/src/gui/painting/qcolormatrix_p.h
@@ -62,8 +62,8 @@ class QColorVector
{
public:
QColorVector() = default;
- Q_DECL_CONSTEXPR QColorVector(float x, float y, float z) : x(x), y(y), z(z) { }
- explicit Q_DECL_CONSTEXPR QColorVector(const QPointF &chr) // from XY chromaticity
+ constexpr QColorVector(float x, float y, float z) : x(x), y(y), z(z) { }
+ explicit constexpr QColorVector(const QPointF &chr) // from XY chromaticity
: x(chr.x() / chr.y())
, y(1.0f)
, z((1.0 - chr.x() - chr.y()) / chr.y())
@@ -92,10 +92,10 @@ public:
}
// Common whitepoints:
- static Q_DECL_CONSTEXPR QPointF D50Chromaticity() { return QPointF(0.34567, 0.35850); }
- static Q_DECL_CONSTEXPR QPointF D65Chromaticity() { return QPointF(0.31271, 0.32902); }
- static Q_DECL_CONSTEXPR QColorVector D50() { return QColorVector(D50Chromaticity()); }
- static Q_DECL_CONSTEXPR QColorVector D65() { return QColorVector(D65Chromaticity()); }
+ static constexpr QPointF D50Chromaticity() { return QPointF(0.34567, 0.35850); }
+ static constexpr QPointF D65Chromaticity() { return QPointF(0.31271, 0.32902); }
+ static constexpr QColorVector D50() { return QColorVector(D50Chromaticity()); }
+ static constexpr QColorVector D65() { return QColorVector(D65Chromaticity()); }
};
inline bool operator==(const QColorVector &v1, const QColorVector &v2)
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index b4dc2d3ae3..1ef881efee 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1484,7 +1484,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
{
const qreal cx = x + qreal(0.5);
const qreal cy = y + qreal(0.5);
- Q_CONSTEXPR int tiled = (blendType == BlendTransformedBilinearTiled) ? 1 : 0;
+ constexpr int tiled = (blendType == BlendTransformedBilinearTiled) ? 1 : 0;
uint *end = buffer + length;
uint *b = buffer;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 99a3534545..72eba9ea6d 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -858,10 +858,10 @@ static inline uint BYTE_MUL_RGB16_32(uint x, uint a) {
}
// qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers
-static Q_DECL_CONSTEXPR inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
-static Q_DECL_CONSTEXPR inline uint qt_div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
-static Q_DECL_CONSTEXPR inline uint qt_div_257(uint x) { return qt_div_257_floor(x + 128); }
-static Q_DECL_CONSTEXPR inline uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
+static constexpr inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
+static constexpr inline uint qt_div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
+static constexpr inline uint qt_div_257(uint x) { return qt_div_257_floor(x + 128); }
+static constexpr inline uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
template <class T> inline void qt_memfill_template(T *dest, T color, qsizetype count)
{
@@ -1008,7 +1008,7 @@ inline uint comp_func_Plus_one_pixel(uint d, const uint s)
#undef AMIX
// must be multiple of 4 for easier SIMD implementations
-static Q_CONSTEXPR int BufferSize = 2048;
+static constexpr int BufferSize = 2048;
// A buffer of intermediate results used by simple bilinear scaling.
struct IntermediateBuffer
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index 8b91c590b8..b3bb22fe1b 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -269,7 +269,7 @@ static inline uint qConvertArgb32ToA2rgb30_sse4(QRgb p)
return qConvertRgb32ToRgb30<PixelOrder>(p);
if (alpha == 0)
return 0;
- Q_CONSTEXPR float mult = 1023.0f / (255 >> 6);
+ constexpr float mult = 1023.0f / (255 >> 6);
const uint newalpha = (alpha >> 6);
const __m128 va = _mm_set1_ps(alpha);
__m128 via;
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index 846592881c..90d214fe96 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -60,49 +60,49 @@ QT_BEGIN_NAMESPACE
struct QFixed {
private:
- Q_DECL_CONSTEXPR QFixed(int val, int) : val(val) {} // 2nd int is just a dummy for disambiguation
+ constexpr QFixed(int val, int) : val(val) {} // 2nd int is just a dummy for disambiguation
public:
- Q_DECL_CONSTEXPR QFixed() : val(0) {}
- Q_DECL_CONSTEXPR QFixed(int i) : val(i * 64) {}
- Q_DECL_CONSTEXPR QFixed(long i) : val(i * 64) {}
+ constexpr QFixed() : val(0) {}
+ constexpr QFixed(int i) : val(i * 64) {}
+ constexpr QFixed(long i) : val(i * 64) {}
QFixed &operator=(int i) { val = i * 64; return *this; }
QFixed &operator=(long i) { val = i * 64; return *this; }
- Q_DECL_CONSTEXPR static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); }
- Q_DECL_CONSTEXPR static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor
+ constexpr static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); }
+ constexpr static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor
- Q_DECL_CONSTEXPR inline int value() const { return val; }
+ constexpr inline int value() const { return val; }
inline void setValue(int value) { val = value; }
- Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; }
- Q_DECL_CONSTEXPR inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
+ constexpr inline int toInt() const { return (((val)+32) & -64)>>6; }
+ constexpr inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
- Q_DECL_CONSTEXPR inline int truncate() const { return val>>6; }
- Q_DECL_CONSTEXPR inline QFixed round() const { return fromFixed(((val)+32) & -64); }
- Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); }
- Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); }
+ constexpr inline int truncate() const { return val>>6; }
+ constexpr inline QFixed round() const { return fromFixed(((val)+32) & -64); }
+ constexpr inline QFixed floor() const { return fromFixed((val) & -64); }
+ constexpr inline QFixed ceil() const { return fromFixed((val+63) & -64); }
- Q_DECL_CONSTEXPR inline QFixed operator+(int i) const { return fromFixed(val + i * 64); }
- Q_DECL_CONSTEXPR inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); }
- Q_DECL_CONSTEXPR inline QFixed operator+(const QFixed &other) const { return fromFixed((val + other.val)); }
+ constexpr inline QFixed operator+(int i) const { return fromFixed(val + i * 64); }
+ constexpr inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); }
+ constexpr inline QFixed operator+(const QFixed &other) const { return fromFixed((val + other.val)); }
inline QFixed &operator+=(int i) { val += i * 64; return *this; }
inline QFixed &operator+=(uint i) { val += (i<<6); return *this; }
inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator-(int i) const { return fromFixed(val - i * 64); }
- Q_DECL_CONSTEXPR inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); }
- Q_DECL_CONSTEXPR inline QFixed operator-(const QFixed &other) const { return fromFixed((val - other.val)); }
+ constexpr inline QFixed operator-(int i) const { return fromFixed(val - i * 64); }
+ constexpr inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); }
+ constexpr inline QFixed operator-(const QFixed &other) const { return fromFixed((val - other.val)); }
inline QFixed &operator-=(int i) { val -= i * 64; return *this; }
inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; }
inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator-() const { return fromFixed(-val); }
+ constexpr inline QFixed operator-() const { return fromFixed(-val); }
- Q_DECL_CONSTEXPR inline bool operator==(const QFixed &other) const { return val == other.val; }
- Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &other) const { return val != other.val; }
- Q_DECL_CONSTEXPR inline bool operator<(const QFixed &other) const { return val < other.val; }
- Q_DECL_CONSTEXPR inline bool operator>(const QFixed &other) const { return val > other.val; }
- Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &other) const { return val <= other.val; }
- Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &other) const { return val >= other.val; }
- Q_DECL_CONSTEXPR inline bool operator!() const { return !val; }
+ constexpr inline bool operator==(const QFixed &other) const { return val == other.val; }
+ constexpr inline bool operator!=(const QFixed &other) const { return val != other.val; }
+ constexpr inline bool operator<(const QFixed &other) const { return val < other.val; }
+ constexpr inline bool operator>(const QFixed &other) const { return val > other.val; }
+ constexpr inline bool operator<=(const QFixed &other) const { return val <= other.val; }
+ constexpr inline bool operator>=(const QFixed &other) const { return val >= other.val; }
+ constexpr inline bool operator!() const { return !val; }
inline QFixed &operator/=(int x) { val /= x; return *this; }
inline QFixed &operator/=(const QFixed &o) {
@@ -121,7 +121,7 @@ public:
}
return *this;
}
- Q_DECL_CONSTEXPR inline QFixed operator/(int d) const { return fromFixed(val/d); }
+ constexpr inline QFixed operator/(int d) const { return fromFixed(val/d); }
inline QFixed operator/(QFixed b) const { QFixed f = *this; return (f /= b); }
inline QFixed operator>>(int d) const { QFixed f = *this; f.val >>= d; return f; }
inline QFixed &operator*=(int i) { val *= i; return *this; }
@@ -137,50 +137,50 @@ public:
val = neg ? -res : res;
return *this;
}
- Q_DECL_CONSTEXPR inline QFixed operator*(int i) const { return fromFixed(val * i); }
- Q_DECL_CONSTEXPR inline QFixed operator*(uint i) const { return fromFixed(val * i); }
+ constexpr inline QFixed operator*(int i) const { return fromFixed(val * i); }
+ constexpr inline QFixed operator*(uint i) const { return fromFixed(val * i); }
inline QFixed operator*(const QFixed &o) const { QFixed f = *this; return (f *= o); }
private:
- Q_DECL_CONSTEXPR QFixed(qreal i) : val((int)(i*qreal(64))) {}
+ constexpr QFixed(qreal i) : val((int)(i*qreal(64))) {}
QFixed &operator=(qreal i) { val = (int)(i*qreal(64)); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator+(qreal i) const { return fromFixed((val + (int)(i*qreal(64)))); }
+ constexpr inline QFixed operator+(qreal i) const { return fromFixed((val + (int)(i*qreal(64)))); }
inline QFixed &operator+=(qreal i) { val += (int)(i*64); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator-(qreal i) const { return fromFixed((val - (int)(i*qreal(64)))); }
+ constexpr inline QFixed operator-(qreal i) const { return fromFixed((val - (int)(i*qreal(64)))); }
inline QFixed &operator-=(qreal i) { val -= (int)(i*64); return *this; }
inline QFixed &operator/=(qreal r) { val = (int)(val/r); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator/(qreal d) const { return fromFixed((int)(val/d)); }
+ constexpr inline QFixed operator/(qreal d) const { return fromFixed((int)(val/d)); }
inline QFixed &operator*=(qreal d) { val = (int) (val*d); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator*(qreal d) const { return fromFixed((int) (val*d)); }
+ constexpr inline QFixed operator*(qreal d) const { return fromFixed((int) (val*d)); }
int val;
};
Q_DECLARE_TYPEINFO(QFixed, Q_PRIMITIVE_TYPE);
#define QFIXED_MAX (INT_MAX/256)
-Q_DECL_CONSTEXPR inline int qRound(const QFixed &f) { return f.toInt(); }
-Q_DECL_CONSTEXPR inline int qFloor(const QFixed &f) { return f.floor().truncate(); }
-
-Q_DECL_CONSTEXPR inline QFixed operator*(int i, const QFixed &d) { return d*i; }
-Q_DECL_CONSTEXPR inline QFixed operator+(int i, const QFixed &d) { return d+i; }
-Q_DECL_CONSTEXPR inline QFixed operator-(int i, const QFixed &d) { return -(d-i); }
-Q_DECL_CONSTEXPR inline QFixed operator*(uint i, const QFixed &d) { return d*i; }
-Q_DECL_CONSTEXPR inline QFixed operator+(uint i, const QFixed &d) { return d+i; }
-Q_DECL_CONSTEXPR inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
-// Q_DECL_CONSTEXPR inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; }
-
-Q_DECL_CONSTEXPR inline bool operator==(const QFixed &f, int i) { return f.value() == i * 64; }
-Q_DECL_CONSTEXPR inline bool operator==(int i, const QFixed &f) { return f.value() == i * 64; }
-Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &f, int i) { return f.value() != i * 64; }
-Q_DECL_CONSTEXPR inline bool operator!=(int i, const QFixed &f) { return f.value() != i * 64; }
-Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &f, int i) { return f.value() <= i * 64; }
-Q_DECL_CONSTEXPR inline bool operator<=(int i, const QFixed &f) { return i * 64 <= f.value(); }
-Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &f, int i) { return f.value() >= i * 64; }
-Q_DECL_CONSTEXPR inline bool operator>=(int i, const QFixed &f) { return i * 64 >= f.value(); }
-Q_DECL_CONSTEXPR inline bool operator<(const QFixed &f, int i) { return f.value() < i * 64; }
-Q_DECL_CONSTEXPR inline bool operator<(int i, const QFixed &f) { return i * 64 < f.value(); }
-Q_DECL_CONSTEXPR inline bool operator>(const QFixed &f, int i) { return f.value() > i * 64; }
-Q_DECL_CONSTEXPR inline bool operator>(int i, const QFixed &f) { return i * 64 > f.value(); }
+constexpr inline int qRound(const QFixed &f) { return f.toInt(); }
+constexpr inline int qFloor(const QFixed &f) { return f.floor().truncate(); }
+
+constexpr inline QFixed operator*(int i, const QFixed &d) { return d*i; }
+constexpr inline QFixed operator+(int i, const QFixed &d) { return d+i; }
+constexpr inline QFixed operator-(int i, const QFixed &d) { return -(d-i); }
+constexpr inline QFixed operator*(uint i, const QFixed &d) { return d*i; }
+constexpr inline QFixed operator+(uint i, const QFixed &d) { return d+i; }
+constexpr inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
+// constexpr inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; }
+
+constexpr inline bool operator==(const QFixed &f, int i) { return f.value() == i * 64; }
+constexpr inline bool operator==(int i, const QFixed &f) { return f.value() == i * 64; }
+constexpr inline bool operator!=(const QFixed &f, int i) { return f.value() != i * 64; }
+constexpr inline bool operator!=(int i, const QFixed &f) { return f.value() != i * 64; }
+constexpr inline bool operator<=(const QFixed &f, int i) { return f.value() <= i * 64; }
+constexpr inline bool operator<=(int i, const QFixed &f) { return i * 64 <= f.value(); }
+constexpr inline bool operator>=(const QFixed &f, int i) { return f.value() >= i * 64; }
+constexpr inline bool operator>=(int i, const QFixed &f) { return i * 64 >= f.value(); }
+constexpr inline bool operator<(const QFixed &f, int i) { return f.value() < i * 64; }
+constexpr inline bool operator<(int i, const QFixed &f) { return i * 64 < f.value(); }
+constexpr inline bool operator>(const QFixed &f, int i) { return f.value() > i * 64; }
+constexpr inline bool operator>(int i, const QFixed &f) { return i * 64 > f.value(); }
#ifndef QT_NO_DEBUG_STREAM
inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
@@ -190,27 +190,27 @@ inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
struct QFixedPoint {
QFixed x;
QFixed y;
- Q_DECL_CONSTEXPR inline QFixedPoint() {}
- Q_DECL_CONSTEXPR inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {}
- Q_DECL_CONSTEXPR QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
- Q_DECL_CONSTEXPR static QFixedPoint fromPointF(const QPointF &p) {
+ constexpr inline QFixedPoint() {}
+ constexpr inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {}
+ constexpr QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
+ constexpr static QFixedPoint fromPointF(const QPointF &p) {
return QFixedPoint(QFixed::fromReal(p.x()), QFixed::fromReal(p.y()));
}
};
Q_DECLARE_TYPEINFO(QFixedPoint, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2)
+constexpr inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2)
{ return QFixedPoint(p1.x - p2.x, p1.y - p2.y); }
-Q_DECL_CONSTEXPR inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2)
+constexpr inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2)
{ return QFixedPoint(p1.x + p2.x, p1.y + p2.y); }
struct QFixedSize {
QFixed width;
QFixed height;
- Q_DECL_CONSTEXPR QFixedSize() {}
- Q_DECL_CONSTEXPR QFixedSize(QFixed _width, QFixed _height) : width(_width), height(_height) {}
- Q_DECL_CONSTEXPR QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); }
- Q_DECL_CONSTEXPR static QFixedSize fromSizeF(const QSizeF &s) {
+ constexpr QFixedSize() {}
+ constexpr QFixedSize(QFixed _width, QFixed _height) : width(_width), height(_height) {}
+ constexpr QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); }
+ constexpr static QFixedSize fromSizeF(const QSizeF &s) {
return QFixedSize(QFixed::fromReal(s.width()), QFixed::fromReal(s.height()));
}
};
diff --git a/src/gui/painting/qpixellayout.cpp b/src/gui/painting/qpixellayout.cpp
index ad6df37228..c931cc0a09 100644
--- a/src/gui/painting/qpixellayout.cpp
+++ b/src/gui/painting/qpixellayout.cpp
@@ -46,146 +46,146 @@
QT_BEGIN_NAMESPACE
-template<QImage::Format> Q_DECL_CONSTEXPR uint redWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint redShift();
-template<QImage::Format> Q_DECL_CONSTEXPR uint greenWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint greenShift();
-template<QImage::Format> Q_DECL_CONSTEXPR uint blueWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint blueShift();
-template<QImage::Format> Q_DECL_CONSTEXPR uint alphaWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint alphaShift();
-
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB16>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB16>() { return 11; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB444>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB555>() { return 10; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB666>() { return 12; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_BGR888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB4444_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB8555_Premultiplied>() { return 18; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB8565_Premultiplied>() { return 19; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB6666_Premultiplied>() { return 12; }
+template<QImage::Format> constexpr uint redWidth();
+template<QImage::Format> constexpr uint redShift();
+template<QImage::Format> constexpr uint greenWidth();
+template<QImage::Format> constexpr uint greenShift();
+template<QImage::Format> constexpr uint blueWidth();
+template<QImage::Format> constexpr uint blueShift();
+template<QImage::Format> constexpr uint alphaWidth();
+template<QImage::Format> constexpr uint alphaShift();
+
+template<> constexpr uint redWidth<QImage::Format_RGB16>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint redWidth<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint redWidth<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint redWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint redWidth<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint redShift<QImage::Format_RGB16>() { return 11; }
+template<> constexpr uint redShift<QImage::Format_RGB444>() { return 8; }
+template<> constexpr uint redShift<QImage::Format_RGB555>() { return 10; }
+template<> constexpr uint redShift<QImage::Format_RGB666>() { return 12; }
+template<> constexpr uint redShift<QImage::Format_RGB888>() { return 16; }
+template<> constexpr uint redShift<QImage::Format_BGR888>() { return 0; }
+template<> constexpr uint redShift<QImage::Format_ARGB4444_Premultiplied>() { return 8; }
+template<> constexpr uint redShift<QImage::Format_ARGB8555_Premultiplied>() { return 18; }
+template<> constexpr uint redShift<QImage::Format_ARGB8565_Premultiplied>() { return 19; }
+template<> constexpr uint redShift<QImage::Format_ARGB6666_Premultiplied>() { return 12; }
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBX8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
+template<> constexpr uint redShift<QImage::Format_RGBX8888>() { return 24; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888>() { return 24; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
#else
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBX8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
+template<> constexpr uint redShift<QImage::Format_RGBX8888>() { return 0; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888>() { return 0; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
#endif
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB16>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB8565_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB16>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB8555_Premultiplied>() { return 13; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB8565_Premultiplied>() { return 13; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_RGB16>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint greenWidth<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint greenWidth<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB8565_Premultiplied>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint greenShift<QImage::Format_RGB16>() { return 5; }
+template<> constexpr uint greenShift<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint greenShift<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint greenShift<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint greenShift<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint greenShift<QImage::Format_ARGB8555_Premultiplied>() { return 13; }
+template<> constexpr uint greenShift<QImage::Format_ARGB8565_Premultiplied>() { return 13; }
+template<> constexpr uint greenShift<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBX8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
+template<> constexpr uint greenShift<QImage::Format_RGBX8888>() { return 16; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888>() { return 16; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
#else
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
#endif
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB16>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB16>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB444>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB555>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB666>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_BGR888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB4444_Premultiplied>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB6666_Premultiplied>() { return 0; }
+template<> constexpr uint blueWidth<QImage::Format_RGB16>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint blueWidth<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint blueWidth<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint blueWidth<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint blueShift<QImage::Format_RGB16>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB444>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB555>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB666>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB888>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_BGR888>() { return 16; }
+template<> constexpr uint blueShift<QImage::Format_ARGB4444_Premultiplied>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_ARGB6666_Premultiplied>() { return 0; }
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
#else
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBX8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
+template<> constexpr uint blueShift<QImage::Format_RGBX8888>() { return 16; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888>() { return 16; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
#endif
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB16>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB444>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB555>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB666>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_BGR888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGBX8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB16>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB444>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB555>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB666>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_BGR888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB4444_Premultiplied>() { return 12; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8555_Premultiplied>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8565_Premultiplied>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB6666_Premultiplied>() { return 18; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB16>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB444>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB555>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB666>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB888>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_BGR888>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint alphaWidth<QImage::Format_RGBX8888>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint alphaShift<QImage::Format_RGB16>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB444>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB555>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB666>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_BGR888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB4444_Premultiplied>() { return 12; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB8555_Premultiplied>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB8565_Premultiplied>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB6666_Premultiplied>() { return 18; }
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBX8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGBX8888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
#else
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBX8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_RGBX8888>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
#endif
template<QImage::Format> constexpr QPixelLayout::BPP bitsPerPixel();
@@ -221,17 +221,17 @@ inline void QT_FASTCALL storePixel<QPixelLayout::BPP24>(uchar *dest, int index,
template<QImage::Format Format>
static inline uint convertPixelToRGB32(uint s)
{
- Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1);
+ constexpr uint redMask = ((1 << redWidth<Format>()) - 1);
+ constexpr uint greenMask = ((1 << greenWidth<Format>()) - 1);
+ constexpr uint blueMask = ((1 << blueWidth<Format>()) - 1);
- Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>();
- Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>();
- Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>();
+ constexpr uchar redLeftShift = 8 - redWidth<Format>();
+ constexpr uchar greenLeftShift = 8 - greenWidth<Format>();
+ constexpr uchar blueLeftShift = 8 - blueWidth<Format>();
- Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8;
- Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8;
- Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8;
+ constexpr uchar redRightShift = 2 * redWidth<Format>() - 8;
+ constexpr uchar greenRightShift = 2 * greenWidth<Format>() - 8;
+ constexpr uchar blueRightShift = 2 * blueWidth<Format>() - 8;
uint red = (s >> redShift<Format>()) & redMask;
uint green = (s >> greenShift<Format>()) & greenMask;
@@ -300,22 +300,22 @@ static const QRgba64 *QT_FASTCALL fetchRGBToRGB64(QRgba64 *buffer, const uchar *
template<QImage::Format Format>
static inline uint convertPixelToARGB32PM(uint s)
{
- Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
- Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1);
+ constexpr uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
+ constexpr uint redMask = ((1 << redWidth<Format>()) - 1);
+ constexpr uint greenMask = ((1 << greenWidth<Format>()) - 1);
+ constexpr uint blueMask = ((1 << blueWidth<Format>()) - 1);
- Q_CONSTEXPR uchar alphaLeftShift = 8 - alphaWidth<Format>();
- Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>();
- Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>();
- Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>();
+ constexpr uchar alphaLeftShift = 8 - alphaWidth<Format>();
+ constexpr uchar redLeftShift = 8 - redWidth<Format>();
+ constexpr uchar greenLeftShift = 8 - greenWidth<Format>();
+ constexpr uchar blueLeftShift = 8 - blueWidth<Format>();
- Q_CONSTEXPR uchar alphaRightShift = 2 * alphaWidth<Format>() - 8;
- Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8;
- Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8;
- Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8;
+ constexpr uchar alphaRightShift = 2 * alphaWidth<Format>() - 8;
+ constexpr uchar redRightShift = 2 * redWidth<Format>() - 8;
+ constexpr uchar greenRightShift = 2 * greenWidth<Format>() - 8;
+ constexpr uchar blueRightShift = 2 * blueWidth<Format>() - 8;
- Q_CONSTEXPR bool mustMin = (alphaWidth<Format>() != redWidth<Format>()) ||
+ constexpr bool mustMin = (alphaWidth<Format>() != redWidth<Format>()) ||
(alphaWidth<Format>() != greenWidth<Format>()) ||
(alphaWidth<Format>() != blueWidth<Format>());
@@ -393,19 +393,19 @@ template<QImage::Format Format, bool fromRGB>
static void QT_FASTCALL storeRGBFromARGB32PM(uchar *dest, const uint *src, int index, int count,
const QList<QRgb> *, QDitherInfo *dither)
{
- Q_CONSTEXPR uchar rWidth = redWidth<Format>();
- Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
- Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
+ constexpr uchar rWidth = redWidth<Format>();
+ constexpr uchar gWidth = greenWidth<Format>();
+ constexpr uchar bWidth = blueWidth<Format>();
constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
// RGB32 -> RGB888 is not a precision loss.
if (!dither || (rWidth == 8 && gWidth == 8 && bWidth == 8)) {
- Q_CONSTEXPR uint rMask = (1 << redWidth<Format>()) - 1;
- Q_CONSTEXPR uint gMask = (1 << greenWidth<Format>()) - 1;
- Q_CONSTEXPR uint bMask = (1 << blueWidth<Format>()) - 1;
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
+ constexpr uint rMask = (1 << redWidth<Format>()) - 1;
+ constexpr uint gMask = (1 << greenWidth<Format>()) - 1;
+ constexpr uint bMask = (1 << blueWidth<Format>()) - 1;
+ constexpr uchar rRightShift = 24 - redWidth<Format>();
+ constexpr uchar gRightShift = 16 - greenWidth<Format>();
+ constexpr uchar bRightShift = 8 - blueWidth<Format>();
for (int i = 0; i < count; ++i) {
const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
@@ -447,17 +447,17 @@ static void QT_FASTCALL storeARGBPMFromARGB32PM(uchar *dest, const uint *src, in
{
constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
if (!dither) {
- Q_CONSTEXPR uint aMask = (1 << alphaWidth<Format>()) - 1;
- Q_CONSTEXPR uint rMask = (1 << redWidth<Format>()) - 1;
- Q_CONSTEXPR uint gMask = (1 << greenWidth<Format>()) - 1;
- Q_CONSTEXPR uint bMask = (1 << blueWidth<Format>()) - 1;
+ constexpr uint aMask = (1 << alphaWidth<Format>()) - 1;
+ constexpr uint rMask = (1 << redWidth<Format>()) - 1;
+ constexpr uint gMask = (1 << greenWidth<Format>()) - 1;
+ constexpr uint bMask = (1 << blueWidth<Format>()) - 1;
- Q_CONSTEXPR uchar aRightShift = 32 - alphaWidth<Format>();
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
+ constexpr uchar aRightShift = 32 - alphaWidth<Format>();
+ constexpr uchar rRightShift = 24 - redWidth<Format>();
+ constexpr uchar gRightShift = 16 - greenWidth<Format>();
+ constexpr uchar bRightShift = 8 - blueWidth<Format>();
- Q_CONSTEXPR uint aOpaque = aMask << alphaShift<Format>();
+ constexpr uint aOpaque = aMask << alphaShift<Format>();
for (int i = 0; i < count; ++i) {
const uint c = src[i];
const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>());
@@ -467,10 +467,10 @@ static void QT_FASTCALL storeARGBPMFromARGB32PM(uchar *dest, const uint *src, in
storePixel<BPP>(dest, index + i, a | r | g | b);
};
} else {
- Q_CONSTEXPR uchar aWidth = alphaWidth<Format>();
- Q_CONSTEXPR uchar rWidth = redWidth<Format>();
- Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
- Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
+ constexpr uchar aWidth = alphaWidth<Format>();
+ constexpr uchar rWidth = redWidth<Format>();
+ constexpr uchar gWidth = greenWidth<Format>();
+ constexpr uchar bWidth = blueWidth<Format>();
const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
for (int i = 0; i < count; ++i) {
@@ -503,19 +503,19 @@ static void QT_FASTCALL storeARGBPMFromARGB32PM(uchar *dest, const uint *src, in
template<QImage::Format Format>
static void QT_FASTCALL rbSwap(uchar *dst, const uchar *src, int count)
{
- Q_CONSTEXPR uchar aWidth = alphaWidth<Format>();
- Q_CONSTEXPR uchar aShift = alphaShift<Format>();
- Q_CONSTEXPR uchar rWidth = redWidth<Format>();
- Q_CONSTEXPR uchar rShift = redShift<Format>();
- Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
- Q_CONSTEXPR uchar gShift = greenShift<Format>();
- Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
- Q_CONSTEXPR uchar bShift = blueShift<Format>();
+ constexpr uchar aWidth = alphaWidth<Format>();
+ constexpr uchar aShift = alphaShift<Format>();
+ constexpr uchar rWidth = redWidth<Format>();
+ constexpr uchar rShift = redShift<Format>();
+ constexpr uchar gWidth = greenWidth<Format>();
+ constexpr uchar gShift = greenShift<Format>();
+ constexpr uchar bWidth = blueWidth<Format>();
+ constexpr uchar bShift = blueShift<Format>();
#ifdef Q_COMPILER_CONSTEXPR
static_assert(rWidth == bWidth);
#endif
- Q_CONSTEXPR uint redBlueMask = (1 << rWidth) - 1;
- Q_CONSTEXPR uint alphaGreenMask = (((1 << aWidth) - 1) << aShift)
+ constexpr uint redBlueMask = (1 << rWidth) - 1;
+ constexpr uint alphaGreenMask = (((1 << aWidth) - 1) << aShift)
| (((1 << gWidth) - 1) << gShift);
constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>();
@@ -570,7 +570,7 @@ static void QT_FASTCALL rbSwap_rgb30(uchar *d, const uchar *s, int count)
UNALIASED_CONVERSION_LOOP(dest, src, count, qRgbSwapRgb30);
}
-template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutRGB()
+template<QImage::Format Format> constexpr static inline QPixelLayout pixelLayoutRGB()
{
return QPixelLayout{
false,
@@ -586,7 +586,7 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe
};
}
-template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutARGBPM()
+template<QImage::Format Format> constexpr static inline QPixelLayout pixelLayoutARGBPM()
{
return QPixelLayout{
true,
diff --git a/src/gui/painting/qpixellayout_p.h b/src/gui/painting/qpixellayout_p.h
index 99d98ac36e..6d20131efe 100644
--- a/src/gui/painting/qpixellayout_p.h
+++ b/src/gui/painting/qpixellayout_p.h
@@ -77,7 +77,7 @@ inline QRgb qRepremultiply(QRgb p)
if (alpha == 255 || alpha == 0)
return p;
p = qUnpremultiply(p);
- Q_CONSTEXPR uint mult = 255 / (255 >> Shift);
+ constexpr uint mult = 255 / (255 >> Shift);
const uint newAlpha = mult * (alpha >> Shift);
p = (p & ~0xff000000) | (newAlpha<<24);
return qPremultiply(p);
@@ -90,7 +90,7 @@ inline QRgba64 qRepremultiply(QRgba64 p)
if (alpha == 65535 || alpha == 0)
return p;
p = p.unpremultiplied();
- Q_CONSTEXPR uint mult = 65535 / (65535 >> Shift);
+ constexpr uint mult = 65535 / (65535 >> Shift);
p.setAlpha(mult * (alpha >> Shift));
return p.premultiplied();
}
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index fe8306109b..c6caa62c75 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -51,34 +51,34 @@ typedef unsigned int QRgb; // RGB triplet
// non-namespaced Qt global variable
const Q_DECL_UNUSED QRgb RGB_MASK = 0x00ffffff; // masks RGB values
-inline Q_DECL_CONSTEXPR int qRed(QRgb rgb) // get red part of RGB
+inline constexpr int qRed(QRgb rgb) // get red part of RGB
{ return ((rgb >> 16) & 0xff); }
-inline Q_DECL_CONSTEXPR int qGreen(QRgb rgb) // get green part of RGB
+inline constexpr int qGreen(QRgb rgb) // get green part of RGB
{ return ((rgb >> 8) & 0xff); }
-inline Q_DECL_CONSTEXPR int qBlue(QRgb rgb) // get blue part of RGB
+inline constexpr int qBlue(QRgb rgb) // get blue part of RGB
{ return (rgb & 0xff); }
-inline Q_DECL_CONSTEXPR int qAlpha(QRgb rgb) // get alpha part of RGBA
+inline constexpr int qAlpha(QRgb rgb) // get alpha part of RGBA
{ return rgb >> 24; }
-inline Q_DECL_CONSTEXPR QRgb qRgb(int r, int g, int b)// set RGB value
+inline constexpr QRgb qRgb(int r, int g, int b) // set RGB value
{ return (0xffu << 24) | ((r & 0xffu) << 16) | ((g & 0xffu) << 8) | (b & 0xffu); }
-inline Q_DECL_CONSTEXPR QRgb qRgba(int r, int g, int b, int a)// set RGBA value
+inline constexpr QRgb qRgba(int r, int g, int b, int a) // set RGBA value
{ return ((a & 0xffu) << 24) | ((r & 0xffu) << 16) | ((g & 0xffu) << 8) | (b & 0xffu); }
-inline Q_DECL_CONSTEXPR int qGray(int r, int g, int b)// convert R,G,B to gray 0..255
+inline constexpr int qGray(int r, int g, int b) // convert R,G,B to gray 0..255
{ return (r*11+g*16+b*5)/32; }
-inline Q_DECL_CONSTEXPR int qGray(QRgb rgb) // convert RGB to gray 0..255
+inline constexpr int qGray(QRgb rgb) // convert RGB to gray 0..255
{ return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); }
-inline Q_DECL_CONSTEXPR bool qIsGray(QRgb rgb)
+inline constexpr bool qIsGray(QRgb rgb)
{ return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); }
-inline Q_DECL_RELAXED_CONSTEXPR QRgb qPremultiply(QRgb x)
+inline constexpr QRgb qPremultiply(QRgb x)
{
const uint a = qAlpha(x);
uint t = (x & 0xff00ff) * a;
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h
index 30d5e244b8..2c644c4cf0 100644
--- a/src/gui/painting/qrgba64.h
+++ b/src/gui/painting/qrgba64.h
@@ -64,16 +64,16 @@ class QRgba64 {
#endif
};
- explicit Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64(quint64 c) : rgba(c) { }
+ explicit Q_ALWAYS_INLINE constexpr QRgba64(quint64 c) : rgba(c) { }
public:
QRgba64() = default;
- Q_DECL_CONSTEXPR static
+ constexpr static
QRgba64 fromRgba64(quint64 c)
{
return QRgba64(c);
}
- Q_DECL_CONSTEXPR static
+ constexpr static
QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)
{
return fromRgba64(quint64(red) << RedShift
@@ -81,42 +81,42 @@ public:
| quint64(blue) << BlueShift
| quint64(alpha) << AlphaShift);
}
- Q_DECL_RELAXED_CONSTEXPR static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
+ constexpr static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
{
QRgba64 rgb64 = fromRgba64(red, green, blue, alpha);
// Expand the range so that 0x00 maps to 0x0000 and 0xff maps to 0xffff.
rgb64.rgba |= rgb64.rgba << 8;
return rgb64;
}
- Q_DECL_RELAXED_CONSTEXPR static
+ constexpr static
QRgba64 fromArgb32(uint rgb)
{
return fromRgba(quint8(rgb >> 16), quint8(rgb >> 8), quint8(rgb), quint8(rgb >> 24));
}
- Q_DECL_CONSTEXPR bool isOpaque() const
+ constexpr bool isOpaque() const
{
return (rgba & alphaMask()) == alphaMask();
}
- Q_DECL_CONSTEXPR bool isTransparent() const
+ constexpr bool isTransparent() const
{
return (rgba & alphaMask()) == 0;
}
- Q_DECL_CONSTEXPR quint16 red() const { return quint16(rgba >> RedShift); }
- Q_DECL_CONSTEXPR quint16 green() const { return quint16(rgba >> GreenShift); }
- Q_DECL_CONSTEXPR quint16 blue() const { return quint16(rgba >> BlueShift); }
- Q_DECL_CONSTEXPR quint16 alpha() const { return quint16(rgba >> AlphaShift); }
+ constexpr quint16 red() const { return quint16(rgba >> RedShift); }
+ constexpr quint16 green() const { return quint16(rgba >> GreenShift); }
+ constexpr quint16 blue() const { return quint16(rgba >> BlueShift); }
+ constexpr quint16 alpha() const { return quint16(rgba >> AlphaShift); }
void setRed(quint16 _red) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << RedShift)) | (quint64(_red) << RedShift); }
void setGreen(quint16 _green) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << GreenShift)) | (quint64(_green) << GreenShift); }
void setBlue(quint16 _blue) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << BlueShift)) | (quint64(_blue) << BlueShift); }
void setAlpha(quint16 _alpha) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << AlphaShift)) | (quint64(_alpha) << AlphaShift); }
- Q_DECL_CONSTEXPR quint8 red8() const { return div_257(red()); }
- Q_DECL_CONSTEXPR quint8 green8() const { return div_257(green()); }
- Q_DECL_CONSTEXPR quint8 blue8() const { return div_257(blue()); }
- Q_DECL_CONSTEXPR quint8 alpha8() const { return div_257(alpha()); }
- Q_DECL_CONSTEXPR uint toArgb32() const
+ constexpr quint8 red8() const { return div_257(red()); }
+ constexpr quint8 green8() const { return div_257(green()); }
+ constexpr quint8 blue8() const { return div_257(blue()); }
+ constexpr quint8 alpha8() const { return div_257(alpha()); }
+ constexpr uint toArgb32() const
{
#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
quint64 br = rgba & Q_UINT64_C(0xffff0000ffff);
@@ -140,12 +140,12 @@ public:
return uint((alpha8() << 24) | (red8() << 16) | (green8() << 8) | blue8());
#endif
}
- Q_DECL_CONSTEXPR ushort toRgb16() const
+ constexpr ushort toRgb16() const
{
return ushort((red() & 0xf800) | ((green() >> 10) << 5) | (blue() >> 11));
}
- Q_DECL_RELAXED_CONSTEXPR QRgba64 premultiplied() const
+ constexpr QRgba64 premultiplied() const
{
if (isOpaque())
return *this;
@@ -167,7 +167,7 @@ public:
#endif
}
- Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied() const
+ constexpr QRgba64 unpremultiplied() const
{
#if Q_PROCESSOR_WORDSIZE < 8
return unpremultiplied_32bit();
@@ -176,7 +176,7 @@ public:
#endif
}
- Q_DECL_CONSTEXPR operator quint64() const
+ constexpr operator quint64() const
{
return rgba;
}
@@ -188,11 +188,11 @@ public:
}
private:
- static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; }
+ static constexpr Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; }
- static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); }
- static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); }
- Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const
+ static constexpr Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); }
+ static constexpr Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); }
+ constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const
{
if (isOpaque() || isTransparent())
return *this;
@@ -202,7 +202,7 @@ private:
const quint16 b = quint16((blue() * 0xffff + a/2) / a);
return fromRgba64(r, g, b, quint16(a));
}
- Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const
+ constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const
{
if (isOpaque() || isTransparent())
return *this;
@@ -217,36 +217,36 @@ private:
Q_DECLARE_TYPEINFO(QRgba64, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a)
+constexpr inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a)
{
return QRgba64::fromRgba64(r, g, b, a);
}
-Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint64 c)
+constexpr inline QRgba64 qRgba64(quint64 c)
{
return QRgba64::fromRgba64(c);
}
-Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qPremultiply(QRgba64 c)
+constexpr inline QRgba64 qPremultiply(QRgba64 c)
{
return c.premultiplied();
}
-Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qUnpremultiply(QRgba64 c)
+constexpr inline QRgba64 qUnpremultiply(QRgba64 c)
{
return c.unpremultiplied();
}
-inline Q_DECL_CONSTEXPR uint qRed(QRgba64 rgb)
+inline constexpr uint qRed(QRgba64 rgb)
{ return rgb.red8(); }
-inline Q_DECL_CONSTEXPR uint qGreen(QRgba64 rgb)
+inline constexpr uint qGreen(QRgba64 rgb)
{ return rgb.green8(); }
-inline Q_DECL_CONSTEXPR uint qBlue(QRgba64 rgb)
+inline constexpr uint qBlue(QRgba64 rgb)
{ return rgb.blue8(); }
-inline Q_DECL_CONSTEXPR uint qAlpha(QRgba64 rgb)
+inline constexpr uint qAlpha(QRgba64 rgb)
{ return rgb.alpha8(); }
QT_END_NAMESPACE
diff --git a/src/gui/painting/webgradients.cpp b/src/gui/painting/webgradients.cpp
index d837c4383c..8800523367 100644
--- a/src/gui/painting/webgradients.cpp
+++ b/src/gui/painting/webgradients.cpp
@@ -386,7 +386,7 @@ static QList<QGradientStop> qt_preset_gradient_stops(QGradient::Preset preset)
return {};
}
-static Q_CONSTEXPR QGradient::QGradientData qt_preset_gradient_data[] = {
+static constexpr QGradient::QGradientData qt_preset_gradient_data[] = {
{ { 0, 1, 1, 0 } },
{ { 0.5, 1, 0.5, 0 } },
{ { 0.5, 1, 0.5, 0 } },
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 61c47c5e83..0e80510058 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -332,7 +332,7 @@ public:
struct QScriptItem
{
- Q_DECL_CONSTEXPR QScriptItem(int p, QScriptAnalysis a) noexcept
+ constexpr QScriptItem(int p, QScriptAnalysis a) noexcept
: position(p), analysis(a),
num_glyphs(0), descent(-1), ascent(-1), leading(-1), width(-1),
glyph_data_offset(0) {}
@@ -345,7 +345,7 @@ struct QScriptItem
QFixed leading;
QFixed width;
int glyph_data_offset;
- Q_DECL_CONSTEXPR QFixed height() const noexcept { return ascent + descent; }
+ constexpr QFixed height() const noexcept { return ascent + descent; }
private:
friend class QList<QScriptItem>;
QScriptItem() {} // for QList, don't use
diff --git a/src/network/kernel/qhostaddress_p.h b/src/network/kernel/qhostaddress_p.h
index 4dc2989011..101c163800 100644
--- a/src/network/kernel/qhostaddress_p.h
+++ b/src/network/kernel/qhostaddress_p.h
@@ -78,7 +78,7 @@ class QNetmask
// stores 0-32 for IPv4, 0-128 for IPv6, or 255 for invalid
quint8 length;
public:
- Q_DECL_CONSTEXPR QNetmask() : length(255) {}
+ constexpr QNetmask() : length(255) {}
bool setAddress(const QHostAddress &address);
QHostAddress address(QAbstractSocket::NetworkLayerProtocol protocol) const;
diff --git a/src/network/ssl/qsslcertificate_openssl.cpp b/src/network/ssl/qsslcertificate_openssl.cpp
index cd178313b7..35521427b2 100644
--- a/src/network/ssl/qsslcertificate_openssl.cpp
+++ b/src/network/ssl/qsslcertificate_openssl.cpp
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
-Q_CONSTEXPR int MutexPoolSize = 17;
+constexpr int MutexPoolSize = 17;
static QBasicMutex mutexPool[MutexPoolSize];
namespace QMutexPool {
static QBasicMutex *globalInstanceGet(const void *addr)
diff --git a/src/network/ssl/qsslellipticcurve.h b/src/network/ssl/qsslellipticcurve.h
index c63552c680..d777087344 100644
--- a/src/network/ssl/qsslellipticcurve.h
+++ b/src/network/ssl/qsslellipticcurve.h
@@ -52,11 +52,11 @@ QT_BEGIN_NAMESPACE
class QSslEllipticCurve;
// qHash is a friend, but we can't use default arguments for friends (ยง8.3.6.4)
-Q_DECL_CONSTEXPR size_t qHash(QSslEllipticCurve curve, size_t seed = 0) noexcept;
+constexpr size_t qHash(QSslEllipticCurve curve, size_t seed = 0) noexcept;
class QSslEllipticCurve {
public:
- Q_DECL_CONSTEXPR QSslEllipticCurve() noexcept
+ constexpr QSslEllipticCurve() noexcept
: id(0)
{
}
@@ -67,7 +67,7 @@ public:
Q_REQUIRED_RESULT Q_NETWORK_EXPORT QString shortName() const;
Q_REQUIRED_RESULT Q_NETWORK_EXPORT QString longName() const;
- Q_DECL_CONSTEXPR bool isValid() const noexcept
+ constexpr bool isValid() const noexcept
{
return id != 0;
}
@@ -77,8 +77,8 @@ public:
private:
int id;
- friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept;
- friend Q_DECL_CONSTEXPR size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept;
+ friend constexpr bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept;
+ friend constexpr size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept;
friend class QSslContext;
friend class QSslSocketPrivate;
@@ -87,13 +87,13 @@ private:
Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept
+constexpr inline size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept
{ return qHash(curve.id, seed); }
-Q_DECL_CONSTEXPR inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
+constexpr inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
{ return lhs.id == rhs.id; }
-Q_DECL_CONSTEXPR inline bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
+constexpr inline bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
{ return !operator==(lhs, rhs); }
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/opengl/qopenglshaderprogram.cpp b/src/opengl/qopenglshaderprogram.cpp
index e23909961c..da3ff392ef 100644
--- a/src/opengl/qopenglshaderprogram.cpp
+++ b/src/opengl/qopenglshaderprogram.cpp
@@ -489,13 +489,13 @@ static const char blendEquationAdvancedHeader[] =
struct QVersionDirectivePosition
{
- Q_DECL_CONSTEXPR QVersionDirectivePosition(int position = 0, int line = -1)
+ constexpr QVersionDirectivePosition(int position = 0, int line = -1)
: position(position)
, line(line)
{
}
- Q_DECL_CONSTEXPR bool hasPosition() const
+ constexpr bool hasPosition() const
{
return position > 0;
}
diff --git a/src/opengl/qopenglversionfunctions.h b/src/opengl/qopenglversionfunctions.h
index a28a3c5d14..546f3f3e41 100644
--- a/src/opengl/qopenglversionfunctions.h
+++ b/src/opengl/qopenglversionfunctions.h
@@ -89,12 +89,12 @@ struct QOpenGLVersionStatus
InvalidStatus
};
- Q_DECL_CONSTEXPR QOpenGLVersionStatus()
+ constexpr QOpenGLVersionStatus()
: version(0, 0),
status(InvalidStatus)
{}
- Q_DECL_CONSTEXPR QOpenGLVersionStatus(int majorVersion, int minorVersion, QOpenGLVersionStatus::OpenGLStatus functionStatus)
+ constexpr QOpenGLVersionStatus(int majorVersion, int minorVersion, QOpenGLVersionStatus::OpenGLStatus functionStatus)
: version(majorVersion, minorVersion),
status(functionStatus)
{}
@@ -109,12 +109,12 @@ inline size_t qHash(const QOpenGLVersionStatus &v, size_t seed = 0) noexcept
+ v.version.first * 100 + v.version.second * 10, seed);
}
-Q_DECL_CONSTEXPR inline bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
+constexpr inline bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
{
return lhs.status == rhs.status && lhs.version == rhs.version;
}
-Q_DECL_CONSTEXPR inline bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
+constexpr inline bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
{
return !operator==(lhs, rhs);
}
@@ -251,7 +251,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_0_Core; }
// OpenGL 1.0 core functions
@@ -317,7 +317,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_1_Core; }
// OpenGL 1.1 core functions
@@ -351,7 +351,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_2_Core; }
// OpenGL 1.2 core functions
@@ -375,7 +375,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_3_Core; }
// OpenGL 1.3 core functions
@@ -402,7 +402,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_4_Core; }
// OpenGL 1.4 core functions
@@ -427,7 +427,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_5_Core; }
// OpenGL 1.5 core functions
@@ -464,7 +464,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_2_0_Core; }
// OpenGL 2.0 core functions
@@ -575,7 +575,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_2_1_Core; }
// OpenGL 2.1 core functions
@@ -599,7 +599,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_3_0_Core; }
// OpenGL 3.0 core functions
@@ -701,7 +701,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_3_1_Core; }
// OpenGL 3.1 core functions
@@ -731,7 +731,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_3_2_Core; }
// OpenGL 3.2 core functions
@@ -768,7 +768,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_3_3_Core; }
// OpenGL 3.3 core functions
@@ -844,7 +844,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_4_0_Core; }
// OpenGL 4.0 core functions
@@ -908,7 +908,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_4_1_Core; }
// OpenGL 4.1 core functions
@@ -1014,7 +1014,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_4_2_Core; }
// OpenGL 4.2 core functions
@@ -1044,7 +1044,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_4_3_Core; }
// OpenGL 4.3 core functions
@@ -1105,7 +1105,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_4_4_Core; }
// OpenGL 4.4 core functions
@@ -1132,7 +1132,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_4_5_Core; }
// OpenGL 4.5 core functions
@@ -1256,7 +1256,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_0_Deprecated; }
// OpenGL 1.0 deprecated functions
@@ -1532,7 +1532,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_1_Deprecated; }
// OpenGL 1.1 deprecated functions
@@ -1567,7 +1567,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_2_Deprecated; }
// OpenGL 1.2 deprecated functions
@@ -1617,7 +1617,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_3_Deprecated; }
// OpenGL 1.3 deprecated functions
@@ -1672,7 +1672,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_1_4_Deprecated; }
// OpenGL 1.4 deprecated functions
@@ -1728,7 +1728,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_2_0_Deprecated; }
// OpenGL 2.0 deprecated functions
@@ -1782,7 +1782,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_3_0_Deprecated; }
// OpenGL 3.0 deprecated functions
@@ -1820,7 +1820,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_3_3_Deprecated; }
// OpenGL 3.3 deprecated functions
@@ -1868,7 +1868,7 @@ public:
init();
}
- Q_DECL_CONSTEXPR static Version versionStatus()
+ constexpr static Version versionStatus()
{ return OpenGL_4_5_Deprecated; }
// OpenGL 4.5 deprecated functions
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index 7cd35c7308..e5f544c385 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -934,8 +934,8 @@ QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pData
QVariant result;
if (canConvertToMime(mime, pDataObj)) {
QByteArray html = getData(CF_HTML, pDataObj);
- static Q_RELAXED_CONSTEXPR auto startMatcher = qMakeStaticByteArrayMatcher("StartHTML:");
- static Q_RELAXED_CONSTEXPR auto endMatcher = qMakeStaticByteArrayMatcher("EndHTML:");
+ static constexpr auto startMatcher = qMakeStaticByteArrayMatcher("StartHTML:");
+ static constexpr auto endMatcher = qMakeStaticByteArrayMatcher("EndHTML:");
qCDebug(lcQpaMime) << __FUNCTION__ << "raw:" << html;
int start = startMatcher.indexIn(html);
int end = endMatcher.indexIn(html);
@@ -978,8 +978,8 @@ bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeDa
"StartFragment:0000000000\r\n" // 56-81
"EndFragment:0000000000\r\n\r\n"; // 82-107
- static Q_RELAXED_CONSTEXPR auto startFragmentMatcher = qMakeStaticByteArrayMatcher("<!--StartFragment-->");
- static Q_RELAXED_CONSTEXPR auto endFragmentMatcher = qMakeStaticByteArrayMatcher("<!--EndFragment-->");
+ static constexpr auto startFragmentMatcher = qMakeStaticByteArrayMatcher("<!--StartFragment-->");
+ static constexpr auto endFragmentMatcher = qMakeStaticByteArrayMatcher("<!--EndFragment-->");
if (startFragmentMatcher.indexIn(data) == -1)
result += "<!--StartFragment-->";
diff --git a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
index 1f7e7cf49b..117d5948cc 100644
--- a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
+++ b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
@@ -190,7 +190,7 @@ struct QX11InfoData {
};
template <class T>
-Q_DECL_RELAXED_CONSTEXPR inline int lowest_bit(T v) noexcept
+constexpr inline int lowest_bit(T v) noexcept
{
int result = qCountTrailingZeroBits(v);
return ((result >> 3) == sizeof(T)) ? -1 : result;
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index 48295f58e5..378e9322e2 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -2454,7 +2454,7 @@ static QString make_where_clause(const QString &user, Expression e)
"WMSYS",
};
static const char joinC[][4] = { "or" , "and" };
- static Q_CONSTEXPR QLatin1Char bang[] = { QLatin1Char(' '), QLatin1Char('!') };
+ static constexpr QLatin1Char bang[] = { QLatin1Char(' '), QLatin1Char('!') };
const QLatin1String join(joinC[e]);
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 07f4ae4a90..cb41c87043 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -68,28 +68,28 @@ class QListViewItem
friend class QListModeViewBase;
friend class QIconModeViewBase;
public:
- Q_DECL_CONSTEXPR QListViewItem()
+ constexpr QListViewItem()
: x(-1), y(-1), w(0), h(0), indexHint(-1), visited(0xffff) {}
- Q_DECL_CONSTEXPR QListViewItem(QRect r, int i)
+ constexpr QListViewItem(QRect r, int i)
: x(r.x()), y(r.y()), w(qMin(r.width(), SHRT_MAX)), h(qMin(r.height(), SHRT_MAX)),
indexHint(i), visited(0xffff) {}
- Q_DECL_CONSTEXPR bool operator==(const QListViewItem &other) const {
+ constexpr bool operator==(const QListViewItem &other) const {
return (x == other.x && y == other.y && w == other.w && h == other.h &&
indexHint == other.indexHint); }
- Q_DECL_CONSTEXPR bool operator!=(const QListViewItem &other) const
+ constexpr bool operator!=(const QListViewItem &other) const
{ return !(*this == other); }
- Q_DECL_CONSTEXPR bool isValid() const
+ constexpr bool isValid() const
{ return rect().isValid() && (indexHint > -1); }
- Q_DECL_RELAXED_CONSTEXPR void invalidate()
+ constexpr void invalidate()
{ x = -1; y = -1; w = 0; h = 0; }
- Q_DECL_RELAXED_CONSTEXPR void resize(QSize size)
+ constexpr void resize(QSize size)
{ w = qMin(size.width(), SHRT_MAX); h = qMin(size.height(), SHRT_MAX); }
- Q_DECL_RELAXED_CONSTEXPR void move(QPoint position)
+ constexpr void move(QPoint position)
{ x = position.x(); y = position.y(); }
- Q_DECL_CONSTEXPR int width() const { return w; }
- Q_DECL_CONSTEXPR int height() const { return h; }
+ constexpr int width() const { return w; }
+ constexpr int height() const { return h; }
private:
- Q_DECL_CONSTEXPR QRect rect() const
+ constexpr QRect rect() const
{ return QRect(x, y, w, h); }
int x, y;
short w, h;
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 245a3d069c..5056b91ea7 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -46,22 +46,6 @@
QT_BEGIN_NAMESPACE
-// gcc < 4.8.0 has problems with init'ing variant members in constexpr ctors
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54922
-#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) || defined(Q_CC_CLANG) || Q_CC_GNU >= 408
-# define QT_SIZEPOLICY_CONSTEXPR Q_DECL_CONSTEXPR
-# if defined(Q_COMPILER_UNIFORM_INIT)
-# define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT Q_DECL_CONSTEXPR
-# endif // uniform-init
-#endif
-
-#ifndef QT_SIZEPOLICY_CONSTEXPR
-# define QT_SIZEPOLICY_CONSTEXPR
-#endif
-#ifndef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
-# define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
-#endif
-
class QVariant;
class QSizePolicy;
@@ -110,60 +94,47 @@ public:
Q_DECLARE_FLAGS(ControlTypes, ControlType)
Q_FLAG(ControlTypes)
- QT_SIZEPOLICY_CONSTEXPR QSizePolicy() noexcept : data(0) { }
+ constexpr QSizePolicy() noexcept : data(0) { }
-#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
- QT_SIZEPOLICY_CONSTEXPR QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) noexcept
+ constexpr QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) noexcept
: bits{0, 0, quint32(horizontal), quint32(vertical),
type == DefaultType ? 0 : toControlTypeFieldValue(type), 0, 0, 0}
{}
-#else
- QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) noexcept
- : data(0) {
- bits.horPolicy = horizontal;
- bits.verPolicy = vertical;
- setControlType(type);
- }
-#endif // uniform-init
- QT_SIZEPOLICY_CONSTEXPR Policy horizontalPolicy() const noexcept { return static_cast<Policy>(bits.horPolicy); }
- QT_SIZEPOLICY_CONSTEXPR Policy verticalPolicy() const noexcept { return static_cast<Policy>(bits.verPolicy); }
+ constexpr Policy horizontalPolicy() const noexcept { return static_cast<Policy>(bits.horPolicy); }
+ constexpr Policy verticalPolicy() const noexcept { return static_cast<Policy>(bits.verPolicy); }
ControlType controlType() const noexcept;
- Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) noexcept { bits.horPolicy = d; }
- Q_DECL_RELAXED_CONSTEXPR void setVerticalPolicy(Policy d) noexcept { bits.verPolicy = d; }
+ constexpr void setHorizontalPolicy(Policy d) noexcept { bits.horPolicy = d; }
+ constexpr void setVerticalPolicy(Policy d) noexcept { bits.verPolicy = d; }
void setControlType(ControlType type) noexcept;
- QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const noexcept {
+ constexpr Qt::Orientations expandingDirections() const noexcept {
return ( (verticalPolicy() & ExpandFlag) ? Qt::Vertical : Qt::Orientations() )
| ( (horizontalPolicy() & ExpandFlag) ? Qt::Horizontal : Qt::Orientations() ) ;
}
- Q_DECL_RELAXED_CONSTEXPR void setHeightForWidth(bool b) noexcept { bits.hfw = b; }
- QT_SIZEPOLICY_CONSTEXPR bool hasHeightForWidth() const noexcept { return bits.hfw; }
- Q_DECL_RELAXED_CONSTEXPR void setWidthForHeight(bool b) noexcept { bits.wfh = b; }
- QT_SIZEPOLICY_CONSTEXPR bool hasWidthForHeight() const noexcept { return bits.wfh; }
+ constexpr void setHeightForWidth(bool b) noexcept { bits.hfw = b; }
+ constexpr bool hasHeightForWidth() const noexcept { return bits.hfw; }
+ constexpr void setWidthForHeight(bool b) noexcept { bits.wfh = b; }
+ constexpr bool hasWidthForHeight() const noexcept { return bits.wfh; }
- QT_SIZEPOLICY_CONSTEXPR bool operator==(const QSizePolicy& s) const noexcept { return data == s.data; }
- QT_SIZEPOLICY_CONSTEXPR bool operator!=(const QSizePolicy& s) const noexcept { return data != s.data; }
+ constexpr bool operator==(const QSizePolicy& s) const noexcept { return data == s.data; }
+ constexpr bool operator!=(const QSizePolicy& s) const noexcept { return data != s.data; }
friend Q_DECL_CONST_FUNCTION size_t qHash(QSizePolicy key, size_t seed) noexcept { return qHash(key.data, seed); }
operator QVariant() const;
- QT_SIZEPOLICY_CONSTEXPR int horizontalStretch() const noexcept { return static_cast<int>(bits.horStretch); }
- QT_SIZEPOLICY_CONSTEXPR int verticalStretch() const noexcept { return static_cast<int>(bits.verStretch); }
- Q_DECL_RELAXED_CONSTEXPR void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
- Q_DECL_RELAXED_CONSTEXPR void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
+ constexpr int horizontalStretch() const noexcept { return static_cast<int>(bits.horStretch); }
+ constexpr int verticalStretch() const noexcept { return static_cast<int>(bits.verStretch); }
+ constexpr void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
+ constexpr void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
- QT_SIZEPOLICY_CONSTEXPR bool retainSizeWhenHidden() const noexcept { return bits.retainSizeWhenHidden; }
- Q_DECL_RELAXED_CONSTEXPR void setRetainSizeWhenHidden(bool retainSize) noexcept { bits.retainSizeWhenHidden = retainSize; }
+ constexpr bool retainSizeWhenHidden() const noexcept { return bits.retainSizeWhenHidden; }
+ constexpr void setRetainSizeWhenHidden(bool retainSize) noexcept { bits.retainSizeWhenHidden = retainSize; }
- Q_DECL_RELAXED_CONSTEXPR void transpose() noexcept { *this = transposed(); }
- Q_REQUIRED_RESULT
-#ifndef Q_QDOC
- QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
-#endif
- QSizePolicy transposed() const noexcept
+ constexpr void transpose() noexcept { *this = transposed(); }
+ Q_REQUIRED_RESULT constexpr QSizePolicy transposed() const noexcept
{
return QSizePolicy(bits.transposed());
}
@@ -173,11 +144,11 @@ private:
friend Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
friend Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
#endif
- QT_SIZEPOLICY_CONSTEXPR QSizePolicy(int i) noexcept : data(i) { }
+ constexpr QSizePolicy(int i) noexcept : data(i) { }
struct Bits;
- QT_SIZEPOLICY_CONSTEXPR explicit QSizePolicy(Bits b) noexcept : bits(b) { }
+ constexpr explicit QSizePolicy(Bits b) noexcept : bits(b) { }
- static Q_DECL_RELAXED_CONSTEXPR quint32 toControlTypeFieldValue(ControlType type) noexcept
+ static constexpr quint32 toControlTypeFieldValue(ControlType type) noexcept
{
/*
The control type is a flag type, with values 0x1, 0x2, 0x4, 0x8, 0x10,
@@ -206,8 +177,7 @@ private:
quint32 wfh : 1;
quint32 retainSizeWhenHidden : 1;
- QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
- Bits transposed() const noexcept
+ constexpr Bits transposed() const noexcept
{
return {verStretch, // \ swap
horStretch, // /
@@ -238,10 +208,6 @@ Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &);
#endif
-
-#undef QT_SIZEPOLICY_CONSTEXPR
-#undef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
-
QT_END_NAMESPACE
#endif // QSIZEPOLICY_H
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 1f1fc73727..bb646accf6 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -3194,9 +3194,9 @@ struct StaticPolygonF
{
QPointF data[N];
- Q_DECL_CONSTEXPR int size() const { return N; }
- Q_DECL_CONSTEXPR const QPointF *cbegin() const { return data; }
- Q_DECL_CONSTEXPR const QPointF &operator[](int idx) const { return data[idx]; }
+ constexpr int size() const { return N; }
+ constexpr const QPointF *cbegin() const { return data; }
+ constexpr const QPointF &operator[](int idx) const { return data[idx]; }
};
static StaticPolygonF<3> calcArrow(const QStyleOptionSlider *dial, qreal &a)
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index be3d275375..68cd7e8451 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -426,7 +426,7 @@ QString QCalendarYearValidator::text(QDate date, QCalendar cal, int repeat) cons
///////////////////////////////////
struct SectionToken {
- Q_DECL_CONSTEXPR SectionToken(QCalendarDateSectionValidator *v, int rep)
+ constexpr SectionToken(QCalendarDateSectionValidator *v, int rep)
: validator(v), repeat(rep) {}
QCalendarDateSectionValidator *validator;
@@ -826,9 +826,9 @@ class StaticDayOfWeekAssociativeArray {
bool contained[7];
T data[7];
- static Q_DECL_CONSTEXPR int day2idx(Qt::DayOfWeek day) noexcept { return int(day) - 1; } // alt: day % 7
+ static constexpr int day2idx(Qt::DayOfWeek day) noexcept { return int(day) - 1; } // alt: day % 7
public:
- Q_DECL_CONSTEXPR StaticDayOfWeekAssociativeArray() noexcept(noexcept(T()))
+ constexpr StaticDayOfWeekAssociativeArray() noexcept(noexcept(T()))
#ifdef Q_COMPILER_CONSTEXPR
: contained{}, data{} // arrays require uniform initialization
#else
@@ -836,17 +836,17 @@ public:
#endif
{}
- Q_DECL_CONSTEXPR bool contains(Qt::DayOfWeek day) const noexcept { return contained[day2idx(day)]; }
- Q_DECL_CONSTEXPR const T &value(Qt::DayOfWeek day) const noexcept { return data[day2idx(day)]; }
+ constexpr bool contains(Qt::DayOfWeek day) const noexcept { return contained[day2idx(day)]; }
+ constexpr const T &value(Qt::DayOfWeek day) const noexcept { return data[day2idx(day)]; }
- Q_DECL_RELAXED_CONSTEXPR T &operator[](Qt::DayOfWeek day) noexcept
+ constexpr T &operator[](Qt::DayOfWeek day) noexcept
{
const int idx = day2idx(day);
contained[idx] = true;
return data[idx];
}
- Q_DECL_RELAXED_CONSTEXPR void insert(Qt::DayOfWeek day, T v) noexcept
+ constexpr void insert(Qt::DayOfWeek day, T v) noexcept
{
operator[](day).swap(v);
}
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index 56319f215d..e0cc1d71f5 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -93,7 +93,7 @@ void tst_QFlags::testFlagMultiBits() const
template <unsigned int N, typename T> bool verifyConstExpr(T n) { return n == N; }
-Q_DECL_RELAXED_CONSTEXPR Qt::MouseButtons testRelaxedConstExpr()
+constexpr Qt::MouseButtons testRelaxedConstExpr()
{
Qt::MouseButtons value;
value = Qt::LeftButton | Qt::RightButton;
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index 02dbdff157..c8613f5f48 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -302,8 +302,8 @@ void tst_QUuid::notEqual()
void tst_QUuid::cpp11() {
#ifdef Q_COMPILER_UNIFORM_INIT
// "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}" cf, initTestCase
- Q_DECL_CONSTEXPR QUuid u1{0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
- Q_DECL_CONSTEXPR QUuid u2 = {0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
+ constexpr QUuid u1{0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
+ constexpr QUuid u2 = {0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
Q_UNUSED(u1);
Q_UNUSED(u2);
#else
diff --git a/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp
index 647a3ae379..654752f028 100644
--- a/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp
+++ b/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp
@@ -140,7 +140,7 @@ void tst_QByteArrayMatcher::indexIn()
void tst_QByteArrayMatcher::staticByteArrayMatcher()
{
{
- static Q_RELAXED_CONSTEXPR auto smatcher = qMakeStaticByteArrayMatcher("Hello");
+ static constexpr auto smatcher = qMakeStaticByteArrayMatcher("Hello");
QCOMPARE(smatcher.pattern(), QByteArrayLiteral("Hello"));
QCOMPARE(smatcher.indexIn(QByteArray("Hello, World!")), 0);
@@ -186,7 +186,7 @@ void tst_QByteArrayMatcher::staticByteArrayMatcher()
}
{
- static Q_RELAXED_CONSTEXPR auto smatcher = qMakeStaticByteArrayMatcher(LONG_STRING_256);
+ static constexpr auto smatcher = qMakeStaticByteArrayMatcher(LONG_STRING_256);
QCOMPARE(smatcher.pattern(), QByteArrayLiteral(LONG_STRING_256));
QCOMPARE(smatcher.indexIn(QByteArray("a" LONG_STRING_256)), 1);
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index 321e9ba32e..b26381c387 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -265,8 +265,8 @@ class CharStarContainer
{
const char *str;
public:
- explicit Q_DECL_CONSTEXPR CharStarContainer(const char *s = nullptr) : str(s) {}
- Q_DECL_CONSTEXPR operator const char *() const { return str; }
+ explicit constexpr CharStarContainer(const char *s = nullptr) : str(s) {}
+ constexpr operator const char *() const { return str; }
};
} // unnamed namespace
diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
index 3e1f10cc11..2716ee2c8d 100644
--- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
+++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
@@ -82,7 +82,7 @@ MAKE_ALL(const char*, QChar)
#undef MAKE_RELOP
// END FIXME
-static Q_DECL_CONSTEXPR int sign(int i) noexcept
+static constexpr int sign(int i) noexcept
{
return i < 0 ? -1 :
i > 0 ? +1 :
diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
index 55e23570d7..a7f39412a8 100644
--- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
+++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
@@ -126,7 +126,7 @@ static_assert(!CanConvert<std::list<char16_t>>::value);
// wchar_t
//
-Q_CONSTEXPR bool CanConvertFromWCharT =
+constexpr bool CanConvertFromWCharT =
#ifdef Q_OS_WIN
true
#else
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
index cc2e2e0984..c1b562e7f4 100644
--- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
+++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
@@ -1711,7 +1711,7 @@ void tst_QFuture::nestedExceptions()
void tst_QFuture::nonGlobalThreadPool()
{
- static Q_CONSTEXPR int Answer = 42;
+ static constexpr int Answer = 42;
struct UselessTask : QRunnable, QFutureInterface<int>
{
diff --git a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
index 6603e5d7ce..b07f8196c5 100644
--- a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
+++ b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
@@ -90,7 +90,7 @@ enum {
};
#if __has_include(<chrono>)
-static Q_CONSTEXPR std::chrono::milliseconds waitTimeAsDuration(waitTime);
+static constexpr std::chrono::milliseconds waitTimeAsDuration(waitTime);
#endif
void tst_QMutex::convertToMilliseconds_data()
@@ -164,9 +164,9 @@ void tst_QMutex::convertToMilliseconds()
QFETCH(qint64, intValue);
QFETCH(qint64, expected);
- Q_CONSTEXPR qint64 maxShort = std::numeric_limits<short>::max();
- Q_CONSTEXPR qint64 maxInt = std::numeric_limits<int>::max();
- Q_CONSTEXPR qint64 maxUInt = std::numeric_limits<uint>::max();
+ constexpr qint64 maxShort = std::numeric_limits<short>::max();
+ constexpr qint64 maxInt = std::numeric_limits<int>::max();
+ constexpr qint64 maxUInt = std::numeric_limits<uint>::max();
switch (unit) {
#define CASE(Unit, Period) \
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index 964c68c9e9..44e6bef6f0 100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
@@ -1046,25 +1046,25 @@ void tst_QAlgorithms::binaryFindOnLargeContainer() const
#endif // QT_DEPRECATED_SINCE(5, 2)
// alternative implementation of qPopulationCount for comparison:
-static Q_DECL_CONSTEXPR const uint bitsSetInNibble[] = {
+static constexpr const uint bitsSetInNibble[] = {
0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4,
};
static_assert(sizeof bitsSetInNibble / sizeof *bitsSetInNibble == 16);
-static Q_DECL_CONSTEXPR uint bitsSetInByte(quint8 byte)
+static constexpr uint bitsSetInByte(quint8 byte)
{
return bitsSetInNibble[byte & 0xF] + bitsSetInNibble[byte >> 4];
}
-static Q_DECL_CONSTEXPR uint bitsSetInShort(quint16 word)
+static constexpr uint bitsSetInShort(quint16 word)
{
return bitsSetInByte(word & 0xFF) + bitsSetInByte(word >> 8);
}
-static Q_DECL_CONSTEXPR uint bitsSetInInt(quint32 word)
+static constexpr uint bitsSetInInt(quint32 word)
{
return bitsSetInShort(word & 0xFFFF) + bitsSetInShort(word >> 16);
}
-static Q_DECL_CONSTEXPR uint bitsSetInInt64(quint64 word)
+static constexpr uint bitsSetInInt64(quint64 word)
{
return bitsSetInInt(word & 0xFFFFFFFF) + bitsSetInInt(word >> 32);
}
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
index 8b78b34992..52464ffc15 100644
--- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
@@ -1149,7 +1149,7 @@ void tst_QArrayData::literals()
struct LiteralType {
int value;
- Q_DECL_CONSTEXPR LiteralType(int v = 0) : value(v) {}
+ constexpr LiteralType(int v = 0) : value(v) {}
};
{
@@ -1226,17 +1226,17 @@ struct CompilerHasCxx11ImplicitMoves
struct DetectConstructor
{
- Q_DECL_CONSTEXPR DetectConstructor()
+ constexpr DetectConstructor()
: constructor(DefaultConstructor)
{
}
- Q_DECL_CONSTEXPR DetectConstructor(const DetectConstructor &)
+ constexpr DetectConstructor(const DetectConstructor &)
: constructor(CopyConstructor)
{
}
- Q_DECL_CONSTEXPR DetectConstructor(DetectConstructor &&)
+ constexpr DetectConstructor(DetectConstructor &&)
: constructor(MoveConstructor)
{
}
diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
index c5ba53ad57..f0af24a96b 100644
--- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp
+++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
@@ -3094,7 +3094,7 @@ void tst_QList::fromReadOnlyData() const
{
struct LiteralType {
int value;
- Q_DECL_CONSTEXPR LiteralType(int v = 0) : value(v) {}
+ constexpr LiteralType(int v = 0) : value(v) {}
};
const LiteralType literal[] = {LiteralType(0), LiteralType(1), LiteralType(2)};
diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
index 464477d5d1..70caa055b6 100644
--- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp
+++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
@@ -174,15 +174,15 @@ void tst_QPair::structuredBindings()
void tst_QPair::testConstexpr()
{
- Q_CONSTEXPR QPair<int, double> pID = qMakePair(0, 0.0);
+ constexpr QPair<int, double> pID = qMakePair(0, 0.0);
Q_UNUSED(pID);
- Q_CONSTEXPR QPair<double, double> pDD = qMakePair(0.0, 0.0);
- Q_CONSTEXPR QPair<double, double> pDD2 = qMakePair(0, 0.0); // involes (rvalue) conversion ctor
- Q_CONSTEXPR bool equal = pDD2 == pDD;
+ constexpr QPair<double, double> pDD = qMakePair(0.0, 0.0);
+ constexpr QPair<double, double> pDD2 = qMakePair(0, 0.0); // involes (rvalue) conversion ctor
+ constexpr bool equal = pDD2 == pDD;
QVERIFY(equal);
- Q_CONSTEXPR QPair<QSize, int> pSI = qMakePair(QSize(4, 5), 6);
+ constexpr QPair<QSize, int> pSI = qMakePair(QSize(4, 5), 6);
Q_UNUSED(pSI);
}
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 8e92ed44f4..95c2c2bb70 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -2943,8 +2943,8 @@ struct Overloaded
{
return {};
}
- static const Q_CONSTEXPR uint base1Called = sizeof(std::array<int, 1>);
- static const Q_CONSTEXPR uint base2Called = sizeof(std::array<int, 2>);
+ static const constexpr uint base1Called = sizeof(std::array<int, 1>);
+ static const constexpr uint base2Called = sizeof(std::array<int, 2>);
void test()
{
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index ea11768a4b..e4708f358b 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -413,7 +413,7 @@ void tst_QImageWriter::supportsOption()
QFETCH(QString, fileName);
QFETCH(QIntList, options);
- static Q_CONSTEXPR QImageIOHandler::ImageOption allOptions[] = {
+ static constexpr QImageIOHandler::ImageOption allOptions[] = {
QImageIOHandler::Size,
QImageIOHandler::ClipRect,
QImageIOHandler::Description,
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index af687f8cf1..f96ed563d3 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -902,7 +902,7 @@ void tst_QPainterPath::testArcMoveTo_data()
QTest::addColumn<QRectF>("rect");
QTest::addColumn<qreal>("angle");
- static Q_CONSTEXPR QRectF rects[] = {
+ static constexpr QRectF rects[] = {
QRectF(100, 100, 100, 100),
QRectF(100, 100, -100, 100),
QRectF(100, 100, 100, -100),
diff --git a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp
index da3270d527..d23ccedc6f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -116,7 +116,7 @@ void tst_QGraphicsTransform::scale()
// fuzzyCompareNonZero is a very slightly looser version of qFuzzyCompare
// for use with values that are not very close to zero
-Q_DECL_CONSTEXPR static inline bool fuzzyCompareNonZero(float p1, float p2)
+constexpr static inline bool fuzzyCompareNonZero(float p1, float p2)
{
return (qAbs(p1 - p2) <= 0.00003f * qMin(qAbs(p1), qAbs(p2)));
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
index ed16878ecb..42e9e6e2a3 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
@@ -34,7 +34,7 @@
// value to add/remove has to be obtained in test run using the actual style.
struct ExpectedValueDescription {
- Q_DECL_CONSTEXPR ExpectedValueDescription(int v = 0, int sbeta = 0, int sta = 0)
+ constexpr ExpectedValueDescription(int v = 0, int sbeta = 0, int sta = 0)
: value(v)
, scrollBarExtentsToAdd(sbeta)
, spacingsToAdd(sta)
@@ -55,7 +55,7 @@ struct ExpectedValueDescription {
// Describes how often the scroll bar width/height has to be added to/removed
// from the according side of the sceneRect.
struct ScrollBarCount {
- Q_DECL_CONSTEXPR ScrollBarCount(int l = 0, int t = 0, int r = 0, int b = 0 )
+ constexpr ScrollBarCount(int l = 0, int t = 0, int r = 0, int b = 0 )
: left(l)
, top(t)
, right(r)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp
index 297e83421b..5c9134a3b0 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp
@@ -49,7 +49,7 @@ static void _scrollBarRanges_addTestData(const QByteArray &style, bool styled)
const int viewWidth = 250;
const int viewHeight = 100;
- static Q_CONSTEXPR struct Data {
+ static constexpr struct Data {
const char *name;
QRectF sceneRect;
ScrollBarCount sceneRectOffsetFactors;
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index fd4ce89b56..fd1751c5e7 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -52,7 +52,7 @@ using namespace QTestPrivate;
// ItemRole has enumerators for numerical values 0..2, thus the only
// valid numerical values for storing into an ItemRole variable are 0..3:
-Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3);
+constexpr QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3);
struct QFormLayoutTakeRowResultHolder {
QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) noexcept
diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
index 89bb946be9..d307d9f9a8 100644
--- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
+++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
@@ -111,20 +111,20 @@ void tst_QSizePolicy::constExpr()
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54922 */
#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) || defined(Q_CC_CLANG) || Q_CC_GNU >= 408
// check that certain ctors are constexpr (compile-only):
- { Q_CONSTEXPR QSizePolicy sp; Q_UNUSED(sp); }
- { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(); Q_UNUSED(sp); }
- { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); Q_UNUSED(sp); }
- { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType);
- Q_CONSTEXPR QSizePolicy tp = sp.transposed(); Q_UNUSED(tp); }
+ { constexpr QSizePolicy sp; Q_UNUSED(sp); }
+ { constexpr QSizePolicy sp = QSizePolicy(); Q_UNUSED(sp); }
+ { constexpr QSizePolicy sp = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); Q_UNUSED(sp); }
+ { constexpr QSizePolicy sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType);
+ constexpr QSizePolicy tp = sp.transposed(); Q_UNUSED(tp); }
{
// QTBUG-69983: For ControlType != QSizePolicy::DefaultType, qCountTrailingZeroBits()
// is used, which MSVC 15.8.1 does not consider constexpr due to built-ins
# if defined(QT_HAS_CONSTEXPR_BUILTINS) && (!defined(Q_CC_MSVC) || _MSC_VER < 1915)
- Q_RELAXED_CONSTEXPR auto sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, QSizePolicy::CheckBox);
+ constexpr auto sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, QSizePolicy::CheckBox);
# else
- Q_CONSTEXPR auto sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType);
+ constexpr auto sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType);
# endif
- Q_RELAXED_CONSTEXPR auto tp = sp.transposed(); Q_UNUSED(tp);
+ constexpr auto tp = sp.transposed(); Q_UNUSED(tp);
}
#else
QSKIP("QSizePolicy cannot be constexpr with this version of the compiler.");
diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
index 9ad5f771bd..ce718b69ea 100644
--- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h
+++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
@@ -204,12 +204,12 @@ private:
class AlignmentDummy { QVectorData header; T array[1]; };
- static Q_DECL_CONSTEXPR int offsetOfTypedData()
+ static constexpr int offsetOfTypedData()
{
// (non-POD)-safe offsetof(AlignmentDummy, array)
return (sizeof(QVectorData) + (alignOfTypedData() - 1)) & ~(alignOfTypedData() - 1);
}
- static Q_DECL_CONSTEXPR int alignOfTypedData()
+ static constexpr int alignOfTypedData()
{
return alignof(AlignmentDummy);
}
diff --git a/util/gradientgen/gradientgen.cpp b/util/gradientgen/gradientgen.cpp
index 44ef501b3d..d0ce0536d9 100644
--- a/util/gradientgen/gradientgen.cpp
+++ b/util/gradientgen/gradientgen.cpp
@@ -278,7 +278,7 @@ int main()
p.printLine("}");
p.printLine();
- p.printLine("static Q_CONSTEXPR QGradient::QGradientData qt_preset_gradient_data[] = {");
+ p.printLine("static constexpr QGradient::QGradientData qt_preset_gradient_data[] = {");
{
Printer::Indenter i(p);
printGradientData(p, presets);