Results 1 to 4 of 4

Thread: Queued connection fails on own class

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Queued connection fails on own class

    Hi,

    I'm getting this error on my application

    Qt Code:
    1. QObject::connect: Cannot queue arguments of type 'CModbusResponse&'
    2. (Make sure 'CModbusResponse&' is registered using qRegisterMetaType().)
    To copy to clipboard, switch view to plain text mode 

    CModbusResponse is a class that inherits from CModbusMessage. I have registered the classes with "qRegisterMetaType".
    The problem is that the connection returns true if "QtirectConnection" is used, but it returns false if "Qt::QueuedConnection" is used.

    The classes have their copy constructor.

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Queued connection fails on own class

    Are you sure you register the type before calling connect()? Also make sure you didn't try to connect non-const reference parameters.
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Queued connection fails on own class

    Hi,

    Quote Originally Posted by jpn View Post
    Are you sure you register the type before calling connect()? Also make sure you didn't try to connect non-const reference parameters.
    Yes, I do it in MainWindow constructor

    Quote Originally Posted by jpn View Post
    Also make sure you didn't try to connect non-const reference parameters
    I think that are non-const references. How have I to declare them const?

    Thanks,
    Òscar Llarch i Galán

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Queued connection fails on own class

    Quote Originally Posted by ^NyAw^ View Post
    I think that are non-const references. How have I to declare them const?
    Yes. Parameters of queued signals will be serialized. You cannot pass non-const references as queued signal parameters (nor should you do that with direct signals either).
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    ^NyAw^ (2nd December 2008)

Similar Threads

  1. class QHBoxLayout
    By csvivek in forum Installation and Deployment
    Replies: 2
    Last Post: 10th April 2008, 07:57
  2. Queued connection / Signal accumulation
    By pokey909 in forum Qt Programming
    Replies: 1
    Last Post: 18th March 2008, 19:42
  3. How to use Signal through direct connection
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2007, 07:07
  4. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 10:22
  5. queued signal/slot connection with QList<int>
    By smalls in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 14:32

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.