how to add menu dynamically in Qt
Posted
by Solitaire
on Stack Overflow
See other posts from Stack Overflow
or by Solitaire
Published on 2010-05-06T12:51:08Z
Indexed on
2010/05/06
13:18 UTC
Read the original article
Hit count: 210
Hi,
I want to add, submenu to a menu item dynamically. How can I achive this?
I tried like this, I have created an Action and submenu. Then I have added the submenu to action. But, I have connected the “triggered” signal of action. its getting crash if I click on the action..
I have also handled the “aboutToShow” signal of menu, same its also getting crash when I click on action..
Here is the sampe code.
Submenu = new QMenu(this);
connect(Submenu, SIGNAL( aboutToShow()), this, SLOT(move ()));
QAction *test = new QAction(tr("Selection"), this);
test ->setMenu(Submenu);
menubar()->addAction(test);
I want to get the notification, before the display of submenu..
© Stack Overflow or respective owner