[Solved] What is the signature of a function used as SLOT
I was wondering what signature (type of the parameter theSlot) must be used for function that will be used as a slot:
I know that connect actually gets the slot as a simple const char* but the following example does not work and the compiler reports theSlot as an unreferenced parameter:
- {
- connect(aAction, SIGNAL(triggered()), this, SLOT(theSlot));
- theMenu->addAction(aAction);
- }
- {
- addMenuItem(theMenu, "Open file...", "slot_open_file()");
- }
4 replies
You can read more about it here [doc.qt.nokia.com]
I played around a little and actually the const char* parameter type and the use of SLOT was OK but I used slot on the wrong argument.
The following example does work as expected:
- {
- connect(aAction, SIGNAL(triggered()), this, theSlot);
- theMenu->addAction(aAction);
- }
- {
- addMenuItem(theMenu, "Open file...", SLOT(slot_open_file()));
- }
You must log in to post a reply. Not a member yet? Register here!






