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// Qt-Security score:significant reason:default
4
5#ifndef QBINDINGSTORAGE_H
6#define QBINDINGSTORAGE_H
7
8#include <QtCore/qglobal.h>
9#include <QtCore/qnamespace.h>
10
12
13template <typename Class, typename T, auto Offset, auto Setter, auto Signal, auto Getter>
14class QObjectCompatProperty;
17
18namespace QtPrivate {
19
20class QPropertyBindingData;
23}
24
32
33namespace QtPrivate {
35Q_AUTOTEST_EXPORT QBindingStatus *getBindingStatus(QBindingStatusAccessToken);
37}
38
39
41class Q_CORE_EXPORT QBindingStorage
42{
43 mutable QBindingStorageData *d = nullptr;
44 QBindingStatus *bindingStatus = nullptr;
45
46 template<typename Class, typename T, auto Offset, auto Setter, auto Signal, auto Getter>
47 friend class QObjectCompatProperty;
48 friend class QObjectPrivate;
49 friend class QtPrivate::QPropertyBindingData;
50public:
51 QBindingStorage();
52 ~QBindingStorage();
53
54 bool isEmpty() { return !d; }
55 bool isValid() const noexcept { return bindingStatus; }
56
57 const QBindingStatus *status(QtPrivate::QBindingStatusAccessToken) const;
58
59 void registerDependency(const QUntypedPropertyData *data) const
60 {
61 if (!bindingStatus || !bindingStatus->currentlyEvaluatingBinding)
62 return;
63 registerDependency_helper(data);
64 }
65 QtPrivate::QPropertyBindingData *bindingData(const QUntypedPropertyData *data) const
66 {
67 if (!d)
68 return nullptr;
69 return bindingData_helper(data);
70 }
71
72#if QT_CORE_REMOVED_SINCE(6, 2)
73 void maybeUpdateBindingAndRegister(const QUntypedPropertyData *data) const { registerDependency(data); }
74#endif
75
76 QtPrivate::QPropertyBindingData *bindingData(QUntypedPropertyData *data, bool create)
77 {
78 if (!d && !create)
79 return nullptr;
80 return bindingData_helper(data, create);
81 }
82private:
83 void reinitAfterThreadMove();
84 void clear();
85 void registerDependency_helper(const QUntypedPropertyData *data) const;
86#if QT_CORE_REMOVED_SINCE(6, 2)
87 // ### Unused, but keep for BC
88 void maybeUpdateBindingAndRegister_helper(const QUntypedPropertyData *data) const;
89#endif
90 QtPrivate::QPropertyBindingData *bindingData_helper(const QUntypedPropertyData *data) const;
91 QtPrivate::QPropertyBindingData *bindingData_helper(QUntypedPropertyData *data, bool create);
92};
93
94QT_END_NAMESPACE
95
96#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:403
QStack< QEventLoop * > eventLoops
Definition qthread_p.h:371
QAtomicPointer< QAbstractEventDispatcher > eventDispatcher
Definition qthread_p.h:375
QtPrivate::BindingStatusOrList m_statusOrPendingObjects
Definition qthread_p.h:378
static QThreadData * current()
Definition qthread_p.h:320
void reuseBindingStatusForNewNativeThread()
Definition qthread_p.h:364
QThreadData(int initialRefCount=1)
Definition qthread_p.h:313
bool requiresCoreApplication
Definition qthread_p.h:390
void deref()
Definition qthread_p.h:343
static void clearCurrentThreadData()
Definition qthread.cpp:1184
bool isAdopted
Definition qthread_p.h:389
QAtomicPointer< void > threadId
Definition qthread_p.h:374
static QThreadData * get2(QThread *thread)
Definition qthread_p.h:327
QAbstractEventDispatcher * ensureEventDispatcher()
Definition qthread_p.h:348
QPostEventList postEventList
Definition qthread_p.h:372
bool canWaitLocked()
Definition qthread_p.h:356
bool hasEventDispatcher() const
Definition qthread_p.h:345
void ref()
Definition qthread_p.h:342
QAtomicPointer< QThread > thread
Definition qthread_p.h:373
void clearEvents()
Definition qthread.cpp:74
QList< void * > tls
Definition qthread_p.h:376
QAbstractEventDispatcher * createEventDispatcher()
Definition qthread.cpp:86
static void setCurrentThread(QThread *)
Definition qthread_p.h:299
static QAbstractEventDispatcher * createEventDispatcher(QThreadData *data)
QThreadPrivate(QThreadData *d=nullptr)
Definition qthread.cpp:1201
void removeObjectWithPendingBindingStatusChange(QObject *)
Definition qthread_p.h:297
QThreadData * data
Definition qthread_p.h:291
QBindingStatus * m_bindingStatus
Definition qthread_p.h:292
QBindingStatus * bindingStatus()
Definition qthread_p.h:295
QBindingStatus * addObjectWithPendingBindingStatusChange(QObject *)
Definition qthread_p.h:296
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
Combined button and popup list for selecting options.
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