How to connect menu click with action in Qt Creator?

Nathan Osman picture Nathan Osman · Apr 28, 2010 · Viewed 64.6k times · Source

I am completely new to Qt.

I started with a new Qt4 GUI Application.

Using the designer, I have created a menu like so:

File
 - Exit

How do I get an action associated with the menu item?

I found something called the 'Signals and slots editor' but have no idea how to use it.

Answer

Isawpalmetto picture Isawpalmetto · Apr 28, 2010

Click on the green plus sign after you selected the signals Slots Editor. It will give you 4 fields to fill in. For sender you select what is creating the signal. For example ActionExit might be the name you created for the exit menu item. The signal is probably going to be clicked(). The receiver is usually the class that you created that has all of your methods. The slot is the method you created in that class that you want to execute. For example:

actionExit clicked() <nameOfClass> exitGame()

Hope this helps.