QObject::connect: Cannot queue arguments of type
2013-06-13 18:04
726 查看
问题:
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
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
相关文章推荐
- Qt - 错误总结 - QObject::connect: Cannot queue arguments of type 'PVCI_CAN_OBJ' (Make sure 'PVCI_CAN_OBJ' is registe
- QObject::connect: Cannot queue arguments of type "xxx",(Make sure "xxx" is registed using qRegisterM
- QObject::connect: Cannot queue arguments of type 'string'
- QObject::connect: Cannot queue arguments of type 'XXX'
- QObject::connect: Cannot queue arguments of type 'cv::Mat'
- 信号槽传递非Qt库类型参数时,出现QObject::connect: Cannot queue arguments of type 'QUuid'(Make sure 'string' is regi
- [Qt]QObject::connect: Cannot queue arguments of type 'QString&'
- Qt: QObject::connect: Cannot queue arguments of type 'XXX'
- QObject::connect: Cannot queue arguments of type 'QList<QMap<QString,QString> >'
- 关于QObject::connect: Cannot queue arguments of type"..."
- Qt:QtQuick Cannot queue arguments of type 'QQmlChangeSet'
- Gradle sync failed: Cannot locate factory for objects of type DefaultGradleConnect
- uploadify的JS组件报错:Uncaught TypeError: Cannot read property 'queueData' of undefined
- uploadify 报错jquery.uploadify.min.js:16 Uncaught TypeError: Cannot read property 'queueData' of undef
- cannot pass non-trivial object of type 'string' to variadic function
- Spring-aop: Error Cannot convert value of type [$Proxy...] to required type
- SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 解决办法
- 【问题】Cannot find any information on property 'userPhone' in a bean of type 'Bean'.
- Cannot create JDBC driver of class '' for connect URL 'null'
- Value of type java.lang.String cannot be converted to JSONObject