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
)
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>) {
363 template <
typename U,
typename =
void>
364 struct has_operator_equal_to : std::false_type{};
366 template <
typename U>
370 template <
typename U>
371 static constexpr bool has_operator_equal_to_v =
387 template <
typename Functor>
389 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
398 QT_DECLARE_EQUALITY_OPERATORS_HELPER(
QProperty,
QProperty, ,
noexcept(
false),
template <
typename Ty = T, std::enable_if_t<QTypeTraits::has_operator_equal_v<Ty>>* =
nullptr>)
409#if !defined(Q_CC_GNU) || defined(Q_CC_CLANG)
410#define QPROPERTY_DECL_DELETED_EQ_OP
411 Q_DECL_EQ_DELETE_X("Call .value() on one of the properties explicitly.")
414 template <
typename U, std::enable_if_t<!std::is_same_v<T, U>>* =
nullptr>
416#undef QPROPERTY_DECL_DELETED_EQ_OP
421 d.registerWithCurrentlyEvaluatingBinding();
427 if constexpr (QTypeTraits::is_dereferenceable_v<T>) {
429 }
else if constexpr (
std::is_pointer_v<T>) {
450 if (is_equal(newValue))
452 this->val =
std::move(newValue);
459 if (is_equal(newValue))
461 this->val = newValue;
467 setValue(
std::move(newValue));
479 return QPropertyBinding<T>(d.setBinding(newBinding,
this));
484 if (!newBinding.isNull() && newBinding.valueMetaType().id() != qMetaTypeId<T>())
491 template <
typename Functor>
494 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
507 return QPropertyBinding<T>(QUntypedPropertyBinding(d.binding()));
512 return QPropertyBinding<T>(d.setBinding(QUntypedPropertyBinding(),
this));
515 template<
typename Functor>
518 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
522 template<
typename Functor>
525 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
527 return onValueChanged(
std::move(f));
530 template<
typename Functor>
533 static_assert(
std::is_invocable_v<Functor>,
"Functor callback must be callable without any parameters");
566 template <
typename PropertyType>
568 const QPropertyBindingSourceLocation &location =
571 return Qt::makePropertyBinding([&otherProperty]() -> PropertyType {
return otherProperty; }, location);
581 using Getter =
void (*)(
const QUntypedPropertyData *d,
void *value);
582 using Setter =
void (*)(QUntypedPropertyData *d,
const void *value);
586 using SetObserver =
void (*)(
const QUntypedPropertyData *d, QPropertyObserver *observer);
599template<
typename Property,
typename =
void>
602 using T =
typename Property::value_type;
675Q_CORE_EXPORT
void getter(
const QUntypedPropertyData *d,
void *value);
676Q_CORE_EXPORT
void setter(QUntypedPropertyData *d,
const void *value);
678Q_CORE_EXPORT
bool bindingWrapper(QMetaType type, QUntypedPropertyData *d,
679 QtPrivate::QPropertyBindingFunction binding,
680 QUntypedPropertyData *temp,
void *value);
684Q_CORE_EXPORT
void setObserver(
const QUntypedPropertyData *d, QPropertyObserver *observer);
688 QtPrivate::QPropertyBindingFunction binding)
692 void *data() {
return &
this->val; }
694 return bindingWrapper(type, d, binding, &temp, temp.data());
700 return setBinding(d, binding, &bindingWrapper<T>);
705 const QPropertyBindingSourceLocation &location)
707 return Qt::makePropertyBinding(
744 template<
typename Property>
748 { Q_ASSERT(data && iface); }
750 bool isValid()
const {
return data !=
nullptr; }
756 return iface ? iface->makeBinding(data, location) : QUntypedPropertyBinding();
762 return QUntypedPropertyBinding {};
767 if (!(
iface->getBinding &&
iface->setBinding))
768 return QUntypedPropertyBinding {};
771 iface->setBinding(data, QUntypedPropertyBinding{});
776 void observe(QPropertyObserver *observer)
const
779 iface->setObserver(data, observer);
787 template<
typename Functor>
795 template<
typename Functor>
799 return onValueChanged(
std::move(f));
802 template<
typename Functor>
817 return QUntypedPropertyBinding();
819 return iface->getBinding(data);
831 if (!binding.isNull() && binding.valueMetaType() != metaType()) {
833 QtPrivate::BindableWarnings::printMetaTypeMismatch(metaType(), binding.valueMetaType());
837 iface->setBinding(data, binding);
842 return !binding().isNull();
847 if (!(iface && data))
850 return iface->metaType();
856 iface->getter(data,
reinterpret_cast<
void *>(quintptr(&result) | QtPrivate::QBindableInterface::MetaTypeAccessorFlag));
874 if (iface && metaType() != QMetaType::fromType<T>()) {
880 explicit QBindable(QObject *obj,
const QMetaProperty &property)
888 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::makeBinding(location));
892 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::binding());
897 return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::takeBinding());
903 Q_ASSERT(!iface || binding.isNull() || binding.valueMetaType() == metaType());
905 if (iface && iface->setBinding)
906 return static_cast<QPropertyBinding<T> &&>(iface->setBinding(data, binding));
916 template <
typename Functor>
919 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
924 template <
typename Functor>
925 QPropertyBinding<T> setBinding(Functor f);
932 iface->getter(data, &result);
940 if (iface && iface->setter)
941 iface->setter(data, &value);
945#if QT_DEPRECATED_SINCE(6
, 6
)
947class QT_DEPRECATED_VERSION_X_6_6(
"Class was only meant for internal use, use a QProperty and add a binding to the target")
948QPropertyAlias :
public QPropertyObserver
950 Q_DISABLE_COPY_MOVE(QPropertyAlias)
951 const QtPrivate::QBindableInterface *iface =
nullptr;
954 QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
955 QPropertyAlias(QProperty<T> *property)
956 : QPropertyObserver(property),
957 iface(&QtPrivate::QBindableInterfaceForProperty<QProperty<T>>::iface)
960 iface->setObserver(aliasedProperty(),
this);
963 template <
typename Property, QtPrivate::IsUntypedPropertyData<Property> =
true>
964 QPropertyAlias(Property *property)
965 : QPropertyObserver(property),
966 iface(&QtPrivate::QBindableInterfaceForProperty<Property>::iface)
969 iface->setObserver(aliasedProperty(),
this);
972 QPropertyAlias(QPropertyAlias<T> *alias)
973 : QPropertyObserver(alias->aliasedProperty()),
977 iface->setObserver(aliasedProperty(),
this);
980 QPropertyAlias(
const QBindable<T> &property)
981 : QPropertyObserver(property.data),
982 iface(property.iface)
985 iface->setObserver(aliasedProperty(),
this);
991 if (
auto *p = aliasedProperty())
992 iface->getter(p, &t);
996 operator T()
const {
return value(); }
998 void setValue(
const T &newValue)
1000 if (
auto *p = aliasedProperty())
1001 iface->setter(p, &newValue);
1004 QPropertyAlias<T> &operator=(
const T &newValue)
1010 QPropertyBinding<T> setBinding(
const QPropertyBinding<T> &newBinding)
1012 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
1015 bool setBinding(
const QUntypedPropertyBinding &newBinding)
1017 return QBindable<T>(aliasedProperty(), iface).setBinding(newBinding);
1021 template <
typename Functor>
1022 QPropertyBinding<T> setBinding(Functor &&f,
1023 const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION,
1024 std::enable_if_t<std::is_invocable_v<Functor>> * =
nullptr)
1026 return setBinding(Qt::makePropertyBinding(std::forward<Functor>(f), location));
1029 template <
typename Functor>
1030 QPropertyBinding<T> setBinding(Functor f);
1033 bool hasBinding()
const
1035 return QBindable<T>(aliasedProperty(), iface).hasBinding();
1038 QPropertyBinding<T> binding()
const
1040 return QBindable<T>(aliasedProperty(), iface).binding();
1043 QPropertyBinding<T> takeBinding()
1045 return QBindable<T>(aliasedProperty(), iface).takeBinding();
1048 template<
typename Functor>
1049 QPropertyChangeHandler<Functor> onValueChanged(Functor f)
1051 return QBindable<T>(aliasedProperty(), iface).onValueChanged(std::move(f));
1054 template<
typename Functor>
1055 QPropertyChangeHandler<Functor> subscribe(Functor f)
1057 return QBindable<T>(aliasedProperty(), iface).subscribe(std::move(f));
1060 template<
typename Functor>
1061 QPropertyNotifier addNotifier(Functor f)
1063 return QBindable<T>(aliasedProperty(), iface).addNotifier(std::move(f));
1066 bool isValid()
const
1068 return aliasedProperty() !=
nullptr;
1074template<
typename Class,
typename T,
auto Offset,
auto Signal =
nullptr>
1078 static bool constexpr HasSignal = !
std::is_same_v<
decltype(Signal),
std::nullptr_t>;
1079 using SignalTakesValue =
std::is_invocable<
decltype(Signal), Class, T>;
1082 char *that =
reinterpret_cast<
char *>(
this);
1083 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1085 const Class *owner()
const
1087 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1088 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1090 static void signalCallBack(QUntypedPropertyData *o)
1093 if constexpr (HasSignal) {
1094 if constexpr (SignalTakesValue::value)
1095 (that->owner()->*Signal)(that->valueBypassingBindings());
1097 (that->owner()->*Signal)();
1111 { setBinding(binding); }
1113 template <
typename Functor>
1115 typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * =
nullptr)
1292#define QT_OBJECT_BINDABLE_PROPERTY_3(Class, Type, name)
1293 static constexpr size_t _qt_property_##name##_offset() {
1294 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1295 return offsetof(Class, name);
1298 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name;
1300#define QT_OBJECT_BINDABLE_PROPERTY_4(Class, Type, name, Signal)
1301 static constexpr size_t _qt_property_##name##_offset() {
1302 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1303 return offsetof(Class, name);
1306 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name;
1308#define Q_OBJECT_BINDABLE_PROPERTY(...)
1309 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1310 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY, __VA_ARGS__)
1313#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_4(Class, Type, name, value)
1314 static constexpr size_t _qt_property_##name##_offset()
1316 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1317 return offsetof(Class, name);
1320 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name =
1321 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr>(
1324#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_5(Class, Type, name, value, Signal)
1325 static constexpr size_t _qt_property_##name##_offset()
1327 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1328 return offsetof(Class, name);
1331 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name =
1332 QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal>(
1335#define Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(...)
1336 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1337 QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS, __VA_ARGS__)
1340template<
typename Class,
typename T,
auto Offset,
auto Getter>
1345 char *that =
reinterpret_cast<
char *>(
this);
1346 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1348 const Class *owner()
const
1350 char *that =
const_cast<
char *>(
reinterpret_cast<
const char *>(
this));
1351 return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
1362 qGetBindingStorage(owner())->registerDependency(
this);
1363 return (owner()->*Getter)();
1424#define Q_OBJECT_COMPUTED_PROPERTY(Class, Type, name, ...)
1425 static constexpr size_t _qt_property_##name##_offset() {
1426 QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF
1427 return offsetof(Class, name);
1430 QObjectComputedProperty<Class, Type, Class::_qt_property_##name##_offset, __VA_ARGS__> name;
1432#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
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)
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
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()
#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