A
A
AlexSer2020-01-20 10:37:43
Qt
AlexSer, 2020-01-20 10:37:43

How to block action in menu in QT?

Hello!!!
Tell me how to block the action in the item in the menu? I know direct blocking
ui->actionMyaction->setEnabled(false);
, but I have a connection with the slot and inside this slot it is necessary to make the menu item inactive.
через QObject::sender()->objectName();
I get the name action and then how to refer specifically to the action that sent the signal is not clear

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2020-01-20
@vt4a2h

if (auto action = qobject_cast<QAction*>(sender())) {}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question