I just created a simple app using Qt and Qt Designer and added a QMenuBar with a menu.
How can I make it so certain code will be executed if a QAction Element is triggered?
You can use Qt Designer's Action Editor, where you can find all the actions you added to your form, and edit them.
In you case, you can do the following in your action editor:
triggered()
Here's an example: