PDA

View Full Version : Auto connect slots(Without parent relationship)



darkjavi
24th December 2012, 17:26
Hello everyone! :)
I've been looking for a way of auto-connecting signals, found QMetaObject::connectSlotsByName() , which relies/assumes that you want to connect child's signals to his parent's slots.
I'm wondering if there is a way to do it against any (Q)object, something like:

this->connectSlotsByName(obj);

Expecting 'obj signals' to be connected to 'this slots' matching the on_obj_signal() pattern.
Any ideas will be appeciated :)

wysota
24th December 2012, 17:31
You can write a foreach loop that will do it.