Ensure the QMenu is polished before creating the native window

Call ::ensurePolished from QMenu::exec before the native window gets
created. This ensures that the style handles the menu before its too
late. E.g. a style which wants to create RGBA menus needs to add the
appropriate flag before the native window gets created. Without this
change the style cannot change to RGBA as the native window has already
been created and changing the format used by QWindow is not possible
after QWindow::create was called.

Change-Id: Ic861037a438b4cb74c59a00be0ef2d633db538ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Martin Gräßlin 2014-04-28 09:42:10 +02:00 committed by The Qt Project
parent e0e86d5651
commit df3720527d

View File

@ -2177,6 +2177,7 @@ QAction *QMenu::exec()
QAction *QMenu::exec(const QPoint &p, QAction *action)
{
Q_D(QMenu);
ensurePolished();
createWinId();
QEventLoop eventLoop;
d->eventLoop = &eventLoop;