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 explicit QUntypedPropertyBinding(QPropertyBindingPrivate *priv);
187 friend class QtPrivate::QPropertyBindingData;
188 friend class QPropertyBindingPrivate;
189 template <
typename>
friend class QPropertyBinding;
190 QPropertyBindingPrivatePtr d;
193template <
typename PropertyType>
200 template<
typename Functor>
213 template <
typename Functor>
215 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
217 return QPropertyBinding<std::invoke_result_t<Functor>>(std::forward<Functor>(f), location);
221struct QPropertyObserverPrivate;
223class QPropertyObserver;
233#if QT_DEPRECATED_SINCE(6
, 6
)
243 friend class QPropertyObserver;
246 friend class QPropertyBindingPrivate;
248 QTaggedPointer<QPropertyObserver, ObserverTag> next;
251 QtPrivate::QTagPreservingPointerToPointer<QPropertyObserver, ObserverTag> prev;
263 constexpr QPropertyObserver() =
default;
264 QPropertyObserver(QPropertyObserver &&other)
noexcept;
265 QPropertyObserver &operator=(QPropertyObserver &&other)
noexcept;
266 ~QPropertyObserver();
268 template <
typename Property, QtPrivate::IsUntypedPropertyData<Property> =
true>
269 void setSource(
const Property &property)
270 { setSource(property.bindingData()); }
271 void setSource(
const QtPrivate::QPropertyBindingData &property);
274 QPropertyObserver(ChangeHandler changeHandler);
275#if QT_DEPRECATED_SINCE(6
, 6
)
276 QT_DEPRECATED_VERSION_X_6_6(
"This constructor was only meant for internal use. Use QProperty and add a binding to the target.")
277 QPropertyObserver(QUntypedPropertyData *aliasedPropertyPtr);
280 QUntypedPropertyData *aliasedProperty()
const
287 QPropertyObserver(
const QPropertyObserver &) =
delete;
288 QPropertyObserver &operator=(
const QPropertyObserver &) =
delete;
292template <
typename Functor>
322 std::function<
void()> m_handler;
354 QtPrivate::QPropertyBindingData d;
355 bool is_equal(
const T &v)
357 if constexpr (QTypeTraits::has_operator_equal_v<T>) {
364 template <
typename U,
typename =
void>
365 struct has_operator_equal_to : std::false_type{};
367 template <
typename U>
371 template <
typename U>
372 static constexpr bool has_operator_equal_to_v =
388 template <
typename Functor>
390 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
399 QT_DECLARE_EQUALITY_OPERATORS_HELPER(
QProperty,
QProperty, ,
noexcept(
false),
template <
typename Ty = T, std::enable_if_t<QTypeTraits::has_operator_equal_v<Ty>>* =
nullptr>)
410#if !defined(Q_CC_GNU) || defined(Q_CC_CLANG)
411#define QPROPERTY_DECL_DELETED_EQ_OP
412 Q_DECL_EQ_DELETE_X("Call .value() on one of the properties explicitly.")
415 template <
typename U, std::enable_if_t<!std::is_same_v<T, U>>* =
nullptr>
417#undef QPROPERTY_DECL_DELETED_EQ_OP
422 d.registerWithCurrentlyEvaluatingBinding();
428 if constexpr (QTypeTraits::is_dereferenceable_v<T>) {
430 }
else if constexpr (
std::is_pointer_v<T>) {
451 if (is_equal(newValue))
453 this->val =
std::move(newValue);
460 if (is_equal(newValue))
462 this->val = newValue;
468 setValue(
std::move(newValue));
480 return QPropertyBinding<T>(d.setBinding(newBinding,
this));
485 if (!newBinding.isNull() && newBinding.valueMetaType().id() != qMetaTypeId<T>())
492 template <
typename Functor>
495 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
513 return QPropertyBinding<T>(d.setBinding(QUntypedPropertyBinding(),
this));
516 template<
typename Functor>
519 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
523 template<
typename Functor>
526 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
528 return onValueChanged(
std::move(f));
531 template<
typename Functor>
534 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
567 template <
typename PropertyType>
569 const QPropertyBindingSourceLocation &location =
572 return Qt::makePropertyBinding([&otherProperty]() -> PropertyType {
return otherProperty; }, location);
582 using Getter =
void (*)(
const QUntypedPropertyData *d,
void *value);
583 using Setter =
void (*)(QUntypedPropertyData *d,
const void *value);
587 using SetObserver =
void (*)(
const QUntypedPropertyData *d, QPropertyObserver *observer);
600template<
typename Property,
typename =
void>
603 using T =
typename Property::value_type;
676Q_CORE_EXPORT
void getter(
const QUntypedPropertyData *d,
void *value);
677Q_CORE_EXPORT
void setter(QUntypedPropertyData *d,
const void *value);
679Q_CORE_EXPORT
bool bindingWrapper(QMetaType type, QUntypedPropertyData *d,
680 QtPrivate::QPropertyBindingFunction binding,
681 QUntypedPropertyData *temp,
void *value);
685Q_CORE_EXPORT
void setObserver(
const QUntypedPropertyData *d, QPropertyObserver *observer);
689 QtPrivate::QPropertyBindingFunction binding)
693 void *data() {
return &
this->val; }
695 return bindingWrapper(type, d, binding, &temp, temp.data());
701 return setBinding(d, binding, &bindingWrapper<T>);
706 const QPropertyBindingSourceLocation &location)
708 return Qt::makePropertyBinding(
745 template<
typename Property>
749 { Q_ASSERT(data && iface); }
751 bool isValid()
const {
return data !=
nullptr; }
757 return iface ?
iface->makeBinding(data, location) : QUntypedPropertyBinding();
763 return QUntypedPropertyBinding {};
768 if (!(
iface->getBinding &&
iface->setBinding))
769 return QUntypedPropertyBinding {};
772 iface->setBinding(data, QUntypedPropertyBinding{});
777 void observe(QPropertyObserver *observer)
const
788 template<
typename Functor>
796 template<
typename Functor>
800 return onValueChanged(
std::move(f));
803 template<
typename Functor>
818 return QUntypedPropertyBinding();
820 return iface->getBinding(data);
832 if (!binding.isNull() && binding.valueMetaType() != metaType()) {
838 iface->setBinding(data, binding);
843 return !binding().isNull();
848 if (!(iface && data))
851 return iface->metaType();
857 iface->getter(data,
reinterpret_cast<
void *>(quintptr(&result) | QtPrivate::QBindableInterface::MetaTypeAccessorFlag));
875 if (iface && metaType() != QMetaType::fromType<T>()) {
881 explicit QBindable(QObject *obj,
const QMetaProperty &property)
889 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::makeBinding(location));
893 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::binding());
898 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::takeBinding());
904 Q_ASSERT(!iface || binding.isNull() || binding.valueMetaType() == metaType());
917 template <
typename Functor>
920 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
925 template <
typename Functor>
926 QPropertyBinding<T> setBinding(Functor f);
946#if QT_DEPRECATED_SINCE(6
, 6
)
948class QT_DEPRECATED_VERSION_X_6_6(
"Class was only meant for internal use, use a QProperty and add a binding to the target")
949QPropertyAlias :
public QPropertyObserver
951 Q_DISABLE_COPY_MOVE(QPropertyAlias)
952 const QtPrivate::QBindableInterface *iface =
nullptr;
955 QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
956 QPropertyAlias(QProperty<T> *property)
957 : QPropertyObserver(property),
958 iface(&QtPrivate::QBindableInterfaceForProperty<QProperty<T>>::iface)
961 iface->setObserver(aliasedProperty(),
this);
964 template <
typename Property, QtPrivate::IsUntypedPropertyData<Property> =
true>
965 QPropertyAlias(Property *property)
966 : QPropertyObserver(property),
967 iface(&QtPrivate::QBindableInterfaceForProperty<Property>::iface)
970 iface->setObserver(aliasedProperty(),
this);
973 QPropertyAlias(QPropertyAlias<T> *alias)
974 : QPropertyObserver(alias->aliasedProperty()),
978 iface->setObserver(aliasedProperty(),
this);
981 QPropertyAlias(
const QBindable<T> &property)
982 : QPropertyObserver(property.data),
983 iface(property.iface)
986 iface->setObserver(aliasedProperty(),
this);
992 if (
auto *p = aliasedProperty())
993 iface->getter(p, &t);
997 operator T()
const {
return value(); }
999 void setValue(
const T &newValue)
1001 if (
auto *p = aliasedProperty())
1002 iface->setter(p, &newValue);
1005 QPropertyAlias<T> &operator=(
const T &newValue)
1011 QPropertyBinding<T> setBinding(
const QPropertyBinding<T> &newBinding)
1013 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
1016 bool setBinding(
const QUntypedPropertyBinding &newBinding)
1018 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
1022 template <
typename Functor>
1023 QPropertyBinding<T> setBinding(Functor &&f,
1024 const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION,
1025 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
1027 return setBinding(Qt::makePropertyBinding(std::forward<Functor>(f), location));
1030 template <
typename Functor>
1031 QPropertyBinding<T> setBinding(Functor f);
1034 bool hasBinding()
const
1036 return QBindable<T>(aliasedProperty(), iface).hasBinding();
1039 QPropertyBinding<T> binding()
const
1041 return QBindable<T>(aliasedProperty(), iface).binding();
1044 QPropertyBinding<T> takeBinding()
1046 return QBindable<T>(aliasedProperty(), iface).takeBinding();
1049 template<
typename Functor>
1050 QPropertyChangeHandler<Functor> onValueChanged(Functor f)
1052 return QBindable<T>(aliasedProperty(), iface).onValueChanged(std::move(f));
1055 template<
typename Functor>
1056 QPropertyChangeHandler<Functor> subscribe(Functor f)
1058 return QBindable<T>(aliasedProperty(), iface).subscribe(std::move(f));
1061 template<
typename Functor>
1062 QPropertyNotifier addNotifier(Functor f)
1064 return QBindable<T>(aliasedProperty(), iface).addNotifier(std::move(f));
1067 bool isValid()
const
1069 return aliasedProperty() !=
nullptr;
1075template<
typename Class,
typename T,
auto Offset,
auto Signal =
nullptr>
1079 static bool constexpr HasSignal = !
std::is_same_v<
decltype(Signal),
std::nullptr_t>;
1080 using SignalTakesValue =
std::is_invocable<
decltype(Signal), Class, T>;
1083 char *that =
reinterpret_cast<
char *>(
this);
1084 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1086 const Class *owner()
const
1088 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1089 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1091 static void signalCallBack(QUntypedPropertyData *o)
1094 if constexpr (HasSignal) {
1095 if constexpr (SignalTakesValue::value)
1096 (that->owner()->*Signal)(that->valueBypassingBindings());
1098 (that->owner()->*Signal)();
1112 { setBinding(binding); }
1114 template <
typename Functor>
1116 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
1293#define QT_OBJECT_BINDABLE_PROPERTY_3(Class, Type, name)
1294 static constexpr size_t _qt_property_##name##_offset() {
1295 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1296 return offsetof(Class, name);
1299 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name;
1301#define QT_OBJECT_BINDABLE_PROPERTY_4(Class, Type, name, Signal)
1302 static constexpr size_t _qt_property_##name##_offset() {
1303 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1304 return offsetof(Class, name);
1307 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name;
1309#define Q_OBJECT_BINDABLE_PROPERTY(...)
1310 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1311 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY, __VA_ARGS__)
1314#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_4(Class, Type, name, value)
1315 static constexpr size_t _qt_property_##name##_offset()
1317 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1318 return offsetof(Class, name);
1321 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name =
1322 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr>(
1325#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_5(Class, Type, name, value, Signal)
1326 static constexpr size_t _qt_property_##name##_offset()
1328 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1329 return offsetof(Class, name);
1332 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name =
1333 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal>(
1336#define Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(...)
1337 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1338 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS, __VA_ARGS__)
1341template<
typename Class,
typename T,
auto Offset,
auto Getter>
1346 char *that =
reinterpret_cast<
char *>(
this);
1347 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1349 const Class *owner()
const
1351 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1352 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1363 qGetBindingStorage(owner())->registerDependency(
this);
1364 return (owner()->*Getter)();
1425#define Q_OBJECT_COMPUTED_PROPERTY(Class, Type, name, ...)
1426 static constexpr size_t _qt_property_##name##_offset() {
1427 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1428 return offsetof(Class, name);
1431 QObjectComputedProperty<Class, Type, Class::_qt_property_##name##_offset, __VA_ARGS__> name;
1433#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