4#ifndef QQMLNOTIFIER_P_H
5#define QQMLNOTIFIER_P_H
18#include <QtCore/qmetaobject.h>
19#include <private/qmetaobject_p.h>
20#include <private/qtqmlglobal_p.h>
24class QQmlNotifierEndpoint;
29 inline QQmlNotifier();
30 inline ~QQmlNotifier();
33 static void notify(QQmlData *ddata,
int notifierIndex);
36 friend class QQmlData;
37 friend class QQmlNotifierEndpoint;
38 friend class QQmlThreadNotifierProxyObject;
40 static void emitNotify(QQmlNotifierEndpoint *,
void **a);
41 QQmlNotifierEndpoint *endpoints =
nullptr;
68 inline bool isConnected(QObject *source,
int sourceSignal)
const;
71 void connect(QObject *source,
int sourceSignal, QQmlEngine *engine,
bool doNotify =
true);
72 inline void connect(QQmlNotifier *);
90 friend class QQmlData;
91 friend class QQmlNotifier;
99 int needsConnectNotify:1;
102 signed int sourceSignal:27;
105QQmlNotifier::QQmlNotifier()
109QQmlNotifier::~QQmlNotifier()
111 QQmlNotifierEndpoint *endpoint = endpoints;
113 QQmlNotifierEndpoint *n = endpoint;
118 n->sourceSignal = -1;
123void QQmlNotifier::notify()
125 void *args[] = {
nullptr };
126 if (endpoints) emitNotify(endpoints, args);
130: next(
nullptr), prev(
nullptr),
senderPtr(0), callback(callback), needsConnectNotify(
false), sourceSignal(-1)
141 return prev !=
nullptr;
145
146
147
150 return this->sourceSignal != -1 && senderAsObject() == source &&
151 this->sourceSignal == sourceSignal;
156 return sourceSignal == -1 && senderAsNotifier() == notifier;
163 next = notifier->endpoints;
164 if (next) { next->prev = &next; }
165 notifier->endpoints =
this;
166 prev = ¬ifier->endpoints;
167 setSender(qintptr(notifier));
174 if (next) next->prev = prev;
175 if (prev) *prev = next;
177 if (sourceSignal != -1 && needsConnectNotify) {
178 QObject *
const obj = senderAsObject();
180 QObjectPrivate *
const priv = QObjectPrivate::get(obj);
184 if (
const QMetaObject *mo = obj->metaObject())
185 priv->disconnectNotify(QMetaObjectPrivate::signal(mo, sourceSignal));
195
196
197
198
199
200
203 return senderPtr & 0x1;
208 Q_ASSERT(*originalSenderPtr == 0);
211 *originalSenderPtr = senderPtr;
214 senderPtr = qintptr(originalSenderPtr) | 0x1;
220 Q_ASSERT((senderPtr & ~0x1) == qintptr(originalSenderPtr));
221 senderPtr = *originalSenderPtr;
222 *originalSenderPtr = 0;
226
227
231 auto *ptr = (qintptr *)(senderPtr & ~0x1);
240 return isNotifying() ? *(qintptr *)(senderPtr & ~0x1) : senderPtr;
247 *(qintptr *)(senderPtr & ~0x1) = sender;
254 return (QObject *)(sender());
259 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[]