Ignore: I think what he means is, he has a custom slot in his class, but that custom slot is not showing up in the "<slots>" drop-down when he clicks "Add". I agree, and can confirm that my custom slots (public or protected) do not show up in that drop-down. The only slots listed are those inherited from QMainWindow and QObject. I've tested this in both Windows and Linux. Maybe I'm using it wrong? It's just really frustrating because when you perform a clean, it also wipes out any connect() statements you added manually in ui_whatever.h. 
EDIT:
To add a custom slot for a button:- Switch to signal/slot edit mode (F4).
- Click and drag on the button to initiate the signal/slot editor.
- In the left pane, select your "clicked()"/"triggered()"/whatever signal.
- Below the right pane, click the "edit" button.
- Below the top pane, click the "Add" button, and enter the call for your custom slot.
- Click OK, and your custom slot should now be in the right pane.
- Select your custom slot, click OK, and build your project.
After you do this, the slot will show up in the <slots> drop-down, but since a signal/slot connection is created for you at this point, you'll only need to utilize it from the drop-down if you use it with another signal.
Ignore: Unfortunately, this doesn't work for menus, since the signals/slots edit mode wants to attach to the menu bar, rather than the menu items. If anyone has a workaround for this, I'd greatly appreciate it...
EDIT:
There is an easy trick to getting Creator to automatically connect signals to your custom slots, regardless of what they are: You have to name the slot function appropriately.
You have to name them using the format "on_<sender object name>_<signal>". For example, if you have a button named "calculateButton", and you want to launch your calculate function via the "clicked()" signal, you must name your function: "on_calculateButton_clicked".
void on_calculateButton_clicked();
void on_calculateButton_clicked();
To copy to clipboard, switch view to plain text mode
Note that if you're hand-coding everything, this doesn't matter, you can name your slots and functions whatever you want. But to make it easier when working in Creator, using this naming convention for slots makes it less of a headache.
Bookmarks