Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
New to Qt Creator..question about custom slot code generation
phyrexian last edited by
So I've been experimenting with Qt Creator, and started with created a dialog based application. Switched to designer mode, added a push button. Switched to signal/slot editor, and connected the signal clicked() to a custom slot called CustomButtonHandler(). I'm used to other IDEs filling in some declaration/definition (skeleton) code for me. Is it normal that Qt creator does not add "CustomButtonHandler()" to the slot section of the Dialog class declaration, and by the same token, not create the definition of the method in the cpp file? Is this meant to be all done manually?
It does not do that. You need to add your custom slot code to dialog class.
gyll last edited by
You basically have two types of signals/slots that can be automatically added by creator to your code:
- buttons, widgets, etc: place the button/widget/etc on your form, right-click your button/widget/etc, select "Got to slot...", then select the action you want to implement. Once you selected an action the signal/slot code is automatically inserted to your code
- Menu items: Add the menu item you want to your window, and at the bottom of Creator's Design mode screen select the "Action Editor" tab. You will now see your menu item listed in the list of actions, right click the action and select "Go to slot...". Again, Creator will automatically insert the code template for that action in your code