Momergil
19th February 2013, 12:39
Hello!
I want to do some non-basic signal-slot connections between a QThread and the MainWindow class and reading Qt's Assistant documentation I found that I need to use qRegisterMetaType() to register the data-container types in case I'm using non-standart types, and this is what I did:
struct analysis_results
{
POSITION share_id;
TYPE analysis_type;
PROBABILITY probability;
QString text;
};
qDebug() << QMetaType::isRegistered(qRegisterMetaType<THREAD>("THREAD_type"));
qDebug() << QMetaType::isRegistered(qRegisterMetaType<analysis_study>("analysis_study"));
qDebug() << QMetaType::isRegistered(qRegisterMetaType<analysis_results>("analysis_results"));
qDebug() << QMetaType::isRegistered(qRegisterMetaType< QList<analysis_results> >("analysis_results_list"));
connect(threadEstudo,SIGNAL(sinalTerminoCalculos(a nalysis_study,uchar,bool)),this,SLOT(slotAnaliseEs tudosTerminoCalculos(analysis_study,uchar,bool)));
connect(threadEstudo,SIGNAL(sinalMemoLog(QString)) ,this,SLOT(slotMemoLog(QString)));
connect(threadEstudo,SIGNAL(sinalPrimeiroEstudo()) ,this,SLOT(slotShowReviewWindowFirstTime()));
connect(threadEstudo,SIGNAL(sinalResultados(QList<analysis_results>)),this,SLOT(slotAvaliaResultadosEstudo(QList<analysis_results>)));
You may notice that I put the qDebug() so I can check if all metatypes were correctly registered, and the result was "true" for all of them.
The problem is that when I actually use the signal (sinalResultados(QList<analysis_results>)), the connection fails and I receive the debug message:
QObject::connect: Cannot queue arguments of type 'QList<analysis_results>'
(Make sure 'QList<analysis_results>' is registered using qRegisterMetaType().)
What could be the problem with this specific case? Why it returns true when I verify for the correct registration but actually it gives me errors?
Thanks,
Momergil
I want to do some non-basic signal-slot connections between a QThread and the MainWindow class and reading Qt's Assistant documentation I found that I need to use qRegisterMetaType() to register the data-container types in case I'm using non-standart types, and this is what I did:
struct analysis_results
{
POSITION share_id;
TYPE analysis_type;
PROBABILITY probability;
QString text;
};
qDebug() << QMetaType::isRegistered(qRegisterMetaType<THREAD>("THREAD_type"));
qDebug() << QMetaType::isRegistered(qRegisterMetaType<analysis_study>("analysis_study"));
qDebug() << QMetaType::isRegistered(qRegisterMetaType<analysis_results>("analysis_results"));
qDebug() << QMetaType::isRegistered(qRegisterMetaType< QList<analysis_results> >("analysis_results_list"));
connect(threadEstudo,SIGNAL(sinalTerminoCalculos(a nalysis_study,uchar,bool)),this,SLOT(slotAnaliseEs tudosTerminoCalculos(analysis_study,uchar,bool)));
connect(threadEstudo,SIGNAL(sinalMemoLog(QString)) ,this,SLOT(slotMemoLog(QString)));
connect(threadEstudo,SIGNAL(sinalPrimeiroEstudo()) ,this,SLOT(slotShowReviewWindowFirstTime()));
connect(threadEstudo,SIGNAL(sinalResultados(QList<analysis_results>)),this,SLOT(slotAvaliaResultadosEstudo(QList<analysis_results>)));
You may notice that I put the qDebug() so I can check if all metatypes were correctly registered, and the result was "true" for all of them.
The problem is that when I actually use the signal (sinalResultados(QList<analysis_results>)), the connection fails and I receive the debug message:
QObject::connect: Cannot queue arguments of type 'QList<analysis_results>'
(Make sure 'QList<analysis_results>' is registered using qRegisterMetaType().)
What could be the problem with this specific case? Why it returns true when I verify for the correct registration but actually it gives me errors?
Thanks,
Momergil