From 216af5d7f9675a408e22167b097f221beeeb88db Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 2 Feb 2024 14:34:54 +0100 Subject: Fix usage of std::enable_if_t to SFINAE out QProperty APIs Declare an IfUntypedPropertyData alias and use that consistently. Amends 311f8896322bcd39d33369c8311a8c89ccdad449. Pick-to: 6.7 Change-Id: If36ef8e2f9ce25e0ffe7b4b448c31ea5866acfc3 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qproperty.h | 11 ++++------- src/corelib/kernel/qpropertyprivate.h | 13 +++++-------- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 54df12fbfe..0373867a66 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -263,8 +263,7 @@ public: QPropertyObserver &operator=(QPropertyObserver &&other) noexcept; ~QPropertyObserver(); - template >> + template = true> void setSource(const Property &property) { setSource(property.bindingData()); } void setSource(const QtPrivate::QPropertyBindingData &property); @@ -303,8 +302,7 @@ public: { } - template >> + template = true> Q_NODISCARD_CTOR QPropertyChangeHandler(const Property &property, Functor handler) : QPropertyObserver([](QPropertyObserver *self, QUntypedPropertyData *) { @@ -335,7 +333,7 @@ public: } template >> + QtPrivate::IsUntypedPropertyData = true> Q_NODISCARD_CTOR QPropertyNotifier(const Property &property, Functor handler) : QPropertyObserver([](QPropertyObserver *self, QUntypedPropertyData *) { @@ -909,8 +907,7 @@ public: iface->setObserver(aliasedProperty(), this); } - template >> + template = true> QPropertyAlias(Property *property) : QPropertyObserver(property), iface(&QtPrivate::QBindableInterfaceForProperty::iface) diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index fa8fe04d5d..28cc04ff9d 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -124,16 +124,13 @@ struct QPropertyObserverPointer; class QUntypedPropertyData { -public: -#if QT_DEPRECATED_SINCE(6, 8) - // sentinel to check whether a class inherits QUntypedPropertyData - struct QT_DEPRECATED_VERSION_X_6_8("Use std::is_base_of instead.") - InheritsQUntypedPropertyData - { - }; -#endif }; +namespace QtPrivate { +template +using IsUntypedPropertyData = std::enable_if_t, bool>; +} + template class QPropertyData; -- cgit v1.2.3