PDA

View Full Version : Signal not found / thread communication



ruehlchr
2nd November 2010, 02:52
Dear All,
I'm new to the forum nice to be here !

My nasty problem I fight with:
(thread 1 main) - (thread 2 worker)
worker read an external device and send QByteArray back to the main-thread.
Therefore I create a signal in the worker and slot in the main with a connect(&thread,..).

I test the signal/slot within the worker-thread to see if the emit works // yes fine
but the main thread give me a

Object::connect: No such signal worker::listItemUpdate(const QByteArray ba) in reader.cpp:25

any hint is highly appreciated.

Chris



class worker : public QThread
...
signals:
void listItemUpdate(const QByteArray& ba);


class main : public QMainWindow
...
private slots:
void RlistItemUpdate(const QByteArray ba);
...
private:
worker InvThread;

main::main()
...
connect(&InvThread, SIGNAL(listItemUpdate(const QByteArray ba))
, this , SLOT(RlistItemUpdate(const QByteArray ba)));

ChrisW67
2nd November 2010, 03:07
connect(&InvThread, SIGNAL(listItemUpdate(const QByteArray))
, this , SLOT(RlistItemUpdate(const QByteArray)));

Timoteo
2nd November 2010, 03:11
You're calling connect() with named parameters. This simply isn't right.

ruehlchr
2nd November 2010, 03:38
Thank guy's
It was a bit late last night!
you have the answer already here:

http://www.qtcentre.org/faq.php?faq=qt_signalslot#faq_qt_signalslot_nodebu g

Cheers
Chris

tbscope
2nd November 2010, 05:23
Are you sure you don't want to sent a const reference instead of a const bytearray?