Call a class from a different source file
void classone::classtwo(void) in the abc.cpp file
in def.cpp file, I want to connect the myaction with the classtwo.
What exactly I have to write?
thanks in advance.
In def.cpp file there is one line:
and the classtwo is a public slot.
If I write:
Object::connect: No such slot ...::classtwo(void) in ..def.cpp
I want it to search not in def.cpp but in abc.cpp
This is what I am asking. What I have to change.
what type is
myactionand what type is
But I think I have to find a way to call a function in another source file. Something I have to put instead of this.
it does not work.
you need a pointer to an instance of
classone. can you post the full content of abc.h, def.cpp and wherever you are calling connect from?
It is difficult to post all the code. But can you tell me more details about a pointer to an instance of classone? I think I have to do something like this.
Thanks. This is what I am talking about. In abc.h:
How can I call this public slot, not from abc.cpp, but from another .cpp file, for example from def.cpp?
To connect, you need two live objects.
So you need to create one. (at least )
somewhere in def.cpp
OtherClass * oc= new OtherClass(this);
connect(this (the def class), (def)signal, oc , theslot (in OtherClass ) )
and check you have
in the OtherClass
Thank you mrjj. This was exactly what I did want.