send own class reference throught signal
Hi,
I have a own class that I need to emit using a signal. The problem is:
Code:
class classA
classA::classA()
{
}
public slots:
void aSlot(myClass&);
class classB: public classA
classB::classB()
{
bool bC = connect(pClassC,SIGNAL(aSignal(myClass&)),this,SLOT(aSlot(myClass&));
//This returns me "true"
};
classC* pClassC;
classA is a base Class. Has the slot to be called.
classB is derived from classA. Conects the classC signal with parent slot.
classC is a class that do something and emits a signal.
I had this working by passing the objects as value, but now, passing them by reference, the slot is not called.
Any idea what is happening?
Thanks,
Re: send own class reference throught signal
Hi,
I'm getting this:
Code:
Make sure 'myClass&' is registered using qRegisterMetaType().)
When I try to register it I'm getting this error when compiling:
Code:
c:\Qt\4.3.0\src\corelib\kernel\qmetatype.h(104): error C2558: class 'myClass' : no hay un constructor de copias disponible o éste se declaró como 'explicit'
in english maybe something like this:
c:\Qt\4.3.0\src\corelib\kernel\qmetatype.h(104): error C2558: class 'myClass' : there is not a copy constructor or this have been declared as 'explicit'
Thanks,
Re: send own class reference throught signal
Are you sure you don't want to pass it as const reference?
Re: send own class reference throught signal
Hi,
I just added "const" to copy constructor and it works.
Quote:
Are you sure you don't want to pass it as const reference?
How to do this and what is the difference?
Thanks,