Active Topics

 


Reply
Thread Tools
Posts: 225 | Thanked: 64 times | Joined on Feb 2010
#1
I have a worker thread that generates a QList of MyObjects, and when it is done, it notifies that they are available to any interested listener:

Code:
signals:
    void objsAvailable(QList<MyObject> &objs);
I made a slot to be notified:

Code:
private slots:
    void processObjects(QList<MyObject> &objs);
and here's how I connect:

Code:
ObjMakerThread *thread = 
  new ObjMakerThread(blahParam, this);
connect(
  thread, 
  SIGNAL(objsAvailable(QList<MyObject>&)), 
  this, 
  SLOT(processObjs(QList<MyObject&>&))
);
thread->start();
Now, MyObject was not declared as a metatype, which is what I thought the folling error meant:

QObject::connect: Cannot queue arguments of type 'QList<MyObj>&'
(Make sure 'QList<Mail>&' is registered using qRegisterMetaType().)

So I added
Q_DECLARE_METATYPE()
to the myobject.h

and I called qRegisterMetaType<MyObject>("MyObject"); in main()

But still no dice.. Any clues?
Thanks guys

(note that I can pass a pointer to the QList around, but I was hoping not to)

Last edited by cjard; 2010-03-12 at 11:35.
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:46.