QObject::connect: Cannot queue arguments of type
来源:互联网 发布:java jar包下载地址 编辑:程序博客网 时间:2024/06/07 04:09
问题:
Hi!
I have a small problem concerning two threads and signals/slots connected between them.
My connect looks like this.
- ...
- qRegisterMetaType<QVector<QVector<int> > >("MyArray");
- ...
- connect(sender, SIGNAL(dataChanged(QVector<QVector<int> >)),receiver, SLOT(hasDataChanged(QVector<QVector<int> >)));
If the signal is being emitted, I get this error:
- QObject::connect: Cannot queue arguments of type'QVector<QVector<int> >'
- (Make sure 'QVector<QVector<int> >' is registered usingqRegisterMetaType().)
Also note that I have my sig/slots with a reference, but if I used a connect like this:
- connect(sender, SIGNAL(dataChanged(QVector<QVector<int> >&)),receiver, SLOT(hasDataChanged(QVector<QVector<int> >&)));
I’m getting this:
Object::connect: No such signal dataChanged(QVector<QVector<int> >&)
Sender
- signals:
- void dataChanged(const QVector<QVector<int> > &data);
Receiver
- public slots:
- void hasDataChanged(const QVector<QVector<int> > &data);
How can I achieve a connection, do I need to put Q_DECLARE_METATYPE somewhere?
Thanks for your help!
解决方法:
- typedef QVector<QVector<int> > MyArray;
- // ...
- qRegisterMetaType<MyArray>("MyArray");
- // ...
- connect(
- this, SIGNAL(blurbDone2(MyArray)),
- this, SLOT(slotBlurb2(MyArray)),
- Qt::QueuedConnection);
- // with this signatures:
- signals:
- void blurbDone2(const MyArray &bb);
- protected slots:
- void slotBlurb2(const MyArray &bb);
转自:http://qt-project.org/forums/viewthread/2884
- QObject::connect: Cannot queue arguments of type
- [Qt]QObject::connect: Cannot queue arguments of type 'QString&'
- 关于QObject::connect: Cannot queue arguments of type"..."
- 关于QObject::connect: Cannot queue arguments of type"..."
- QObject::connect: Cannot queue arguments of type 'XXX'
- Qt: QObject::connect: Cannot queue arguments of type 'XXX'
- QObject::connect: Cannot queue arguments of type 'cv::Mat'
- QObject::connect: Cannot queue arguments of type 'string'
- QObject::connect: Cannot queue arguments of type 'QList<QMap<QString,QString> >'
- QObject::connect: Cannot queue arguments of type "xxx",(Make sure "xxx" is registed using qRegisterM
- 信号槽传递非Qt库类型参数时,出现QObject::connect: Cannot queue arguments of type 'QUuid'(Make sure 'string' is regi
- Qt:QtQuick Cannot queue arguments of type 'QQmlChangeSet'
- Cannot infer type arguments for PageImpl<>
- QT信槽编程,QObject::connect: Cannot connect (null)报错的两种成因
- QObject::connect 出错
- cannot assign value of type
- Error: non-generic cannot be used with type arguments
- How Java handles arguments of a class type.
- hadoop运行第三方jar
- NC57切换到卡片界面
- Android 4.0.3 API
- android搭建环境错误 daemon not running. starting it now on port 5037 ADB server didn't ACK
- vs2005定制运行wince6.0模拟器
- QObject::connect: Cannot queue arguments of type
- Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name
- C++中的Win32 Application和Win32 Console Application区别
- 用visio画UML类图
- IOS开发列表显示视图及数据流程(简化版)
- 何茂春:论大国之“大”(1)
- android binder 中的proxy 模式
- 可视化日志分析工具 glTail
- Repository模式