Changeset 846 for trunk/src/gui/widgets/qcocoamenu_mac.mm
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qcocoamenu_mac.mm
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 47 47 #include <private/qt_cocoa_helpers_mac_p.h> 48 48 #include <private/qapplication_p.h> 49 #include <private/qaction_p.h> 49 50 50 51 #include <QtGui/QMenu> … … 71 72 if (self) { 72 73 qmenu = menu; 74 previousAction = 0; 73 75 [self setAutoenablesItems:NO]; 74 76 [self setDelegate:self]; … … 82 84 83 85 if (!item) { 84 // ### According to the docs everything will be highlighted. Not sure what we should do in 85 // Qt, so just return. 86 if (previousAction) { 87 qt_mac_clear_status_text(previousAction); 88 previousAction = 0; 89 } 86 90 return; 87 91 } 88 92 89 if (QAction *action = reinterpret_cast<QAction *>([item tag])) 93 if (QAction *action = reinterpret_cast<QAction *>([item tag])) { 94 QMenu *qtmenu = static_cast<QT_MANGLE_NAMESPACE(QCocoaMenu) *>(menu)->qmenu; 95 previousAction = action; 90 96 action->activate(QAction::Hover); 97 qt_mac_menu_emit_hovered(qtmenu, action); 98 action->showStatusText(0); // 0 widget -> action's parent 99 } 91 100 } 92 101 … … 101 110 } 102 111 103 - (void)menu WillClose:(NSMenu*)menu;112 - (void)menuDidClose:(NSMenu*)menu; 104 113 { 105 114 qt_mac_emit_menuSignals(((QT_MANGLE_NAMESPACE(QCocoaMenu) *)menu)->qmenu, false); 115 if (previousAction) { 116 qt_mac_clear_status_text(previousAction); 117 previousAction = 0; 118 } 106 119 } 107 120 … … 176 189 } 177 190 191 - (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector 192 { 193 NSInteger index = [super indexOfItemWithTarget:anObject andAction:actionSelector]; 194 static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:"); 195 if (index == -1 && selForOFCP == actionSelector) { 196 // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object 197 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; 198 return [super indexOfItemWithTarget:loader andAction:actionSelector]; 199 } 200 return index; 201 } 202 178 203 @end 179 204 … … 195 220 qt_mac_menus_open_count += delta; 196 221 } 222 223 void qt_mac_clear_status_text(QAction *action) 224 { 225 action->d_func()->showStatusText(0, QString()); 226 } 227 228 void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action) 229 { 230 emit menu->hovered(action); 231 } 232 233 197 234 QT_END_NAMESPACE 198 235
Note:
See TracChangeset
for help on using the changeset viewer.