QMenu: Do not unnecessarily call QPlatformMenu::menuItemForTag()
When handling QActionEvent / ActionAdded, QActionEvent::before() is 0 for the common 'append' case. Do not try to find a QPlatformMenuItem for this. Change-Id: I535b675fda6a2812b61eb8d7eec01da378ece413 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
392294936e
commit
e94e4d002e
@ -3456,7 +3456,9 @@ void QMenu::actionEvent(QActionEvent *e)
|
||||
QObject::connect(menuItem, SIGNAL(activated()), e->action(), SLOT(trigger()));
|
||||
QObject::connect(menuItem, SIGNAL(hovered()), e->action(), SIGNAL(hovered()));
|
||||
copyActionToPlatformItem(e->action(), menuItem, d->platformMenu);
|
||||
QPlatformMenuItem* beforeItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->before()));
|
||||
QPlatformMenuItem *beforeItem = e->before()
|
||||
? d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->before()))
|
||||
: nullptr;
|
||||
d->platformMenu->insertMenuItem(menuItem, beforeItem);
|
||||
} else if (e->type() == QEvent::ActionRemoved) {
|
||||
QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user