4#ifndef QPROPERTYPRIVATE_H
5#define QPROPERTYPRIVATE_H
18#include <QtCore/qglobal.h>
19#include <QtCore/qtaggedpointer.h>
20#include <QtCore/qmetatype.h>
21#include <QtCore/qcontainerfwd.h>
29template<
typename Class,
typename T, auto Offset, auto Setter, auto Signal, auto Getter>
58 explicit operator T *() {
return d; }
59 explicit operator const T *()
const noexcept {
return d; }
60 T *
data() const noexcept {
return d; }
61 T *
get() const noexcept {
return d; }
63 T *
take() noexcept {
T *
x = d; d =
nullptr;
return x; }
75 : d(
o.d) {
if (d) d->
addRef(); }
77 void reset(T *
ptr =
nullptr) noexcept;
92 operator
bool () const noexcept {
return d !=
nullptr; }
93 bool operator!() const noexcept {
return d ==
nullptr; }
101 {
return lhs.d == rhs.d; }
104 const
T *rhs) noexcept
105 {
return lhs.d == rhs; }
108 std::nullptr_t) noexcept
135class QPropertyBindingData;
152struct BindingEvaluationState;
170 template<
typename Callable,
typename PropertyType=MSVCWorkAround>
173 static_assert (
alignof(
Callable) <=
alignof(std::max_align_t),
"Bindings do not support overaligned functors!");
176 if constexpr (!std::is_invocable_v<Callable>) {
178 static_assert (std::is_invocable_r_v<bool, Callable, QMetaType, QUntypedPropertyData *> );
179 auto untypedEvaluationFunction =
static_cast<Callable *
>(
f);
180 return std::invoke(*untypedEvaluationFunction, metaType, dataPtr);
181 }
else if constexpr (!std::is_same_v<PropertyType, MSVCWorkAround>) {
183 QPropertyData<PropertyType> *propertyPtr =
static_cast<QPropertyData<PropertyType> *
>(dataPtr);
185 auto evaluationFunction =
static_cast<Callable *
>(
f);
186 PropertyType newValue = std::invoke(*evaluationFunction);
187 if constexpr (QTypeTraits::has_operator_equal_v<PropertyType>) {
188 if (newValue == propertyPtr->valueBypassingBindings())
191 propertyPtr->setValueBypassingBindings(std::move(newValue));
195 Q_UNREACHABLE_RETURN(
false);
207template<
typename Callable,
typename PropertyType=MSVCWorkAround>
235 friend struct QT_PREPEND_NAMESPACE(QPropertyBindingDataPointer);
236 friend class QT_PREPEND_NAMESPACE(QQmlPropertyBinding);
237 friend struct QT_PREPEND_NAMESPACE(QPropertyDelayedNotifications);
239 template<
typename Class,
typename T, auto Offset, auto Setter, auto Signal, auto Getter>
240 friend class QT_PREPEND_NAMESPACE(QObjectCompatProperty);
252 static inline constexpr quintptr DelayedNotificationBit = 0x2;
276 removeBinding_helper();
283 registerWithCurrentlyEvaluatingBinding_helper(currentBinding);
285 void registerWithCurrentlyEvaluatingBinding()
const;
303 if (isNotificationDelayed())
304 return proxyData()->d_ptr;
313 void registerWithCurrentlyEvaluatingBinding_helper(BindingEvaluationState *currentBinding)
const;
314 void removeBinding_helper();
316 enum NotificationResult { Delayed, Evaluated };
317 NotificationResult notifyObserver_helper(
323template <
typename T,
typename Tag>
339 QTagPreservingPointerToPointer<T, Tag> &
operator=(QTaggedPointer<T, Tag> *
ptr)
360 explicit operator bool()
const
370 template <
typename F>
373 template<
typename T,
typename C>
\macro Q_OBJECT_BINDABLE_PROPERTY(containingClass, type, name, signal)
friend bool comparesEqual(const QPropertyBindingPrivatePtr &lhs, const QPropertyBindingPrivatePtr &rhs) noexcept
void swap(QPropertyBindingPrivatePtr &other) noexcept
QPropertyBindingPrivatePtr & operator=(T *o) noexcept
T * operator->() const noexcept
~QPropertyBindingPrivatePtr()
Q_CORE_EXPORT void destroyAndFreeMemory()
QPropertyBindingPrivatePtr(QPropertyBindingPrivatePtr &&o) noexcept
bool operator!() const noexcept
QPropertyBindingPrivatePtr(const QPropertyBindingPrivatePtr &o) noexcept
T * data() const noexcept
const T * constData() const noexcept
T * operator->() noexcept
QPropertyBindingPrivatePtr(T *data) noexcept
QPropertyBindingPrivatePtr() noexcept
static constexpr quintptr pointerMask()
void registerWithCurrentlyEvaluatingBinding(QtPrivate::BindingEvaluationState *currentBinding) const
QPropertyBindingPrivate * binding() const
bool isNotificationDelayed() const
QPropertyBindingData()=default
QPropertyBindingData & operator=(QPropertyBindingData &&other)=delete
QTagPreservingPointerToPointer< T, Tag > & operator=(T **ptr)
QTagPreservingPointerToPointer(T **ptr)
QTagPreservingPointerToPointer< T, Tag > & operator=(QTaggedPointer< T, Tag > *ptr)
constexpr QTagPreservingPointerToPointer()=default
Combined button and popup list for selecting options.
constexpr size_t getOffset(size_t o)
std::enable_if_t< std::is_base_of_v< QUntypedPropertyData, T >, bool > IsUntypedPropertyData
constexpr BindingFunctionVTable bindingFunctionVTable
void(*)(QUntypedPropertyData *) QPropertyObserverCallback
bool(*)(QMetaType, QUntypedPropertyData *dataPtr, QPropertyBindingFunction) QPropertyBindingWrapper
#define Q_DECLARE_EQUALITY_COMPARABLE(...)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
static ControlElement< T > * ptr(QWidget *widget)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
QUntypedPropertyData * propertyData
const QtPrivate::QPropertyBindingData * originalBindingData
bool(*)(QMetaType, QUntypedPropertyData *, void *) CallFn
const MoveCtrFn moveConstruct
static constexpr BindingFunctionVTable createFor()
void(*)(void *, void *) MoveCtrFn
const QtPrivate::BindingFunctionVTable * vtable