Hi everybody,
if you have a QMenuBar and you want a QMenu to popup without worrying about its position, you can write this code, assuming mb as a QMenuBar:
mb->setActiveAction(mb->actions()[0]);
mb->actions()[0]->menu()->setActiveAction(mb->actions()[0]->menu()->actions()[0]);
mb->setActiveAction(mb->actions()[0]);
mb->actions()[0]->menu()->setActiveAction(mb->actions()[0]->menu()->actions()[0]);
To copy to clipboard, switch view to plain text mode
the first statemet makes the QMenu popup and the second one makes the first QAction be selected.
But if you want to close the opened QMenu, what would you do ?
mb->actions()[0]->menu()->setActiveAction(0);
mb->actions()[0]->menu()->setActiveAction(0);
To copy to clipboard, switch view to plain text mode
works properly because it removes the selection on the first QAction of the QMenu
but
doesn't work because the QMenu remains opened.
What would you do to make it disappear ?
Thanks
Placido.
Bookmarks