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:

Qt Code:
  1. struct analysis_results
  2. {
  3. POSITION share_id;
  4. TYPE analysis_type;
  5.  
  6. PROBABILITY probability;
  7. QString text;
  8. };
  9.  
  10.  
  11. qDebug() << QMetaType::isRegistered(qRegisterMetaType<THREAD>("THREAD_type"));
  12. qDebug() << QMetaType::isRegistered(qRegisterMetaType<analysis_study>("analysis_study"));
  13. qDebug() << QMetaType::isRegistered(qRegisterMetaType<analysis_results>("analysis_results"));
  14. qDebug() << QMetaType::isRegistered(qRegisterMetaType< QList<analysis_results> >("analysis_results_list"));
  15.  
  16.  
  17. connect(threadEstudo,SIGNAL(sinalTerminoCalculos(analysis_study,uchar,bool)),this,SLOT(slotAnaliseEstudosTerminoCalculos(analysis_study,uchar,bool)));
  18. connect(threadEstudo,SIGNAL(sinalMemoLog(QString)),this,SLOT(slotMemoLog(QString)));
  19. connect(threadEstudo,SIGNAL(sinalPrimeiroEstudo()),this,SLOT(slotShowReviewWindowFirstTime()));
  20. connect(threadEstudo,SIGNAL(sinalResultados(QList<analysis_results>)),this,SLOT(slotAvaliaResultadosEstudo(QList<analysis_results>)));
To copy to clipboard, switch view to plain text mode 

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