7#include <QtCore/qglobal.h>
8#include <QtCore/qshareddata.h>
9#include <QtCore/qstring.h>
10#include <QtCore/qttypetraits.h>
11#include <QtCore/qbindingstorage.h>
15#include <QtCore/qpropertyprivate.h>
17#if __has_include(<source_location>) && __cplusplus
>= 202002L
&& !defined(Q_QDOC)
18#include <source_location>
19#if defined(__cpp_lib_source_location)
20#define QT_SOURCE_LOCATION_NAMESPACE std
21#define QT_PROPERTY_COLLECT_BINDING_LOCATION
24
25# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation::fromStdSourceLocation(std::source_location::current())
28
29
30# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation(std::source_location::current())
35#if __has_include(<experimental/source_location>) && !defined(Q_QDOC)
36#include <experimental/source_location>
37#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION)
38#if defined(__cpp_lib_experimental_source_location
)
39#define QT_SOURCE_LOCATION_NAMESPACE std::experimental
40#define QT_PROPERTY_COLLECT_BINDING_LOCATION
41#define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation(std::experimental::source_location::current())
46#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION
)
47#define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation()
74 class DisableRValueRefs {};
97 const char *fileName =
nullptr;
98 const char *functionName =
nullptr;
101 QPropertyBindingSourceLocation() =
default;
102#ifdef __cpp_lib_source_location
103 constexpr QPropertyBindingSourceLocation(
const std::source_location &cppLocation)
105 fileName = cppLocation.file_name();
106 functionName = cppLocation.function_name();
107 line = cppLocation.line();
108 column = cppLocation.column();
110 QT_POST_CXX17_API_IN_EXPORTED_CLASS
111 static consteval QPropertyBindingSourceLocation
112 fromStdSourceLocation(
const std::source_location &cppLocation)
117#ifdef __cpp_lib_experimental_source_location
118 constexpr QPropertyBindingSourceLocation(
const std::experimental::source_location &cppLocation)
120 fileName = cppLocation.file_name();
121 functionName = cppLocation.function_name();
122 line = cppLocation.line();
123 column = cppLocation.column();
141 QPropertyBindingError();
142 QPropertyBindingError(Type type,
const QString &description = QString());
144 QPropertyBindingError(
const QPropertyBindingError &other);
145 QPropertyBindingError &operator=(
const QPropertyBindingError &other);
146 QPropertyBindingError(QPropertyBindingError &&other);
147 QPropertyBindingError &operator=(QPropertyBindingError &&other);
148 ~QPropertyBindingError();
150 bool hasError()
const {
return d.get() !=
nullptr; }
152 QString description()
const;
155 QSharedDataPointer<QPropertyBindingErrorPrivate> d;
162 using BindingFunctionVTable = QtPrivate::BindingFunctionVTable;
164 QUntypedPropertyBinding();
165 QUntypedPropertyBinding(QMetaType metaType,
const BindingFunctionVTable *vtable,
void *function,
const QPropertyBindingSourceLocation &location);
167 template<
typename Functor>
168 QUntypedPropertyBinding(QMetaType metaType, Functor &&f,
const QPropertyBindingSourceLocation &location)
169 : QUntypedPropertyBinding(metaType, &QtPrivate::bindingFunctionVTable<std::remove_reference_t<Functor>>, &f, location)
172 QUntypedPropertyBinding(QUntypedPropertyBinding &&other);
173 QUntypedPropertyBinding(
const QUntypedPropertyBinding &other);
174 QUntypedPropertyBinding &operator=(
const QUntypedPropertyBinding &other);
175 QUntypedPropertyBinding &operator=(QUntypedPropertyBinding &&other);
176 ~QUntypedPropertyBinding();
180 QPropertyBindingError error()
const;
182 QMetaType valueMetaType()
const;
184 explicit QUntypedPropertyBinding(QPropertyBindingPrivate *priv);
186 friend class QtPrivate::QPropertyBindingData;
187 friend class QPropertyBindingPrivate;
188 template <
typename>
friend class QPropertyBinding;
189 QPropertyBindingPrivatePtr d;
192template <
typename PropertyType>
199 template<
typename Functor>
212 template <
typename Functor>
214 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
216 return QPropertyBinding<std::invoke_result_t<Functor>>(std::forward<Functor>(f), location);
220struct QPropertyObserverPrivate;
222class QPropertyObserver;
232#if QT_DEPRECATED_SINCE(6
, 6
)
237 using ChangeHandler =
void (*)(QPropertyObserver*, QUntypedPropertyData *);
242 friend class QPropertyObserver;
245 friend class QPropertyBindingPrivate;
247 QTaggedPointer<QPropertyObserver, ObserverTag> next;
250 QtPrivate::QTagPreservingPointerToPointer<QPropertyObserver, ObserverTag> prev;
262 constexpr QPropertyObserver() =
default;
263 QPropertyObserver(QPropertyObserver &&other)
noexcept;
264 QPropertyObserver &operator=(QPropertyObserver &&other)
noexcept;
265 ~QPropertyObserver();
267 template <
typename Property, QtPrivate::IsUntypedPropertyData<Property> =
true>
268 void setSource(
const Property &property)
269 { setSource(property.bindingData()); }
270 void setSource(
const QtPrivate::QPropertyBindingData &property);
273 QPropertyObserver(ChangeHandler changeHandler);
274#if QT_DEPRECATED_SINCE(6
, 6
)
275 QT_DEPRECATED_VERSION_X_6_6(
"This constructor was only meant for internal use. Use QProperty and add a binding to the target.")
276 QPropertyObserver(QUntypedPropertyData *aliasedPropertyPtr);
279 QUntypedPropertyData *aliasedProperty()
const
286 QPropertyObserver(
const QPropertyObserver &) =
delete;
287 QPropertyObserver &operator=(
const QPropertyObserver &) =
delete;
291template <
typename Functor>
321 std::function<
void()> m_handler;
353 QtPrivate::QPropertyBindingData d;
354 bool is_equal(
const T &v)
356 if constexpr (QTypeTraits::has_operator_equal_v<T>) {
367 using arrow_operator_result =
typename QPropertyData<T>::arrow_operator_result;
376 template <
typename Functor>
378 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
389 d.registerWithCurrentlyEvaluatingBinding();
395 if constexpr (QTypeTraits::is_dereferenceable_v<T>) {
397 }
else if constexpr (
std::is_pointer_v<T>) {
418 if (is_equal(newValue))
420 this->val =
std::move(newValue);
427 if (is_equal(newValue))
429 this->val = newValue;
435 setValue(
std::move(newValue));
447 return QPropertyBinding<T>(d.setBinding(newBinding,
this));
452 if (!newBinding.isNull() && newBinding.valueMetaType().id() != qMetaTypeId<T>())
459 template <
typename Functor>
462 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
475 return QPropertyBinding<T>(QUntypedPropertyBinding(d.binding()));
480 return QPropertyBinding<T>(d.setBinding(QUntypedPropertyBinding(),
this));
483 template<
typename Functor>
486 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
490 template<
typename Functor>
493 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
495 return onValueChanged(f);
498 template<
typename Functor>
501 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
509 d.notifyObservers(
this);
516 template <
typename PropertyType>
518 const QPropertyBindingSourceLocation &location =
521 return Qt::makePropertyBinding([&otherProperty]() -> PropertyType {
return otherProperty; }, location);
531 using Getter =
void (*)(
const QUntypedPropertyData *d,
void *value);
532 using Setter =
void (*)(QUntypedPropertyData *d,
const void *value);
536 using SetObserver =
void (*)(
const QUntypedPropertyData *d, QPropertyObserver *observer);
549template<
typename Property,
typename =
void>
552 using T =
typename Property::value_type;
625Q_CORE_EXPORT
void getter(
const QUntypedPropertyData *d,
void *value);
626Q_CORE_EXPORT
void setter(QUntypedPropertyData *d,
const void *value);
628Q_CORE_EXPORT
bool bindingWrapper(QMetaType type, QUntypedPropertyData *d,
629 QtPrivate::QPropertyBindingFunction binding,
630 QUntypedPropertyData *temp,
void *value);
634Q_CORE_EXPORT
void setObserver(
const QUntypedPropertyData *d, QPropertyObserver *observer);
638 QtPrivate::QPropertyBindingFunction binding)
642 void *data() {
return &
this->val; }
644 return bindingWrapper(type, d, binding, &temp, temp.data());
650 return setBinding(d, binding, &bindingWrapper<T>);
655 const QPropertyBindingSourceLocation &location)
657 return Qt::makePropertyBinding(
694 template<
typename Property>
698 { Q_ASSERT(data && iface); }
700 bool isValid()
const {
return data !=
nullptr; }
706 return iface ? iface->makeBinding(data, location) : QUntypedPropertyBinding();
712 return QUntypedPropertyBinding {};
717 if (!(
iface->getBinding &&
iface->setBinding))
718 return QUntypedPropertyBinding {};
720 iface->setBinding(data, QUntypedPropertyBinding{});
724 void observe(QPropertyObserver *observer)
const
727 iface->setObserver(data, observer);
735 template<
typename Functor>
743 template<
typename Functor>
747 return onValueChanged(f);
750 template<
typename Functor>
765 return QUntypedPropertyBinding();
767 return iface->getBinding(data);
779 if (!binding.isNull() && binding.valueMetaType() != metaType()) {
781 QtPrivate::BindableWarnings::printMetaTypeMismatch(metaType(), binding.valueMetaType());
785 iface->setBinding(data, binding);
790 return !binding().isNull();
795 if (!(iface && data))
798 return iface->metaType();
804 iface->getter(data,
reinterpret_cast<
void *>(quintptr(&result) | QtPrivate::QBindableInterface::MetaTypeAccessorFlag));
822 if (iface && metaType() != QMetaType::fromType<T>()) {
828 explicit QBindable(QObject *obj,
const QMetaProperty &property)
836 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::makeBinding(location));
840 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::binding());
845 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::takeBinding());
851 Q_ASSERT(!iface || binding.isNull() || binding.valueMetaType() == metaType());
853 if (iface && iface->setBinding)
854 return static_cast<QPropertyBinding<T> &&>(iface->setBinding(data, binding));
864 template <
typename Functor>
867 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
872 template <
typename Functor>
873 QPropertyBinding<T> setBinding(Functor f);
880 iface->getter(data, &result);
888 if (iface && iface->setter)
889 iface->setter(data, &value);
893#if QT_DEPRECATED_SINCE(6
, 6
)
895class QT_DEPRECATED_VERSION_X_6_6(
"Class was only meant for internal use, use a QProperty and add a binding to the target")
896QPropertyAlias :
public QPropertyObserver
898 Q_DISABLE_COPY_MOVE(QPropertyAlias)
899 const QtPrivate::QBindableInterface *iface =
nullptr;
902 QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
903 QPropertyAlias(QProperty<T> *property)
904 : QPropertyObserver(property),
905 iface(&QtPrivate::QBindableInterfaceForProperty<QProperty<T>>::iface)
908 iface->setObserver(aliasedProperty(),
this);
911 template <
typename Property, QtPrivate::IsUntypedPropertyData<Property> =
true>
912 QPropertyAlias(Property *property)
913 : QPropertyObserver(property),
914 iface(&QtPrivate::QBindableInterfaceForProperty<Property>::iface)
917 iface->setObserver(aliasedProperty(),
this);
920 QPropertyAlias(QPropertyAlias<T> *alias)
921 : QPropertyObserver(alias->aliasedProperty()),
925 iface->setObserver(aliasedProperty(),
this);
928 QPropertyAlias(
const QBindable<T> &property)
929 : QPropertyObserver(property.data),
930 iface(property.iface)
933 iface->setObserver(aliasedProperty(),
this);
939 if (
auto *p = aliasedProperty())
940 iface->getter(p, &t);
944 operator T()
const {
return value(); }
946 void setValue(
const T &newValue)
948 if (
auto *p = aliasedProperty())
949 iface->setter(p, &newValue);
952 QPropertyAlias<T> &operator=(
const T &newValue)
958 QPropertyBinding<T> setBinding(
const QPropertyBinding<T> &newBinding)
960 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
963 bool setBinding(
const QUntypedPropertyBinding &newBinding)
965 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
969 template <
typename Functor>
970 QPropertyBinding<T> setBinding(Functor &&f,
971 const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION,
972 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
974 return setBinding(Qt::makePropertyBinding(std::forward<Functor>(f), location));
977 template <
typename Functor>
978 QPropertyBinding<T> setBinding(Functor f);
981 bool hasBinding()
const
983 return QBindable<T>(aliasedProperty(), iface).hasBinding();
986 QPropertyBinding<T> binding()
const
988 return QBindable<T>(aliasedProperty(), iface).binding();
991 QPropertyBinding<T> takeBinding()
993 return QBindable<T>(aliasedProperty(), iface).takeBinding();
996 template<
typename Functor>
997 QPropertyChangeHandler<Functor> onValueChanged(Functor f)
999 return QBindable<T>(aliasedProperty(), iface).onValueChanged(f);
1002 template<
typename Functor>
1003 QPropertyChangeHandler<Functor> subscribe(Functor f)
1005 return QBindable<T>(aliasedProperty(), iface).subscribe(f);
1008 template<
typename Functor>
1009 QPropertyNotifier addNotifier(Functor f)
1011 return QBindable<T>(aliasedProperty(), iface).addNotifier(f);
1014 bool isValid()
const
1016 return aliasedProperty() !=
nullptr;
1022template<
typename Class,
typename T,
auto Offset,
auto Signal =
nullptr>
1026 static bool constexpr HasSignal = !
std::is_same_v<
decltype(Signal),
std::nullptr_t>;
1027 using SignalTakesValue =
std::is_invocable<
decltype(Signal), Class, T>;
1030 char *that =
reinterpret_cast<
char *>(
this);
1031 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1033 const Class *owner()
const
1035 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1036 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1038 static void signalCallBack(QUntypedPropertyData *o)
1041 if constexpr (HasSignal) {
1042 if constexpr (SignalTakesValue::value)
1043 (that->owner()->*Signal)(that->valueBypassingBindings());
1045 (that->owner()->*Signal)();
1061 template <
typename Functor>
1063 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
1073 qGetBindingStorage(owner())->registerDependency(
this);
1079 if constexpr (QTypeTraits::is_dereferenceable_v<T>) {
1081 }
else if constexpr (
std::is_pointer_v<T>) {
1101 auto *bd = qGetBindingStorage(owner())->bindingData(
this);
1103 bd->removeBinding();
1111 auto *bd = qGetBindingStorage(owner())->bindingData(
this);
1117 auto *bd = qGetBindingStorage(owner())->bindingData(
this);
1119 bd->removeBinding();
1122 this->val =
std::move(t);
1128 setValue(
std::move(newValue));
1140 QtPrivate::QPropertyBindingData *bd = qGetBindingStorage(owner())->bindingData(
this,
true);
1142 return static_cast<QPropertyBinding<T> &>(oldBinding);
1147 if (!newBinding.isNull() && newBinding.valueMetaType().id() != qMetaTypeId<T>())
1154 template <
typename Functor>
1157 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
1168 auto *bd = qGetBindingStorage(owner())->bindingData(
this);
1169 return bd && bd->binding() !=
nullptr;
1174 auto *bd = qGetBindingStorage(owner())->bindingData(
this);
1175 return static_cast<
QPropertyBinding<T> &&>(QUntypedPropertyBinding(bd ? bd->binding() :
nullptr));
1183 template<
typename Functor>
1186 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
1190 template<
typename Functor>
1193 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
1195 return onValueChanged(f);
1198 template<
typename Functor>
1201 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
1207 auto *storage =
const_cast<QBindingStorage *>(qGetBindingStorage(owner()));
1208 return *storage->bindingData(
const_cast<ThisType *>(
this),
true);
1211 void notify(
const QtPrivate::QPropertyBindingData *binding)
1214 binding->notifyObservers(
this, qGetBindingStorage(owner()));
1215 if constexpr (HasSignal) {
1216 if constexpr (SignalTakesValue::value)
1217 (owner()->*Signal)(
this->valueBypassingBindings());
1219 (owner()->*Signal)();
1224#define QT_OBJECT_BINDABLE_PROPERTY_3(Class, Type, name)
1225 static constexpr size_t _qt_property_##name##_offset() {
1226 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1227 return offsetof(Class, name);
1230 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name;
1232#define QT_OBJECT_BINDABLE_PROPERTY_4(Class, Type, name, Signal)
1233 static constexpr size_t _qt_property_##name##_offset() {
1234 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1235 return offsetof(Class, name);
1238 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name;
1240#define Q_OBJECT_BINDABLE_PROPERTY(...)
1241 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1242 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY, __VA_ARGS__)
1245#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_4(Class, Type, name, value)
1246 static constexpr size_t _qt_property_##name##_offset()
1248 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1249 return offsetof(Class, name);
1252 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name =
1253 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr>(
1256#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_5(Class, Type, name, value, Signal)
1257 static constexpr size_t _qt_property_##name##_offset()
1259 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1260 return offsetof(Class, name);
1263 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name =
1264 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal>(
1267#define Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(...)
1268 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1269 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS, __VA_ARGS__)
1272template<
typename Class,
typename T,
auto Offset,
auto Getter>
1277 char *that =
reinterpret_cast<
char *>(
this);
1278 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1280 const Class *owner()
const
1282 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1283 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1287 using value_type = T;
1288 using parameter_type = T;
1294 qGetBindingStorage(owner())->registerDependency(
this);
1295 return (owner()->*Getter)();
1356#define Q_OBJECT_COMPUTED_PROPERTY(Class, Type, name, ...)
1357 static constexpr size_t _qt_property_##name##_offset() {
1358 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1359 return offsetof(Class, name);
1362 QObjectComputedProperty<Class, Type, Class::_qt_property_##name##_offset, __VA_ARGS__> name;
1364#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.
QPropertyNotifier addNotifier(Functor f)
Subscribes the given functor f as a callback that is called whenever the value of the property change...
QObjectBindableProperty(const T &initialValue)
Constructs a property with the provided initialValue.
QObjectBindableProperty()=default
void notify()
Programmatically signals a change of the property.
QPropertyChangeHandler< Functor > onValueChanged(Functor f)
Registers the given functor f as a callback that shall be called whenever the value of the property c...
QObjectBindableProperty(T &&initialValue)
Move-Constructs a property with the provided initialValue.
parameter_type value() const
Returns the value of the property.
bool setBinding(const QUntypedPropertyBinding &newBinding)
This is an overloaded member function, provided for convenience. It differs from the above function o...
operator parameter_type() const
void setValue(rvalue_ref t)
Assigns newValue to this property and removes the property's associated binding, if present.
QPropertyBinding< T > takeBinding()
Disassociates the binding expression from this property and returns it.
arrow_operator_result operator->() const
const QtPrivate::QPropertyBindingData & bindingData() const
parameter_type operator*() const
QObjectBindableProperty(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, typename std::enable_if_t< std::is_invocable_r_v< T, Functor & > > *=nullptr)
void setValue(parameter_type t)
QPropertyBinding< T > setBinding(const QPropertyBinding< T > &newBinding)
Associates the value of this property with the provided newBinding expression and returns the previou...
QObjectBindableProperty(const QPropertyBinding< T > &binding)
QPropertyBinding< T > binding() const
Returns the binding expression that is associated with this property.
bool hasBinding() const
Returns true if the property is associated with a binding; false otherwise.
QObjectBindableProperty & operator=(rvalue_ref newValue)
QPropertyBinding< T > setBinding(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, std::enable_if_t< std::is_invocable_v< Functor > > *=nullptr)
QObjectBindableProperty & operator=(parameter_type newValue)
QPropertyChangeHandler< Functor > subscribe(Functor f)
Subscribes the given functor f as a callback that is called immediately and whenever the value of the...
\macro Q_OBJECT_BINDABLE_PROPERTY(containingClass, type, name, signal)
QPropertyBinding< T > binding() const
operator parameter_type() const
QtPrivate::QPropertyBindingData & bindingData() const
QObjectCompatProperty & operator=(parameter_type newValue)
parameter_type value() const
QObjectCompatProperty()=default
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)
Q_NODISCARD_CTOR QPropertyChangeHandler(Functor handler)
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
ChangeHandler changeHandler
QPropertyBindingPrivate * binding
QProperty(rvalue_ref initialValue)
void setValue(rvalue_ref newValue)
QPropertyChangeHandler< Functor > subscribe(Functor f)
Subscribes the given functor f as a callback that is called immediately and whenever the value of the...
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...
QPropertyNotifier addNotifier(Functor f)
Subscribes the given functor f as a callback that is called whenever the value of the property change...
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
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()/Qt::endPropertyUpdateGroup().
~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)
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()
QBindingStorage * qGetBindingStorage(QObjectPrivate *o)
QBindingStorage * qGetBindingStorage(QObjectPrivate::ExtraData *ed)
const QBindingStorage * qGetBindingStorage(const QObjectPrivate *o)
#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)
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
void(*) EndCallback(QObject *caller, int signal_or_method_index)
BeginCallback signal_begin_callback
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
static constexpr quintptr MetaTypeAccessorFlag