如何foreach
在 a 上使用循环QSignalSpy
?
这就是我想要做的:
foreach( const QList<QVariant> &args, mySignalSpy )
{
Q_ASSERT( args.count() == 2 );
QVariant arg0 = args[0];
QVariant arg1 = args[1];
doSomething( arg0, arg1 );
}
这是我得到的错误:
/usr/local/Trolltech/Qt-4.8.2-shared/include/QtTest/qsignalspy.h: In instantiation of ‘QForeachContainer<T>::QForeachContainer(const T&) [with T = QSignalSpy]’:
MyTester.cxx:843:64: required from here
/usr/local/Trolltech/Qt-4.8.2-shared/include/QtCore/qobject.h:333:5: error: ‘QObject::QObject(const QObject&)’ is private