You connect signals and slots to instances, not classes.
You need the address of both the recipient and the emitter objects to connect them.
connect(button, SIGNAL(clicked()),
pointer_to_instance_of_head, SLOT(change_number()));
(assuming that "button" is a pointer).
Getting this pointer is another question, but if you have no good reason for doing this, I suggest creating a head object in the constructor QWidgetthat you are retrieving.
source
share