QSignalSpy: inline connectToSignal() into its only caller
Following the verify() Extract Method refactorings, this function has only one caller left, so it doesn't pull its weight anymore. Task-number: QTBUG-123544 Change-Id: I93a296a9be81ef9c3b702065e76ecc4b822a0a43 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
51e0a33a54
commit
e061491209
|
|
@ -249,24 +249,17 @@ void QSignalSpy::init(ObjectSignal os)
|
|||
if (!os.obj)
|
||||
return;
|
||||
|
||||
if (!connectToSignal(os.obj, os.sig.methodIndex()))
|
||||
const auto signalIndex = os.sig.methodIndex();
|
||||
const auto slotIndex = QObject::staticMetaObject.methodCount();
|
||||
if (!QMetaObject::connect(os.obj, signalIndex,
|
||||
this, slotIndex, Qt::DirectConnection)) {
|
||||
qWarning("QSignalSpy: QMetaObject::connect returned false. Unable to connect.");
|
||||
return;
|
||||
}
|
||||
|
||||
sig = os.sig.methodSignature();
|
||||
}
|
||||
|
||||
bool QSignalSpy::connectToSignal(const QObject *sender, int sigIndex)
|
||||
{
|
||||
static const int memberOffset = QObject::staticMetaObject.methodCount();
|
||||
const bool connected = QMetaObject::connect(
|
||||
sender, sigIndex, this, memberOffset, Qt::DirectConnection, nullptr);
|
||||
|
||||
if (!connected)
|
||||
qWarning("QSignalSpy: QMetaObject::connect returned false. Unable to connect.");
|
||||
|
||||
return connected;
|
||||
}
|
||||
|
||||
void QSignalSpy::appendArgs(void **a)
|
||||
{
|
||||
QList<QVariant> list;
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ private:
|
|||
Q_TESTLIB_EXPORT static ObjectSignal verify(const QObject *obj, QMetaMethod signal);
|
||||
Q_TESTLIB_EXPORT static ObjectSignal verify(const QObject *obj, const char *aSignal);
|
||||
|
||||
bool connectToSignal(const QObject *sender, int sigIndex);
|
||||
|
||||
Q_TESTLIB_EXPORT static QList<int> makeArgs(const QMetaMethod &member, const QObject *obj);
|
||||
Q_TESTLIB_EXPORT void appendArgs(void **a);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue