QMenu: Update menu action sizes if popup is (not)caused from menu bar

Menu width differs if it contains key shortcuts or not.

Amends 6634c424f8

Task-number: QTBUG-49435
Task-number: QTBUG-61181
Task-number: QTBUG-64449
Change-Id: I8c479af550128069ca91dd089dfc7bd8c24c66ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Błażej Szczygieł 2017-11-12 18:54:04 +01:00 committed by Liang Qi
parent 7416fc5e80
commit c8a5f331c8
2 changed files with 8 additions and 0 deletions

View File

@ -2339,6 +2339,12 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
d->updateLayoutDirection();
d->adjustMenuScreen(p);
const bool contextMenu = d->isContextMenu();
if (d->lastContextMenu != contextMenu) {
d->itemsDirty = true;
d->lastContextMenu = contextMenu;
}
#if QT_CONFIG(menubar)
// if this menu is part of a chain attached to a QMenuBar, set the
// _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type

View File

@ -272,6 +272,7 @@ public:
QMenuPrivate() :
itemsDirty(false),
hasCheckableItems(false),
lastContextMenu(false),
collapsibleSeparators(true),
toolTipsVisible(false),
delayedPopupGuard(false),
@ -464,6 +465,7 @@ public:
mutable bool itemsDirty : 1;
mutable bool hasCheckableItems : 1;
bool lastContextMenu : 1;
bool collapsibleSeparators : 1;
bool toolTipsVisible : 1;
bool delayedPopupGuard : 1;