connect problem!!! QObject::connect: Cannot queue arguments of type "myStruct" (Make sure 'myStruct' is registered using qRegisterMetaType(). )
-
connect problem!!! QObject::connect: Cannot queue arguments of type "myStruct" (Make sure 'myStruct' is registered using qRegisterMetaType(). )
-
we need the actual code also :)
-
-
so even this 'myInt' need register?
typedef int myInt;
connect(this, SIGNAL(xxx(myInt), this, SLOT(myInt))); -
To be honest I don't know about typedef'ed basic types. A workaround which I like to use is to send pointers instead of instances (when applicable). You don't need to register the type as long as you're using pointers in your signals / slots.
-
Hi,
Yes, even for myInt. myInt is unknown to the Qt MetaObject system.
@JohanSolo beware when passing pointers especially if it's a multithreaded environment. You have to handle carefully the lifetime of your objects.
-
@SGaist said:
@JohanSolo beware when passing pointers especially if it's a multithreaded environment. You have to handle carefully the lifetime of your objects.
Yeah, actually I've been bitten recently by this... That's why I said `(when applicable)', I should have put more emphasise on potential problems. Thank you for the warning!
-
so if i use 'myInt*' as signal and slot 's param. so i need not register, right?
-
Just don't do that, it's a base type. Register it and keep your code clean.
-
This post is deleted! -
and why Qt need register myInt? it's just simply int: typedef int myInt;
-
Again: myInt is an unknown type to the Qt Meta Object system
-
@SGaist but i found that my code works fine when i use 'myStruct*', and even 'myInt' as signal&slot param.