Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qbindingstorage.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBINDINGSTORAGE_H
5#define QBINDINGSTORAGE_H
6
7#include <QtCore/qglobal.h>
8#include <QtCore/qnamespace.h>
9
11
12template <typename Class, typename T, auto Offset, auto Setter, auto Signal, auto Getter>
13class QObjectCompatProperty;
16
17namespace QtPrivate {
18
19class QPropertyBindingData;
22}
23
31
32namespace QtPrivate {
34Q_AUTOTEST_EXPORT QBindingStatus *getBindingStatus(QBindingStatusAccessToken);
36}
37
38
40class Q_CORE_EXPORT QBindingStorage
41{
42 mutable QBindingStorageData *d = nullptr;
43 QBindingStatus *bindingStatus = nullptr;
44
45 template<typename Class, typename T, auto Offset, auto Setter, auto Signal, auto Getter>
46 friend class QObjectCompatProperty;
47 friend class QObjectPrivate;
48 friend class QtPrivate::QPropertyBindingData;
49public:
50 QBindingStorage();
51 ~QBindingStorage();
52
53 bool isEmpty() { return !d; }
54 bool isValid() const noexcept { return bindingStatus; }
55
56 const QBindingStatus *status(QtPrivate::QBindingStatusAccessToken) const;
57
58 void registerDependency(const QUntypedPropertyData *data) const
59 {
60 if (!bindingStatus || !bindingStatus->currentlyEvaluatingBinding)
61 return;
62 registerDependency_helper(data);
63 }
64 QtPrivate::QPropertyBindingData *bindingData(const QUntypedPropertyData *data) const
65 {
66 if (!d)
67 return nullptr;
68 return bindingData_helper(data);
69 }
70
71#if QT_CORE_REMOVED_SINCE(6, 2)
72 void maybeUpdateBindingAndRegister(const QUntypedPropertyData *data) const { registerDependency(data); }
73#endif
74
75 QtPrivate::QPropertyBindingData *bindingData(QUntypedPropertyData *data, bool create)
76 {
77 if (!d && !create)
78 return nullptr;
79 return bindingData_helper(data, create);
80 }
81private:
82 void reinitAfterThreadMove();
83 void clear();
84 void registerDependency_helper(const QUntypedPropertyData *data) const;
85#if QT_CORE_REMOVED_SINCE(6, 2)
86 // ### Unused, but keep for BC
87 void maybeUpdateBindingAndRegister_helper(const QUntypedPropertyData *data) const;
88#endif
89 QtPrivate::QPropertyBindingData *bindingData_helper(const QUntypedPropertyData *data) const;
90 QtPrivate::QPropertyBindingData *bindingData_helper(QUntypedPropertyData *data, bool create);
91};
92
93QT_END_NAMESPACE
94
95#endif // QBINDINGSTORAGE_H
void addEvent(const QPostEvent &ev)
Definition qthread.cpp:23
qsizetype startOffset
Definition qthread_p.h:72
qsizetype insertionOffset
Definition qthread_p.h:74
QObject * receiver
Definition qthread_p.h:44
QPostEvent(QObject *r, QEvent *e, int p)
Definition qthread_p.h:50
QEvent * event
Definition qthread_p.h:45
int priority
Definition qthread_p.h:46
QScopedScopeLevelCounter(QThreadData *threadData)
Definition qthread_p.h:397
QStack< QEventLoop * > eventLoops
Definition qthread_p.h:365
QAtomicPointer< QAbstractEventDispatcher > eventDispatcher
Definition qthread_p.h:369
QtPrivate::BindingStatusOrList m_statusOrPendingObjects
Definition qthread_p.h:372
static QThreadData * current()
Definition qthread_p.h:314
void reuseBindingStatusForNewNativeThread()
Definition qthread_p.h:358
QThreadData(int initialRefCount=1)
Definition qthread_p.h:307
bool requiresCoreApplication
Definition qthread_p.h:384
void deref()
Definition qthread_p.h:337
static void clearCurrentThreadData()
Definition qthread.cpp:1184
bool isAdopted
Definition qthread_p.h:383
QAtomicPointer< void > threadId
Definition qthread_p.h:368
static QThreadData * get2(QThread *thread)
Definition qthread_p.h:321
QAbstractEventDispatcher * ensureEventDispatcher()
Definition qthread_p.h:342
QPostEventList postEventList
Definition qthread_p.h:366
bool canWaitLocked()
Definition qthread_p.h:350
bool hasEventDispatcher() const
Definition qthread_p.h:339
void ref()
Definition qthread_p.h:336
QAtomicPointer< QThread > thread
Definition qthread_p.h:367
void clearEvents()
Definition qthread.cpp:74
QList< void * > tls
Definition qthread_p.h:370
QAbstractEventDispatcher * createEventDispatcher()
Definition qthread.cpp:86
static void setCurrentThread(QThread *)
Definition qthread_p.h:293
static QAbstractEventDispatcher * createEventDispatcher(QThreadData *data)
QThreadPrivate(QThreadData *d=nullptr)
Definition qthread.cpp:1201
void removeObjectWithPendingBindingStatusChange(QObject *)
Definition qthread_p.h:291
QThreadData * data
Definition qthread_p.h:285
QBindingStatus * m_bindingStatus
Definition qthread_p.h:286
QBindingStatus * bindingStatus()
Definition qthread_p.h:289
QBindingStatus * addObjectWithPendingBindingStatusChange(QObject *)
Definition qthread_p.h:290
List * list() const noexcept
Definition qthread_p.h:143
static bool isBindingStatus(quintptr data) noexcept
Definition qthread_p.h:124
static bool isNull(quintptr data) noexcept
Definition qthread_p.h:129
void removeObject(QObject *object)
void setStatusAndClearList(QBindingStatus *status) noexcept
Definition qthread.cpp:631
constexpr BindingStatusOrList() noexcept
Definition qthread_p.h:108
QBindingStatus * addObjectUnlessAlreadyStatus(QObject *object)
BindingStatusOrList(QBindingStatus *status) noexcept
Definition qthread_p.h:109
QBindingStatus * bindingStatus() const noexcept
Definition qthread_p.h:132
static bool isList(quintptr data) noexcept
Definition qthread_p.h:128
void setBindingStatus(QBindingStatus *status, QBindingStatusAccessToken)
Q_DECLARE_TYPEINFO(QPostEvent, Q_RELOCATABLE_TYPE)
bool operator<(const QPostEvent &first, const QPostEvent &second)
Definition qthread_p.h:56
Qt::HANDLE threadId
QtPrivate::CompatPropertySafePoint * currentCompatProperty
QPropertyDelayedNotifications * groupUpdateData
QtPrivate::BindingEvaluationState * currentlyEvaluatingBinding