Ticket #46496: deactivate-menurole-heuristics.patch

File deactivate-menurole-heuristics.patch, 2.5 KB (added by RJVB (René Bertin), 10 years ago)

don't try to guess which QActions should be put under the About and Preferences menu items

  • qtbase/src/plugins/platforms/cocoa/messages.cpp

    diff --git qtbase/src/plugins/platforms/cocoa/messages.cpp qtbase/src/plugins/platforms/cocoa/messages.cpp
    index 4f7b038..ea63338 100644
    QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption) 
    7878{
    7979    QString captionNoAmpersand(caption);
    8080    captionNoAmpersand.remove(QChar('&'));
    81     const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
    82     if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
    83         return QPlatformMenuItem::AboutRole;
    84     if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
    85         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
    86         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
    87         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
    88         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
    89         return QPlatformMenuItem::PreferencesRole;
    90     }
     81//     const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
     82//     if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
     83//         return QPlatformMenuItem::AboutRole;
     84//     if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
     85//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
     86//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
     87//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
     88//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
     89//         return QPlatformMenuItem::PreferencesRole;
     90//     }
    9191    if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive)
    9292        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) {
    9393        return QPlatformMenuItem::QuitRole;