How to use QWigdetAction
-
I create a QWidgetAction and use addMenu to bind the submenu with it,but it can not show the submenu when I move my mouse on the QWidgetAction。I debug the source code found that it seems to fail to call the setCurrentAction function on the mouseMoveEvent,but if I use QAction, it work well。 So How should I solve this problem?
-
Hi and welcome to devnet,
Which version of Qt ?
On which OS ?
If Linux, which desktop environment ?
Please provide a minimal compilable example that shows the behaviour. -
@SGaist
the platform is win10. Here is simple code.QMenu* topMenu = new QMenu; QWidgetAction* pAct = new QWidgetAct; QWidget* widget = new QWidget; pAct->setDefaultWidget(widget); QMenu* subMenu = new QMenu; pAct->setMenu(subMenu); topMenu->addMenu(subMenu);
when I move my mouse on the pAct, it can not show the submenu.
-
@SGaist
the platform is win10. Here is simple code.QMenu* topMenu = new QMenu; QWidgetAction* pAct = new QWidgetAct; QWidget* widget = new QWidget; pAct->setDefaultWidget(widget); QMenu* subMenu = new QMenu; pAct->setMenu(subMenu); topMenu->addMenu(subMenu);
when I move my mouse on the pAct, it can not show the submenu.
@Depositc29 please make it complete that way it ensures that we are all working with the same code.