Emit QMenu::aboutToShow() before platform specific code

Send the aboutToShow() signal to QMenu before synchronising the
widgets for the menu items. This fixes a bug where if new
QWidgetActions are added to the menu from a slot triggered by the menu's
aboutToShow() signal, then such new actions do not shows up correctly on
Mac. Other platforms are not affected by the change.

Fixes: QTBUG-75826
Change-Id: Ic245d3fbc7ddde6944cca6cdb8e8951380c846ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Massimiliano Gubinelli 2019-05-14 14:16:28 +02:00 committed by Tor Arne Vestbø
parent 1f04b09446
commit a4bd4565cc
1 changed files with 2 additions and 2 deletions

View File

@ -1485,6 +1485,8 @@ void QMenuPrivate::_q_platformMenuAboutToShow()
{
Q_Q(QMenu);
emit q->aboutToShow();
#ifdef Q_OS_OSX
if (platformMenu) {
const auto actions = q->actions();
@ -1498,8 +1500,6 @@ void QMenuPrivate::_q_platformMenuAboutToShow()
}
}
#endif
emit q->aboutToShow();
}
bool QMenuPrivate::hasMouseMoved(const QPoint &globalPos)