Connecting signal and slot by name
I am currently using this code to connect them by name and it actually works, is this the supported way of doing so?
Code:
int main(int argc, char *argv[])
{
b.show();
// connect
b.connect(&b, "2clicked()", &app, "1quit()");
// disconnect
b.disconnect(&app, "1quit()");
return app.exec();
}
The reason I am doing this is because I want to be able to save/load actions using xml file.
Re: Connecting signal and slot by name
SIGNAL and SLOT are macros which convert argument to string with prefix, so you just resolved those macros. It is recommended to use macros (easy to read and ease to maintain code, for example in Qt Creator code completion or renaming of method will work only with macro).