How to get selected item in pyqt Qmenu

Is there a way to get the selected item in qmenu?
I want to bind all the elements in this list to one function and get the element as soon as the user clicks on it. I was looking for a way to get the label or index of an item in 3 days, but couldn't find it. any ideas?

early

+3
source share
1 answer

You can achieve this with signals.

Connect all the triggeredslots of your menu items to your function. Then, in this function, use the static function QObject::senderto get the menu item that sent the signal.

+3
source

Source: https://habr.com/ru/post/1747952/


All Articles