Revert "OS X: rename special menu items instead of duplicating"
This reverts commit 8c538d10da
.
This patch, unfortunately, do not combine well with another
problematic code producing, as a result, a serious regression.
While the proper/better fix in Cocoa menu not found, I'm reverting
this patch.
Change-Id: I1ff03dbe12805da447cb3cfe3e2f231528bf1a16
Task-number: QTBUG-43471
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
This commit is contained in:
parent
244da85d3b
commit
c085382555
@ -366,14 +366,9 @@ void QCocoaMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
||||
}
|
||||
|
||||
bool wasMerged = cocoaItem->isMerged();
|
||||
NSMenu *oldMenu = m_nativeMenu;
|
||||
if (wasMerged) {
|
||||
QPlatformMenuItem::MenuRole role = cocoaItem->effectiveRole();
|
||||
if (role >= QPlatformMenuItem::ApplicationSpecificRole && role < QPlatformMenuItem::CutRole)
|
||||
oldMenu = [getMenuLoader() applicationMenu];
|
||||
}
|
||||
|
||||
NSMenu *oldMenu = wasMerged ? [getMenuLoader() applicationMenu] : m_nativeMenu;
|
||||
NSMenuItem *oldItem = [oldMenu itemWithTag:(NSInteger) cocoaItem];
|
||||
|
||||
if (cocoaItem->sync() != oldItem) {
|
||||
// native item was changed for some reason
|
||||
if (oldItem) {
|
||||
|
@ -256,8 +256,8 @@ NSMenuItem *QCocoaMenuItem::sync()
|
||||
if (depth == 3 || !menubar)
|
||||
break; // Menu item too deep in the hierarchy, or not connected to any menubar
|
||||
|
||||
MenuRole newDetectedRole = detectMenuRole(m_text);
|
||||
switch (newDetectedRole) {
|
||||
m_detectedRole = detectMenuRole(m_text);
|
||||
switch (m_detectedRole) {
|
||||
case QPlatformMenuItem::AboutRole:
|
||||
if (m_text.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1)
|
||||
mergeItem = [loader aboutMenuItem];
|
||||
@ -271,15 +271,12 @@ NSMenuItem *QCocoaMenuItem::sync()
|
||||
mergeItem = [loader quitMenuItem];
|
||||
break;
|
||||
default:
|
||||
if (newDetectedRole >= CutRole && newDetectedRole < RoleCount && menubar)
|
||||
mergeItem = menubar->itemForRole(newDetectedRole);
|
||||
if (m_detectedRole >= CutRole && m_detectedRole < RoleCount && menubar)
|
||||
mergeItem = menubar->itemForRole(m_detectedRole);
|
||||
if (!m_text.isEmpty())
|
||||
m_textSynced = true;
|
||||
break;
|
||||
}
|
||||
|
||||
m_detectedRole = newDetectedRole;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user