How to extract thr list of actions associated with an Action having popup menu
Hello all,
I have an Action..it has popup menu associated. I want to extract list of actions in that popup menu. I tried like this :
Let " action " has popup menu.
QMenu *menu = action->menu();
QList<QAction *> list = menu->actions();
But the problem is ... list.count() is returning ZERO ( 0 ) although action has popup menu.
Can you help me...
Thank you in advance.
Re: How to extract thr list of actions associated with an Action having popup menu
Quote:
Originally Posted by
siva prasanna
Hello all,
I have an Action..it has popup menu associated. I want to extract list of actions in that popup menu. I tried like this :
Let " action " has popup menu.
QMenu *menu = action->menu();
QList<QAction *> list = menu->actions();
But the problem is ... list.count() is returning ZERO ( 0 ) although action has popup menu.
The Qt docs says, that returned list could be empty.
Quote:
QList<QAction *> QWidget::actions () const
Returns the (possibly empty) list of this widget's actions.
Re: How to extract thr list of actions associated with an Action having popup menu
So I have to create one Widget and I have to setMenu for that widget.
then I have to extract the actions() right?
QMenu *menu = actions->menu();
QToolButton *tool = new QToolButton;
tool->setMenu(menu);
QList<QAction *> list = tool->actions();
is this correct way . . .. ??