43 #include <QtCore/qbytearray.h>
44 #include <QtCore/qlist.h>
45 #include <QtCore/qobject.h>
46 #include <QtCore/qmetaobject.h>
47 #include <QtTest/qtesteventloop.h>
48 #include <QtCore/qvariant.h>
61 if (!isObjectValid(
obj))
65 qWarning(
"QSignalSpy: Null signal name is not valid");
70 qWarning(
"QSignalSpy: Not a valid signal, use the SIGNAL macro");
82 if (!connectToSignal(
obj, sigIndex))
86 initArgs(
mo->method(sigIndex),
obj);
90 template <
typename Po
interToMemberFunction>
93 template <
typename Func>
97 if (!isObjectValid(
obj))
101 qWarning(
"QSignalSpy: Null signal name is not valid");
107 const int sigIndex = signalMetaMethod.
methodIndex();
109 if (!isSignalMetaMethodValid(signalMetaMethod))
112 if (!connectToSignal(
obj, sigIndex))
116 initArgs(
mo->method(sigIndex),
obj);
123 if (isObjectValid(
obj) && isSignalMetaMethodValid(
signal) &&
124 connectToSignal(
obj,
signal.methodIndex())) {
125 sig =
signal.methodSignature();
136 const int origCount =
count();
140 return count() > origCount;
145 methodId = QObject::qt_metacall(call, methodId,
a);
161 static const int memberOffset = QObject::staticMetaObject.methodCount();
166 qWarning(
"QSignalSpy: QMetaObject::connect returned false. Unable to connect.");
181 static bool isObjectValid(
const QObject *
object)
183 const bool valid = !!
object;
186 qWarning(
"QSignalSpy: Cannot spy on a null object");
197 void *argv[] = { &tp, &
i };
203 qWarning(
"QSignalSpy: Unable to handle parameter '%s' of type '%s' of method '%s',"
204 " use qRegisterMetaType to register it.",
213 void appendArgs(
void **
a)
217 for (
int i = 0;
i < args.
count(); ++
i) {
220 list << *reinterpret_cast<QVariant *>(
a[
i + 1]);
small capitals from c petite p scientific i
[1]
The QByteArray class provides an array of bytes.
const char * constData() const noexcept
bool isEmpty() const noexcept
const_pointer constData() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype count() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
The QObject class is the base class of all Qt objects.
QSignalSpy(const typename QtPrivate::FunctionPointer< Func >::Object *obj, Func signal0)
QSignalSpy(const QObject *obj, const QMetaMethod &signal)
QSignalSpy(const QObject *obj, const char *aSignal)
bool wait(int timeout=5000)
QByteArray signal() const
int qt_metacall(QMetaObject::Call call, int methodId, void **a) override
void enterLoopMSecs(int ms)
The QVariant class acts like a union for the most common Qt data types.
GLboolean GLboolean GLboolean GLboolean a
[7]
GLbitfield GLuint64 timeout
[4]