diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2025-08-19 12:01:40 -0700 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2025-08-21 15:55:48 -0700 |
| commit | 5e6991b880e4dc3a8dc4b5904bc6ddc0b65c517a (patch) | |
| tree | aaf2dc4977c47656c2812ccf0b6877c0ceb84688 /src/corelib/kernel/qmetaobject.cpp | |
| parent | 7181d440bcf45ef0d36a5214c0d5f74e988e31a7 (diff) | |
QMetaObject: make QMetaMethod::{Signal,Slot} == Q{SIGNAL,SLOT}_CODE
For Qt 7, because it would be binary-incompatible before then.
Drive-by statically assert that the constants in the two headers match
and clean up old code.
Change-Id: Ia4a794faf748baacebcefffd9b8e70f863bb0e05
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
| -rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index f19970b52d1..3c0ee3851fe 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2493,9 +2493,14 @@ QMetaMethod::Access QMetaMethod::access() const */ QMetaMethod::MethodType QMetaMethod::methodType() const { + constexpr int MethodShift = QtPrivate::qConstexprCountTrailingZeroBits(MethodTypeMask); + static_assert(MethodMethod >> MethodShift == Method); + static_assert(MethodSignal >> MethodShift == Signal); + static_assert(MethodSlot >> MethodShift == Slot); + static_assert(MethodConstructor >> MethodShift == Constructor); if (!mobj) return QMetaMethod::Method; - return (QMetaMethod::MethodType)((data.flags() & MethodTypeMask)>>2); + return MethodType((data.flags() & MethodTypeMask) >> MethodShift); } /*! |
