8#include <QtCore/qglobal.h>
9#include <QtCore/qshareddata.h>
10#include <QtCore/qstring.h>
11#include <QtCore/qttypetraits.h>
12#include <QtCore/qbindingstorage.h>
16#include <QtCore/qpropertyprivate.h>
18#if __has_include(<source_location>) && __cplusplus
>= 202002L
&& !defined(Q_QDOC)
19#include <source_location>
20#if defined(__cpp_lib_source_location)
21#define QT_SOURCE_LOCATION_NAMESPACE std
22#define QT_PROPERTY_COLLECT_BINDING_LOCATION
25
26# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation::fromStdSourceLocation(std::source_location::current())
29
30
31# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation(std::source_location::current())
36#if __has_include(<experimental/source_location>) && !defined(Q_QDOC)
37#include <experimental/source_location>
38#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION)
39#if defined(__cpp_lib_experimental_source_location
)
40#define QT_SOURCE_LOCATION_NAMESPACE std::experimental
41#define QT_PROPERTY_COLLECT_BINDING_LOCATION
42#define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation(std::experimental::source_location::current())
47#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION
)
48#define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation()
75 class DisableRValueRefs {};
98 const char *fileName =
nullptr;
99 const char *functionName =
nullptr;
102 QPropertyBindingSourceLocation() =
default;
103#ifdef __cpp_lib_source_location
104 constexpr QPropertyBindingSourceLocation(
const std::source_location &cppLocation)
106 fileName = cppLocation.file_name();
107 functionName = cppLocation.function_name();
108 line = cppLocation.line();
109 column = cppLocation.column();
111 QT_POST_CXX17_API_IN_EXPORTED_CLASS
112 static consteval QPropertyBindingSourceLocation
113 fromStdSourceLocation(
const std::source_location &cppLocation)
118#ifdef __cpp_lib_experimental_source_location
119 constexpr QPropertyBindingSourceLocation(
const std::experimental::source_location &cppLocation)
121 fileName = cppLocation.file_name();
122 functionName = cppLocation.function_name();
123 line = cppLocation.line();
124 column = cppLocation.column();
142 QPropertyBindingError();
143 QPropertyBindingError(Type type,
const QString &description = QString());
145 QPropertyBindingError(
const QPropertyBindingError &other);
146 QPropertyBindingError &operator=(
const QPropertyBindingError &other);
147 QPropertyBindingError(QPropertyBindingError &&other);
148 QPropertyBindingError &operator=(QPropertyBindingError &&other);
149 ~QPropertyBindingError();
151 bool hasError()
const {
return d.get() !=
nullptr; }
153 QString description()
const;
156 QSharedDataPointer<QPropertyBindingErrorPrivate> d;
163 using BindingFunctionVTable = QtPrivate::BindingFunctionVTable;
165 QUntypedPropertyBinding();
166 QUntypedPropertyBinding(QMetaType metaType,
const BindingFunctionVTable *vtable,
void *function,
const QPropertyBindingSourceLocation &location);
168 template<
typename Functor>
169 QUntypedPropertyBinding(QMetaType metaType, Functor &&f,
const QPropertyBindingSourceLocation &location)
170 : QUntypedPropertyBinding(metaType, &QtPrivate::bindingFunctionVTable<std::remove_reference_t<Functor>>, &f, location)
173 QUntypedPropertyBinding(QUntypedPropertyBinding &&other);
174 QUntypedPropertyBinding(
const QUntypedPropertyBinding &other);
175 QUntypedPropertyBinding &operator=(
const QUntypedPropertyBinding &other);
176 QUntypedPropertyBinding &operator=(QUntypedPropertyBinding &&other);
177 ~QUntypedPropertyBinding();
181 QPropertyBindingError error()
const;
183 QMetaType valueMetaType()
const;
185#if QT_CORE_REMOVED_SINCE(6
, 12
)
186 explicit QUntypedPropertyBinding(QPropertyBindingPrivate *priv);
190 template<
typename Class,
typename T,
auto Offset,
auto Signal>
friend class QObjectBindableProperty;
191 template<
typename T>
friend class QBindable;
192 template<
typename T>
friend class QProperty;
193 explicit QUntypedPropertyBinding(
void *priv);
195 friend class QtPrivate::QPropertyBindingData;
196 friend class QPropertyBindingPrivate;
197 template <
typename>
friend class QPropertyBinding;
198 QPropertyBindingPrivatePtr d;
201template <
typename PropertyType>
208 template<
typename Functor>
221 template <
typename Functor>
223 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
225 return QPropertyBinding<std::invoke_result_t<Functor>>(std::forward<Functor>(f), location);
229struct QPropertyObserverPrivate;
231class QPropertyObserver;
241#if QT_DEPRECATED_SINCE(6
, 6
)
251 friend class QPropertyObserver;
254 friend class QPropertyBindingPrivate;
256 QTaggedPointer<QPropertyObserver, ObserverTag> next;
259 QtPrivate::QTagPreservingPointerToPointer<QPropertyObserver, ObserverTag> prev;
271 constexpr QPropertyObserver() =
default;
272 QPropertyObserver(QPropertyObserver &&other)
noexcept;
273 QPropertyObserver &operator=(QPropertyObserver &&other)
noexcept;
274 ~QPropertyObserver();
276 template <
typename Property, QtPrivate::IsUntypedPropertyData<Property> =
true>
277 void setSource(
const Property &property)
278 { setSource(property.bindingData()); }
279 void setSource(
const QtPrivate::QPropertyBindingData &property);
282 QPropertyObserver(ChangeHandler changeHandler);
283#if QT_DEPRECATED_SINCE(6
, 6
)
284 QT_DEPRECATED_VERSION_X_6_6(
"This constructor was only meant for internal use. Use QProperty and add a binding to the target.")
285 QPropertyObserver(QUntypedPropertyData *aliasedPropertyPtr);
288 QUntypedPropertyData *aliasedProperty()
const
295 QPropertyObserver(
const QPropertyObserver &) =
delete;
296 QPropertyObserver &operator=(
const QPropertyObserver &) =
delete;
300template <
typename Functor>
330 std::function<
void()> m_handler;
362 QtPrivate::QPropertyBindingData d;
363 bool is_equal(
const T &v)
365 if constexpr (QTypeTraits::has_operator_equal_v<T>) {
372 template <
typename U,
typename =
void>
373 struct has_operator_equal_to : std::false_type{};
375 template <
typename U>
379 template <
typename U>
380 static constexpr bool has_operator_equal_to_v =
396 template <
typename Functor>
398 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
407 QT_DECLARE_EQUALITY_OPERATORS_HELPER(
QProperty,
QProperty, ,
noexcept(
false),
template <
typename Ty = T, std::enable_if_t<QTypeTraits::has_operator_equal_v<Ty>>* =
nullptr>)
418#if !defined(Q_CC_GNU) || defined(Q_CC_CLANG)
419#define QPROPERTY_DECL_DELETED_EQ_OP
420 Q_DECL_EQ_DELETE_X("Call .value() on one of the properties explicitly.")
423 template <
typename U, std::enable_if_t<!std::is_same_v<T, U>>* =
nullptr>
425#undef QPROPERTY_DECL_DELETED_EQ_OP
430 d.registerWithCurrentlyEvaluatingBinding();
436 if constexpr (QTypeTraits::is_dereferenceable_v<T>) {
438 }
else if constexpr (
std::is_pointer_v<T>) {
459 if (is_equal(newValue))
461 this->val =
std::move(newValue);
468 if (is_equal(newValue))
470 this->val = newValue;
476 setValue(
std::move(newValue));
488 return QPropertyBinding<T>(d.setBinding(newBinding,
this));
493 if (!newBinding.isNull() && newBinding.valueMetaType().id() != qMetaTypeId<T>())
500 template <
typename Functor>
503 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
521 return QPropertyBinding<T>(d.setBinding(QUntypedPropertyBinding(),
this));
524 template<
typename Functor>
527 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
531 template<
typename Functor>
534 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
536 return onValueChanged(
std::move(f));
539 template<
typename Functor>
542 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
575 template <
typename PropertyType>
577 const QPropertyBindingSourceLocation &location =
580 return Qt::makePropertyBinding([&otherProperty]() -> PropertyType {
return otherProperty; }, location);
590 using Getter =
void (*)(
const QUntypedPropertyData *d,
void *value);
591 using Setter =
void (*)(QUntypedPropertyData *d,
const void *value);
595 using SetObserver =
void (*)(
const QUntypedPropertyData *d, QPropertyObserver *observer);
608template<
typename Property,
typename =
void>
611 using T =
typename Property::value_type;
684Q_CORE_EXPORT
void getter(
const QUntypedPropertyData *d,
void *value);
685Q_CORE_EXPORT
void setter(QUntypedPropertyData *d,
const void *value);
687Q_CORE_EXPORT
bool bindingWrapper(QMetaType type, QUntypedPropertyData *d,
688 QtPrivate::QPropertyBindingFunction binding,
689 QUntypedPropertyData *temp,
void *value);
693Q_CORE_EXPORT
void setObserver(
const QUntypedPropertyData *d, QPropertyObserver *observer);
697 QtPrivate::QPropertyBindingFunction binding)
701 void *data() {
return &
this->val; }
703 return bindingWrapper(type, d, binding, &temp, temp.data());
709 return setBinding(d, binding, &bindingWrapper<T>);
714 const QPropertyBindingSourceLocation &location)
716 return Qt::makePropertyBinding(
727#ifdef QT_NO_DATA_RELOCATION
765 template<
typename Property>
769 { Q_ASSERT(data && iface); }
771 bool isValid()
const {
return data !=
nullptr; }
777 return iface ?
iface->makeBinding(data, location) : QUntypedPropertyBinding();
783 return QUntypedPropertyBinding {};
788 if (!(
iface->getBinding &&
iface->setBinding))
789 return QUntypedPropertyBinding {};
792 iface->setBinding(data, QUntypedPropertyBinding{});
797 void observe(QPropertyObserver *observer)
const
808 template<
typename Functor>
816 template<
typename Functor>
820 return onValueChanged(
std::move(f));
823 template<
typename Functor>
838 return QUntypedPropertyBinding();
840 return iface->getBinding(data);
852 if (!binding.isNull() && binding.valueMetaType() != metaType()) {
858 iface->setBinding(data, binding);
863 return !binding().isNull();
868 if (!(iface && data))
871 return iface->metaType();
877 iface->getter(data,
reinterpret_cast<
void *>(quintptr(&result) | QtPrivate::QBindableInterface::MetaTypeAccessorFlag));
895 if (iface && metaType() != QMetaType::fromType<T>()) {
901 explicit QBindable(QObject *obj,
const QMetaProperty &property)
909 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::makeBinding(location));
913 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::binding());
918 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::takeBinding());
924 Q_ASSERT(!iface || binding.isNull() || binding.valueMetaType() == metaType());
937 template <
typename Functor>
940 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
945 template <
typename Functor>
946 QPropertyBinding<T> setBinding(Functor f);
966#if QT_DEPRECATED_SINCE(6
, 6
)
968class QT_DEPRECATED_VERSION_X_6_6(
"Class was only meant for internal use, use a QProperty and add a binding to the target")
969QPropertyAlias :
public QPropertyObserver
971 Q_DISABLE_COPY_MOVE(QPropertyAlias)
972 const QtPrivate::QBindableInterface *iface =
nullptr;
975 QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
976 QPropertyAlias(QProperty<T> *property)
977 : QPropertyObserver(property),
978 iface(&QtPrivate::QBindableInterfaceForProperty<QProperty<T>>::iface)
981 iface->setObserver(aliasedProperty(),
this);
984 template <
typename Property, QtPrivate::IsUntypedPropertyData<Property> =
true>
985 QPropertyAlias(Property *property)
986 : QPropertyObserver(property),
987 iface(&QtPrivate::QBindableInterfaceForProperty<Property>::iface)
990 iface->setObserver(aliasedProperty(),
this);
993 QPropertyAlias(QPropertyAlias<T> *alias)
994 : QPropertyObserver(alias->aliasedProperty()),
998 iface->setObserver(aliasedProperty(),
this);
1001 QPropertyAlias(
const QBindable<T> &property)
1002 : QPropertyObserver(property.data),
1003 iface(property.iface)
1006 iface->setObserver(aliasedProperty(),
this);
1012 if (
auto *p = aliasedProperty())
1013 iface->getter(p, &t);
1017 operator T()
const {
return value(); }
1019 void setValue(
const T &newValue)
1021 if (
auto *p = aliasedProperty())
1022 iface->setter(p, &newValue);
1025 QPropertyAlias<T> &operator=(
const T &newValue)
1031 QPropertyBinding<T> setBinding(
const QPropertyBinding<T> &newBinding)
1033 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
1036 bool setBinding(
const QUntypedPropertyBinding &newBinding)
1038 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
1042 template <
typename Functor>
1043 QPropertyBinding<T> setBinding(Functor &&f,
1044 const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION,
1045 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
1047 return setBinding(Qt::makePropertyBinding(std::forward<Functor>(f), location));
1050 template <
typename Functor>
1051 QPropertyBinding<T> setBinding(Functor f);
1054 bool hasBinding()
const
1056 return QBindable<T>(aliasedProperty(), iface).hasBinding();
1059 QPropertyBinding<T> binding()
const
1061 return QBindable<T>(aliasedProperty(), iface).binding();
1064 QPropertyBinding<T> takeBinding()
1066 return QBindable<T>(aliasedProperty(), iface).takeBinding();
1069 template<
typename Functor>
1070 QPropertyChangeHandler<Functor> onValueChanged(Functor f)
1072 return QBindable<T>(aliasedProperty(), iface).onValueChanged(std::move(f));
1075 template<
typename Functor>
1076 QPropertyChangeHandler<Functor> subscribe(Functor f)
1078 return QBindable<T>(aliasedProperty(), iface).subscribe(std::move(f));
1081 template<
typename Functor>
1082 QPropertyNotifier addNotifier(Functor f)
1084 return QBindable<T>(aliasedProperty(), iface).addNotifier(std::move(f));
1087 bool isValid()
const
1089 return aliasedProperty() !=
nullptr;
1095template<
typename Class,
typename T,
auto Offset,
auto Signal =
nullptr>
1099 static bool constexpr HasSignal = !
std::is_same_v<
decltype(Signal),
std::nullptr_t>;
1100 using SignalTakesValue =
std::is_invocable<
decltype(Signal), Class, T>;
1103 char *that =
reinterpret_cast<
char *>(
this);
1104 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1106 const Class *owner()
const
1108 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1109 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1111 static void signalCallBack(QUntypedPropertyData *o)
1114 if constexpr (HasSignal) {
1115 if constexpr (SignalTakesValue::value)
1116 (that->owner()->*Signal)(that->valueBypassingBindings());
1118 (that->owner()->*Signal)();
1132 { setBinding(binding); }
1134 template <
typename Functor>
1136 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
1313#define QT_OBJECT_BINDABLE_PROPERTY_3(Class, Type, name)
1314 static constexpr size_t _qt_property_##name##_offset() {
1315 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1316 return offsetof(Class, name);
1319 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name;
1321#define QT_OBJECT_BINDABLE_PROPERTY_4(Class, Type, name, Signal)
1322 static constexpr size_t _qt_property_##name##_offset() {
1323 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1324 return offsetof(Class, name);
1327 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name;
1329#define Q_OBJECT_BINDABLE_PROPERTY(...)
1330 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1331 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY, __VA_ARGS__)
1334#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_4(Class, Type, name, value)
1335 static constexpr size_t _qt_property_##name##_offset()
1337 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1338 return offsetof(Class, name);
1341 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name =
1342 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr>(
1345#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_5(Class, Type, name, value, Signal)
1346 static constexpr size_t _qt_property_##name##_offset()
1348 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1349 return offsetof(Class, name);
1352 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name =
1353 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal>(
1356#define Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(...)
1357 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1358 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS, __VA_ARGS__)
1361template<
typename Class,
typename T,
auto Offset,
auto Getter>
1366 char *that =
reinterpret_cast<
char *>(
this);
1367 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1369 const Class *owner()
const
1371 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1372 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1383 qGetBindingStorage(owner())->registerDependency(
this);
1384 return (owner()->*Getter)();
1445#define Q_OBJECT_COMPUTED_PROPERTY(Class, Type, name, ...)
1446 static constexpr size_t _qt_property_##name##_offset() {
1447 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1448 return offsetof(Class, name);
1451 QObjectComputedProperty<Class, Type, Class::_qt_property_##name##_offset, __VA_ARGS__> name;
1453#undef QT_SOURCE_LOCATION_NAMESPACE
QPropertyBinding< T > makeBinding(const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION) const
Constructs a binding evaluating to the underlying property's value, using a specified source location...
QPropertyBinding< T > binding() const
Returns the currently set binding of the underlying property.
T value() const
Returns the underlying property's current value.
void setValue(const T &value)
Sets the underlying property's value to value.
friend class QPropertyAlias
QBindable(QObject *obj, const QMetaProperty &property)
QPropertyBinding< T > setBinding(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, std::enable_if_t< std::is_invocable_v< Functor > > *=nullptr)
QBindable(const QUntypedBindable &b)
QPropertyBinding< T > setBinding(const QPropertyBinding< T > &binding)
Sets the underlying property's binding to binding.
QBindable(QObject *obj, const char *property)
QPropertyBinding< T > takeBinding()
Removes the currently set binding of the underlying property and returns it.
QObjectBindableProperty(const T &initialValue)
Constructs a property with the provided initialValue.
QObjectBindableProperty()=default
typename QPropertyData< T >::rvalue_ref rvalue_ref
typename QPropertyData< T >::value_type value_type
QObjectBindableProperty(T &&initialValue)
Move-Constructs a property with the provided initialValue.
typename QPropertyData< T >::arrow_operator_result arrow_operator_result
QObjectBindableProperty(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, typename std::enable_if_t< std::is_invocable_r_v< T, Functor & > > *=nullptr)
QObjectBindableProperty(const QPropertyBinding< T > &binding)
typename QPropertyData< T >::parameter_type parameter_type
\macro Q_OBJECT_BINDABLE_PROPERTY(containingClass, type, name, signal)
QPropertyBinding< T > binding() const
operator parameter_type() const
typename QPropertyData< T >::value_type value_type
QtPrivate::QPropertyBindingData & bindingData() const
QObjectCompatProperty & operator=(parameter_type newValue)
typename QPropertyData< T >::arrow_operator_result arrow_operator_result
typename QPropertyData< T >::parameter_type parameter_type
parameter_type value() const
QPropertyChangeHandler< Functor > onValueChanged(Functor f)
void setValue(parameter_type t)
void removeBindingUnlessInWrapper()
bool setBinding(const QUntypedPropertyBinding &newBinding)
QPropertyBinding< T > setBinding(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, std::enable_if_t< std::is_invocable_v< Functor > > *=nullptr)
arrow_operator_result operator->() const
QObjectCompatProperty(T &&initialValue)
QPropertyNotifier addNotifier(Functor f)
parameter_type operator*() const
QObjectCompatProperty(const T &initialValue)
QPropertyBinding< T > takeBinding()
QPropertyChangeHandler< Functor > subscribe(Functor f)
QPropertyBinding< T > setBinding(const QPropertyBinding< T > &newBinding)
\macro Q_OBJECT_COMPAT_PROPERTY(containingClass, type, name, callback)
QObjectComputedProperty()=default
parameter_type value() const
QPropertyBinding(const QUntypedPropertyBinding &binding)
QPropertyBinding()=default
QPropertyBinding(Functor &&f, const QPropertyBindingSourceLocation &location)
static constexpr bool UseReferences
void setValueBypassingBindings(parameter_type v)
Sets the data value stored in this property to v.
QPropertyData(parameter_type t)
parameter_type valueBypassingBindings() const
Returns the data stored in this property.
@ ObserverNotifiesBinding
@ ObserverNotifiesChangeHandler
QUntypedPropertyData * aliasData
void(*)(QPropertyObserver *, QUntypedPropertyData *) ChangeHandler
ChangeHandler changeHandler
QPropertyBindingPrivate * binding
typename QPropertyData< T >::arrow_operator_result arrow_operator_result
QProperty(rvalue_ref initialValue)
void setValue(rvalue_ref newValue)
typename QPropertyData< T >::value_type value_type
QPropertyChangeHandler< Functor > subscribe(Functor f)
QPropertyBinding< T > takeBinding()
Disassociates the binding expression from this property and returns it.
bool setBinding(const QUntypedPropertyBinding &newBinding)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend void operator!=(const QProperty &, const QProperty< U > &) QPROPERTY_DECL_DELETED_EQ_OP
QPropertyNotifier addNotifier(Functor f)
typename QPropertyData< T >::rvalue_ref rvalue_ref
QPropertyChangeHandler< Functor > onValueChanged(Functor f)
Registers the given functor f as a callback that shall be called whenever the value of the property c...
QPropertyBinding< T > setBinding(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, std::enable_if_t< std::is_invocable_v< Functor > > *=nullptr)
void setValue(parameter_type newValue)
Assigns newValue to this property and removes the property's associated binding, if present.
QProperty()=default
Constructs a property with a default constructed instance of T.
QProperty(const QPropertyBinding< T > &binding)
Constructs a property that is tied to the provided binding expression.
parameter_type value() const
Returns the value of the property.
QPropertyBinding< T > setBinding(const QPropertyBinding< T > &newBinding)
Associates the value of this property with the provided newBinding expression and returns the previou...
QProperty(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, typename std::enable_if_t< std::is_invocable_r_v< T, Functor & > > *=nullptr)
const QtPrivate::QPropertyBindingData & bindingData() const
typename QPropertyData< T >::parameter_type parameter_type
QProperty< T > & operator=(rvalue_ref newValue)
arrow_operator_result operator->() const
QProperty< T > & operator=(parameter_type newValue)
Assigns newValue to this property and returns a reference to this QProperty.
QPropertyBinding< T > binding() const
Returns the binding expression that is associated with this property.
parameter_type operator*() const
operator parameter_type() const
~QProperty()=default
Destroys the property.
QProperty(parameter_type initialValue)
RAII class around Qt::beginPropertyUpdateGroup()/QtendPropertyUpdateGroup().
~QTimerPrivate() override
QTimerPrivate(QTimer *qq)
void setIntervalDuration(std::chrono::nanoseconds nsec)
static constexpr int INV_TIMER
void setInterval(int msec)
QTimerPrivate(std::chrono::nanoseconds nsec, QChronoTimer *qq)
QUntypedPropertyBinding binding() const
Returns the underlying property's binding if there is any, or a default constructed QUntypedPropertyB...
QUntypedPropertyBinding makeBinding(const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION) const
Creates a binding returning the underlying properties' value, using a specified source location.
bool hasBinding() const
Returns true if the underlying property has a binding.
constexpr QUntypedBindable()=default
Default-constructs a QUntypedBindable.
QMetaType metaType() const
const QtPrivate::QBindableInterface * iface
QPropertyChangeHandler< Functor > onValueChanged(Functor f) const
Installs f as a change handler.
QUntypedPropertyBinding takeBinding()
Removes the currently set binding from the property and returns it.
QPropertyNotifier addNotifier(Functor f)
Installs f as a change handler.
QUntypedPropertyData * data
bool isValid() const
Returns true if the QUntypedBindable is valid.
bool setBinding(const QUntypedPropertyBinding &binding)
Sets the underlying property's binding to binding.
QUntypedBindable(Property *p)
Constructs a QUntypedBindable from the property property.
QPropertyChangeHandler< Functor > subscribe(Functor f) const
Behaves like a call to f followed by onValueChanged(f),.
constexpr QUntypedBindable(QUntypedPropertyData *d, const QtPrivate::QBindableInterface *i)
void observe(QPropertyObserver *observer) const
static constexpr QBindableInterface iface
QPrivateSlotObject(Func f)
QPropertyBindingData & bindingData()
friend class QT_PREPEND_NAMESPACE(QUntypedBindable)
const QMetaProperty & metaProperty() const
static QPropertyAdaptorSlotObject * cast(QSlotObjectBase *ptr, int propertyIndex)
const QPropertyBindingData & bindingData() const
Combined button and popup list for selecting options.
void printMetaTypeMismatch(QMetaType actual, QMetaType expected)
void printUnsuitableBindableWarning(QAnyStringView prefix, BindableWarnings::Reason reason)
Q_CORE_EXPORT void printSignalArgumentsWithCustomGetter()
void setter(QUntypedPropertyData *d, const void *value)
void getter(const QUntypedPropertyData *d, void *value)
bool bindingWrapper(QMetaType type, QUntypedPropertyData *d, QtPrivate::QPropertyBindingFunction binding, QUntypedPropertyData *temp, void *value)
QUntypedPropertyBinding setBinding(QUntypedPropertyData *d, const QUntypedPropertyBinding &binding)
constexpr QBindableInterface iface
bool bindingWrapper(QMetaType type, QUntypedPropertyData *d, QtPrivate::QPropertyBindingFunction binding)
QUntypedPropertyBinding makeBinding(const QUntypedPropertyData *d, const QPropertyBindingSourceLocation &location)
void setObserver(const QUntypedPropertyData *d, QPropertyObserver *observer)
void assertObjectType(QObjectPrivate *d)
Q_CORE_EXPORT bool isAnyBindingEvaluating()
Q_CORE_EXPORT void restoreBindingStatus(BindingEvaluationState *status)
const QObject * getQObject(const QObjectPrivate *d)
Q_CORE_EXPORT bool isPropertyInBindingWrapper(const QUntypedPropertyData *property)
auto makePropertyBinding(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, std::enable_if_t< std::is_invocable_v< Functor > > *=nullptr)
Q_CORE_EXPORT void beginPropertyUpdateGroup()
QPropertyBinding< PropertyType > makePropertyBinding(const QProperty< PropertyType > &otherProperty, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION)
Q_CORE_EXPORT void endPropertyUpdateGroup()
#define QT_CONCAT(B, M, m, u)
QBindingStorage * qGetBindingStorage(QObjectPrivate *o)
QBindingStorage * qGetBindingStorage(QObjectPrivate::ExtraData *ed)
const QBindingStorage * qGetBindingStorage(const QObjectPrivate *o)
#define QPROPERTY_DECL_DELETED_EQ_OP
#define Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(...)
#define QT_PROPERTY_DEFAULT_BINDING_LOCATION
#define Q_OBJECT_COMPUTED_PROPERTY(Class, Type, name, ...)
#define Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(...)
QBindingObserverPtr()=default
QPropertyObserver * operator->()
QPropertyBindingPrivate * binding() const noexcept
static QPropertyProxyBindingData * proxyData(QtPrivate::QPropertyBindingData *ptr)
static void fixupAfterMove(QtPrivate::QPropertyBindingData *ptr)
Q_ALWAYS_INLINE void addObserver(QPropertyObserver *observer)
const QtPrivate::QPropertyBindingData * ptr
int observerCount() const
static QPropertyBindingDataPointer get(QProperty< T > &property)
QPropertyBindingPrivate * binding() const
void setObservers(QPropertyObserver *observer)
QPropertyObserverPointer firstObserver() const
void setFirstObserver(QPropertyObserver *observer)
~QPropertyObserverNodeProtector()
QPropertyObserver * next() const
void noSelfDependencies(QPropertyBindingPrivate *binding)
void notify(QUntypedPropertyData *propertyDataPtr)
QPropertyBindingPrivate * binding() const
void evaluateBindings(PendingBindingObserverList &bindingObservers, QBindingStatus *status)
void observeProperty(QPropertyBindingDataPointer property)
QPropertyObserverPointer nextObserver() const
void setBindingToNotify_unsafe(QPropertyBindingPrivate *binding)
void setChangeHandler(QPropertyObserver::ChangeHandler changeHandler)
void setBindingToNotify(QPropertyBindingPrivate *binding)
void(* BeginCallback)(QObject *caller, int signal_or_method_index, void **argv)
BeginCallback slot_begin_callback
EndCallback slot_end_callback
EndCallback signal_end_callback
BeginCallback signal_begin_callback
void(* EndCallback)(QObject *caller, int signal_or_method_index)
static QtPrivate::QBindableInterface const * getInterface(const QUntypedBindable &bindable)
static QUntypedPropertyData * getPropertyData(const QUntypedBindable &bindable)
QPropertyBindingPrivate * binding
QVarLengthArray< const QPropertyBindingData *, 8 > alreadyCaptureProperties
BindingEvaluationState(QPropertyBindingPrivate *binding, QBindingStatus *status)
BindingEvaluationState * previousState
~BindingEvaluationState()
BindingEvaluationState ** currentState
QtPrivate::BindingEvaluationState ** currentlyEvaluatingBindingList
CompatPropertySafePoint * previousState
CompatPropertySafePoint ** currentState
~CompatPropertySafePoint()
QUntypedPropertyData * property
QtPrivate::BindingEvaluationState * bindingState
void(*)(const QUntypedPropertyData *d, void *value) Getter
void(*)(const QUntypedPropertyData *d, QPropertyObserver *observer) SetObserver
void(*)(QUntypedPropertyData *d, const void *value) Setter
static constexpr quintptr MetaTypeAccessorFlag