From a4bd4565ccd351f979507f1af3d90c61845c532c Mon Sep 17 00:00:00 2001 From: Massimiliano Gubinelli Date: Tue, 14 May 2019 14:16:28 +0200 Subject: Emit QMenu::aboutToShow() before platform specific code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/widgets/widgets/qmenu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index a44f0fb8a7..a8cca2ae3a 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -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) -- cgit v1.2.3