Ensure that QMenu is polished before setting the screen in popup()
Some styles alter the widget that will influence the underlying platform window. An example is when a style would want to draw the menu with some transparency and sets the Qt::WA_TranslucentBackground attribute. This needs to happen before the platform window is created. However calling QWidgetPrivate::setScreen will end up creating the window and the surface format will be fixed at this point. Pick-to: 5.15 Change-Id: I707cf1de5c1614382cffbea1aae8cdb01f7de44a Reviewed-by: Nate Graham Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
4e7013033f
commit
36b1d37cef
@ -2373,6 +2373,8 @@ void QMenuPrivate::popup(const QPoint &p, QAction *atAction, PositionFunction po
|
||||
doChildEffects = true;
|
||||
updateLayoutDirection();
|
||||
|
||||
q->ensurePolished(); // Get the right font
|
||||
|
||||
// Ensure that we get correct sizeHints by placing this window on the correct screen.
|
||||
// However if the QMenu was constructed with a Qt::Desktop widget as its parent,
|
||||
// then initialScreenIndex was set, so we should respect that for the lifetime of this menu.
|
||||
@ -2407,7 +2409,6 @@ void QMenuPrivate::popup(const QPoint &p, QAction *atAction, PositionFunction po
|
||||
q->setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(topCausedWidget()) != nullptr);
|
||||
#endif
|
||||
|
||||
q->ensurePolished(); // Get the right font
|
||||
emit q->aboutToShow();
|
||||
const bool actionListChanged = itemsDirty;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user