Accessing slots of other classes
Sorry if this is a newbie question: I've searched the forum and googled, but could not find any informations about it.
I have a project organized in 3 c++ (plus headers):
- main.cpp
- child1.cpp
- child2.cpp
I was wondering if there is a way, for widgets in child1.cpp, to connect access slots in child2.cpp
Thanks
Re: Accessing slots of other classes
You need to create objects and then connect the objects.
You can not connect classes directly.
example:
Code:
MyClass1 objectOfTypeMyClass1;
MyClass2 *pointerToAnObjectOfMyClass2 = new MyClass2;
connect(&objectOfTypeMyClass1, SIGNAL(someSignal()), pointerToAnObjectOfMyClass2, SLOT(someSlot()));