PDA

View Full Version : the strange phenomenon: the emiited signal cannot be received by the slot function



zhaolewen
15th November 2014, 09:48
file1.cpp:

connect(this, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
BNC_CORE, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)));

connect(this, SIGNAL(newCorrLine(QString, QString, bncTime)),
BNC_CORE, SLOT(slotNewCorrLine(QString, QString, bncTime)));


file2.cpp:

void t_bncCore::slotNewCorrLine(QString line, QString staID, bncTime coTime) {

QMutexLocker locker(&_mutex);
………………… €¦â€¦â€¦â€¦â€¦â€¦â€¦
}

void t_bncCore::slotNewOrbCorrections(QList<t_orbCorr> orbCorrections) {
QMutexLocker locker(&_mutex);
………………… €¦â€¦â€¦â€¦â€¦â€¦â€¦â €¦â€¦â€¦â€¦â€¦â€¦
}

main.cpp

{
emit newCorrLine("ddd", _staID, _lastTime);
emit newOrbCorrections(orbCorrections);
}

the slot function slotNewCorrLine can be correctly called ,but the function slotNewOrbCorrections can not be called.
I am very confusing about the phenomenon.
Looking forward to your answer,Thank you very much.

wysota
15th November 2014, 13:00
Do you get any warnings in the console during runtime? Do your sender and receiver live in the same thread?

zhaolewen
15th November 2014, 15:06
according to you suggestions,I find:
1. the warnings : QObject::connect: Cannot queue arguments of type 'QList<t_orbCorr>'
2. the sender and receiver are not in the same thread

Added after 21 minutes:


Do you get any warnings in the console during runtime? Do your sender and receiver live in the same thread?

Thank you very much ,with your suggestions,I solve the problem by registering the type 'QList<t_orbCorr>'.