5#ifndef QQMLNOTIFIER_P_H
6#define QQMLNOTIFIER_P_H
19#include <QtCore/qmetaobject.h>
20#include <private/qmetaobject_p.h>
21#include <private/qtqmlglobal_p.h>
25class QQmlNotifierEndpoint;
30 inline QQmlNotifier();
31 inline ~QQmlNotifier();
34 static void notify(QQmlData *ddata,
int notifierIndex);
37 friend class QQmlData;
38 friend class QQmlNotifierEndpoint;
39 friend class QQmlThreadNotifierProxyObject;
41 static void emitNotify(QQmlNotifierEndpoint *,
void **a);
42 QQmlNotifierEndpoint *endpoints =
nullptr;
69 inline bool isConnected(QObject *source,
int sourceSignal)
const;
72 void connect(QObject *source,
int sourceSignal, QQmlEngine *engine,
bool doNotify =
true);
73 inline void connect(QQmlNotifier *);
91 friend class QQmlData;
92 friend class QQmlNotifier;
100 int needsConnectNotify:1;
103 signed int sourceSignal:27;
106QQmlNotifier::QQmlNotifier()
110QQmlNotifier::~QQmlNotifier()
112 QQmlNotifierEndpoint *endpoint = endpoints;
114 QQmlNotifierEndpoint *n = endpoint;
119 n->sourceSignal = -1;
124void QQmlNotifier::notify()
126 void *args[] = {
nullptr };
127 if (endpoints) emitNotify(endpoints, args);
131: next(
nullptr), prev(
nullptr),
senderPtr(0), callback(callback), needsConnectNotify(
false), sourceSignal(-1)
142 return prev !=
nullptr;
146
147
148
151 return this->sourceSignal != -1 && senderAsObject() == source &&
152 this->sourceSignal == sourceSignal;
157 return sourceSignal == -1 && senderAsNotifier() == notifier;
164 next = notifier->endpoints;
165 if (next) { next->prev = &next; }
166 notifier->endpoints =
this;
167 prev = ¬ifier->endpoints;
168 setSender(qintptr(notifier));
175 if (next) next->prev = prev;
176 if (prev) *prev = next;
178 if (sourceSignal != -1 && needsConnectNotify) {
179 QObject *
const obj = senderAsObject();
181 QObjectPrivate *
const priv = QObjectPrivate::get(obj);
185 if (
const QMetaObject *mo = obj->metaObject())
186 priv->disconnectNotify(QMetaObjectPrivate::signal(mo, sourceSignal));
196
197
198
199
200
201
204 return senderPtr & 0x1;
209 Q_ASSERT(*originalSenderPtr == 0);
212 *originalSenderPtr = senderPtr;
215 senderPtr = qintptr(originalSenderPtr) | 0x1;
221 Q_ASSERT((senderPtr & ~0x1) == qintptr(originalSenderPtr));
222 senderPtr = *originalSenderPtr;
223 *originalSenderPtr = 0;
227
228
232 auto *ptr = (qintptr *)(senderPtr & ~0x1);
241 return isNotifying() ? *(qintptr *)(senderPtr & ~0x1) : senderPtr;
248 *(qintptr *)(senderPtr & ~0x1) = sender;
255 return (QObject *)(sender());
260 return (QQmlNotifier *)(sender());
@ QQmlUnbindableToUnbindableGuard
@ QQmlVMEMetaObjectEndpoint
@ QQmlJavaScriptExpressionGuard
@ QQmlDirtyReferenceObject
@ QQmlUnbindableToBindableGuard
void setSender(qintptr sender)
void cancelNotify()
Cancel any notifies that are in progress.
bool isNotifying() const
Returns true if a notify is in progress.
QObject * senderAsObject() const
void connect(QObject *source, int sourceSignal, QQmlEngine *engine, bool doNotify=true)
QQmlNotifier * senderAsNotifier() const
bool isConnected(QQmlNotifier *) const
void stopNotifying(qintptr *originalSenderPtr)
void connect(QQmlNotifier *)
bool isConnected(QObject *source, int sourceSignal) const
void startNotifying(qintptr *originalSenderPtr)
QQmlNotifierEndpoint(Callback callback)
Combined button and popup list for selecting options.
void QQmlUnbindableToUnbindableGuard_callback(QQmlNotifierEndpoint *, void **)
void QQmlVMEMetaObjectEndpoint_callback(QQmlNotifierEndpoint *, void **)
void QQmlBoundSignal_callback(QQmlNotifierEndpoint *, void **)
void QQmlUnbindableToBindableGuard_callback(QQmlNotifierEndpoint *, void **)
QT_BEGIN_NAMESPACE typedef void(* Callback)(QQmlNotifierEndpoint *, void **)
void QQmlDirtyReferenceObject_callback(QQmlNotifierEndpoint *, void **)
void QQmlJavaScriptExpressionGuard_callback(QQmlNotifierEndpoint *, void **)
static Callback QQmlNotifier_callbacks[]