summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBłażej Szczygieł <spaz16@wp.pl>2017-11-12 18:54:04 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-15 17:08:01 +0000
commitc8a5f331c8fdbf243ccb467f7bc3c9f62bd47c9f (patch)
treeae93e48e3f326b89adda3ee171d2aff437f9d869
parent7416fc5e80446ab25b44803f9f1858d9822e6be7 (diff)
QMenu: Update menu action sizes if popup is (not)caused from menu bar
Menu width differs if it contains key shortcuts or not. Amends 6634c424f8ca0e3aed2898507d5f9f4b774c4602 Task-number: QTBUG-49435 Task-number: QTBUG-61181 Task-number: QTBUG-64449 Change-Id: I8c479af550128069ca91dd089dfc7bd8c24c66ba Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/widgets/widgets/qmenu.cpp6
-rw-r--r--src/widgets/widgets/qmenu_p.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index ded218de73..463254efa9 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -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
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index bdf576b980..a81d8ffafb 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -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;