QCocoaMenuLoader: Add app specific items after Preferences
This is in accordance with the macOS HIG which state that, "in general, a Preferences menu item should be the first app-specific menu item." See https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/ Change-Id: Ie2b6ce274995a7d0b0e934c6a68241500a39f7aa Task-number: QTBUG-63756 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
b7be91b5f2
commit
99290faa66
@ -126,6 +126,11 @@
|
|||||||
preferencesItem.hidden = YES;
|
preferencesItem.hidden = YES;
|
||||||
[appMenu addItem:preferencesItem];
|
[appMenu addItem:preferencesItem];
|
||||||
|
|
||||||
|
// We'll be adding app specific items after this. The macOS HIG state that,
|
||||||
|
// "In general, a Preferences menu item should be the first app-specific menu item."
|
||||||
|
// https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/
|
||||||
|
lastAppSpecificItem = preferencesItem;
|
||||||
|
|
||||||
[appMenu addItem:[NSMenuItem separatorItem]];
|
[appMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
// Services item and menu
|
// Services item and menu
|
||||||
@ -278,14 +283,12 @@
|
|||||||
// it as an autorelease item.
|
// it as an autorelease item.
|
||||||
QCocoaNSMenuItem *item = [[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem];
|
QCocoaNSMenuItem *item = [[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem];
|
||||||
|
|
||||||
NSInteger location;
|
NSInteger location = [appMenu indexOfItem:lastAppSpecificItem];
|
||||||
if (lastAppSpecificItem == nil) {
|
|
||||||
location = [appMenu indexOfItem:aboutQtItem];
|
if (!lastAppSpecificItem.separatorItem)
|
||||||
} else {
|
|
||||||
location = [appMenu indexOfItem:lastAppSpecificItem];
|
|
||||||
[lastAppSpecificItem release];
|
[lastAppSpecificItem release];
|
||||||
}
|
|
||||||
lastAppSpecificItem = item; // Keep track of this for later (i.e., don't release it)
|
lastAppSpecificItem = item; // Keep track of this for later (i.e., don't release it)
|
||||||
|
|
||||||
[appMenu insertItem:item atIndex:location + 1];
|
[appMenu insertItem:item atIndex:location + 1];
|
||||||
|
|
||||||
return [[item retain] autorelease];
|
return [[item retain] autorelease];
|
||||||
|
Loading…
Reference in New Issue
Block a user