'PySide6/PyQt5: Create button with aditional dropdown menu [duplicate]

In my application, I don't want to clutter the screen with too many buttons, so I want to add multiple actions to one button. Even thought I could accomplish it through things like double clicking or modifier keys, those solutions are in no way intuitive for the user. I want to have a button that has an additional dropdown menu, which can be used to change the action of the button. To illustrate, here is a rough sketch of what that would look like:

created in paint, the ui designers best friend

Is this possible PyQt5 or PySide6? Thank you for your help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source