hi.

i'm using qt 4.2.x on visual studio + winxp and maybe it sound silly, but the following problem irritates me a little bit:

there is a qthread class, which tires to get new images from a device. the device has a "grab timeout". if a timeout occurs, an exception is thrown. if a new image could be grabbed, a signal should be emitted, transfering the new image to the calling (main/parent) thread for processing/displaying or what ever.

i tried like this...

the threads run method:
Qt Code:
  1. void getimg_thread::run()
  2. {
  3. while(!quitthread)
  4. {
  5. try
  6. {
  7. grab_image(&img);
  8. emit newimg(img);
  9. msleep(1);
  10. }
  11. catch(AException &ex)
  12. {
  13. }
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 

the defined signal:
Qt Code:
  1. signals:
  2. void newimg(imageobject);
To copy to clipboard, switch view to plain text mode 

the slot to receive and process the emitted signal:
Qt Code:
  1. private slots:
  2. void newimage_received(imageobject nimg);
To copy to clipboard, switch view to plain text mode 

and finally the connect part:
Qt Code:
  1. connect(grabimg, SIGNAL(newimg(imageobject)), this, SLOT(newimage_received(imageobject)));
To copy to clipboard, switch view to plain text mode 

but my headache starts here: the connect does not work somehow, my slot is never called. i tried many things, but without any luck.

it somehow just worked as i emitted an "int". then my slot was called properly. i also tried to emit a signal with a QList<int>, which is also working, e.g.:
Qt Code:
  1. ...
  2. signals:
  3. void newimg(const QList<int>*);
  4. ...
  5. QList<int> *a = new QList<int>;
  6. a->append(1);
  7. emit newimg(a);
  8. ...
  9. private slots:
  10. void newimage_received(QList<int> *nimg);
  11. ...
  12. connect(grabimg, SIGNAL(newimg(QList<int> *)), this, SLOT(newimage_received(QList<int> *)));
  13. ...
To copy to clipboard, switch view to plain text mode 

but if i'm using my imageobject class (which is not a qt object), it won't work:
Qt Code:
  1. ...
  2. signals:
  3. void newimg(QList<imageobject>*);
  4. ...
  5. QList<imageobject> *a = new QList<imageobject>;
  6. a->append(img);
  7. emit newimg(a);
  8. ...
  9. private slots:
  10. void newimage_received(QList<imageobject> *nimg);
  11. ...
  12. connect(grabimg, SIGNAL(newimg(QList<imageobject>*)), this, SLOT(newimage_received(QList<imageObject>*)));
  13. ...
To copy to clipboard, switch view to plain text mode 

i'm confused. why is QList<int> working and QList<imageobject> not? i mean, an emitted signal is able to transfer any object i define or not!? any ideas? help :|

regards,

criss