Results 1 to 1 of 1

Thread: QObject::connect error with simple typedef types

  1. #1
    Join Date
    Feb 2006
    Location
    US
    Posts
    173
    Thanks
    16
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default QObject::connect error with simple typedef types

    I can't get a simple typedef type to work correctly with signals/slots.

    Here's the Qt error message:

    QObject::connect: Cannot queue arguments of type 'tKey'
    (Make sure 'tKey' is registered using qRegisterMetaType().)

    BTW, the reason I want to use a typedef is to be able to change the type in the future. I don't want the emitter of the signal to be tied to a specific type.

    I tried adding/removing Q_DECLARE_METATYPE(tKey) and qRegisterMetaType<tKey>(), but the problem persists.

    I even tried using a #define for tKey, but again the problem persists.

    Qt Code:
    1. typedef unsigned int tKey;
    2. Q_DECLARE_METATYPE(tKey);
    3. qRegisterMetaType<tKey>()
    4.  
    5. //...
    6.  
    7. QObject::connect(&sndr, SIGNAL(foo(tKey)),
    8. &rcvr), SLOT(foo(tKey)));
    To copy to clipboard, switch view to plain text mode 
    Last edited by brcain; 19th April 2010 at 21:03. Reason: updated contents

Similar Threads

  1. Compiler error when calling QObject::connect. What am I missing?
    By themanwiththequestion in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2010, 15:33
  2. Simple QObject::connect question
    By Bryku in forum Newbie
    Replies: 2
    Last Post: 8th January 2010, 13:09
  3. Replies: 4
    Last Post: 10th December 2009, 17:37
  4. QScriptValue with simple typedef types
    By JohannesMunk in forum Newbie
    Replies: 9
    Last Post: 14th May 2009, 16:07
  5. Error Comes in connet the signal and slot.
    By ashishsaryar in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2008, 23:15

Tags for this Thread

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.