Results 1 to 4 of 4

Thread: Cannot queue...

  1. #1
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Cannot queue...

    Hello,I'm writing a multithread application.
    I have an object that I have to pass in a slot between two threads.
    I have registered the object:
    Qt Code:
    1. qRegisterMetaType<ExchangeAction>("ExchangeAction");
    To copy to clipboard, switch view to plain text mode 

    And I'd like to pass the object as a reference (ExchangeAction&) but I got the error that is not possible to queue it. Why?

    thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot queue...

    What does ExchangeAction look like? You probably need to provide methods to serialise and deserialise it to be able to queue it.

    EDIT:

    Any class or struct that has a public constructor, a public copy constructor, and a public destructor can be registered.
    Does ExchangeAction have all those?

    You could also take a look at void qRegisterMetaTypeStreamOperators ( const char * typeName ).
    Last edited by wysota; 9th May 2006 at 14:20.

  3. #3
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot queue...

    Quote Originally Posted by wysota
    What does ExchangeAction look like? You probably need to provide methods to serialise and deserialise it to be able to queue it.

    EDIT:

    Any class or struct that has a public constructor, a public copy constructor, and a public destructor can be registered.

    Does ExchangeAction have all those?
    Hi,thank for your reply.
    The class is a very simple class and it has what is needed. In fact I CAN register it.
    I can pass a ExchangeAction in a slot but not an ExchangeAction&.

    Quote Originally Posted by wysota
    You could also take a look at void qRegisterMetaTypeStreamOperators ( const char * typeName ).
    Thanks but I don't need it.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot queue...

    Quote Originally Posted by vratojr
    I can pass a ExchangeAction in a slot but not an ExchangeAction&
    I don't think it's possible to queue a reference. If you need to modify that object in a slot, try sending a pointer.

Similar Threads

  1. phonon queue problem
    By Lykurg in forum Qt Programming
    Replies: 1
    Last Post: 25th December 2008, 14:20
  2. QThread, canceling queue on a connection.
    By kghose in forum Qt Programming
    Replies: 11
    Last Post: 29th July 2008, 22:43
  3. Qt event queue overloading?
    By gct in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2008, 18:39
  4. Event Queue Question
    By TheGrimace in forum Qt Programming
    Replies: 10
    Last Post: 5th October 2007, 16:55
  5. Replies: 6
    Last Post: 21st September 2007, 13:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.