diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-08-26 06:55:37 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-08-26 07:17:05 (GMT) |
commit | 466c908681d25031cc89d49fccd7a90a4414ecbf (patch) | |
tree | 91fdba1511dd0ab9ff25fd3909f5d632b1b59c6c /src/gui | |
parent | c3a8485e91cc86e9e886712acb1b9a70d96382e9 (diff) | |
download | Qt-466c908681d25031cc89d49fccd7a90a4414ecbf.zip Qt-466c908681d25031cc89d49fccd7a90a4414ecbf.tar.gz Qt-466c908681d25031cc89d49fccd7a90a4414ecbf.tar.bz2 |
Cocoa, the menus can be disabled after a modal dialog
Why this happends is a bit blurry. From before, I know that
cocoa is a bit buggy regarding setting a menu item
hidden or not. The solution back then resulted in the function
syncNSMenuItemEnabled in qmenu_mac.mm. This patch basically
applies the same (silly) trick; disabling the menuitem before
enabling it. This seems to force an update to the menu items
enabled state. For the record: this is not a fix that I
embrace. I hope we can remove it again some day. See
task for how to reproduce.
Task: 259600
Rev-By: alexis
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qmenu_mac.mm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 47a8042..8e28abe 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -607,6 +607,13 @@ static inline void syncNSMenuItemVisiblity(NSMenuItem *menuItem, bool actionVisi [menuItem setHidden:!actionVisibility]; } +static inline void syncNSMenuItemEnabled(NSMenuItem *menuItem, bool enabled) +{ + [menuItem setEnabled:NO]; + [menuItem setEnabled:YES]; + [menuItem setEnabled:enabled]; +} + static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarPrivate *mac_menubar) { const QList<QMacMenuAction *> &menubarActions = mac_menubar->actionItems; @@ -659,12 +666,12 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo // The item should follow what the QAction has. if ([item tag]) { QAction *action = reinterpret_cast<QAction *>([item tag]); - [item setEnabled:action->isEnabled()]; + syncNSMenuItemEnabled(item, action->isEnabled()); } else { - [item setEnabled:YES]; + syncNSMenuItemEnabled(item, YES); } } else { - [item setEnabled:NO]; + syncNSMenuItemEnabled(item, NO); } } } |