summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoansmenu.mm
Commit message (Collapse)AuthorAgeFilesLines
* QCocoaMenuItem: Make QCocoaNSMenu the item targetGabriel de Dietrich2018-03-071-38/+37
| | | | | | | | | | | | | | | | | Since we made the NSMenu delegate a singleton we could not rely on it to have enough information to implement worksWhenModal. At the same time as the delegate change, we derived NSMenu into QCocoaNSMenu. This allows us to extend the menu functionality and, in this case, serve as target for the Cocoa menu items. We also refactor setting the item's target/action. Manually tested against menurama and bigmenucreator tests, the test-case for QTBUG-17291, and the richtext/textedit example. Change-Id: I222241f71db82611711b23d4a8c6122a741370ae Task-number: QTBUG-66676 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-151-0/+15
| | | | | | | | | | | | | | | | | Conflicts: src/corelib/corelib.pro src/corelib/global/qrandom.cpp src/network/access/qhttpnetworkrequest_p.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoansmenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/offscreen/qoffscreenintegration.h src/widgets/kernel/qaction.cpp src/widgets/widgets.pro Done-with: Andy Shaw <andy.shaw@qt.io> Change-Id: Ib01547cf4184023f19858ccf0ce7fb824fed2a8d
* QCocoaNSMenuDelegate: Improve key-equivalent logicGabriel de Dietrich2017-12-191-18/+38
| | | | | | | | | | | | | | | | | By using NSEvent.characters instead of NSEvent.charactersIgnoringModifiers, we may miss sending ShortcutOverride events. For example, when the user presses Cmd-Opt-o, characters will be "ø" (on a US keyboard layout) and therefore we'll be looking for the wrong key-equivalent among the menu items. We only fall back on the modified string when the search on the unmodified string fails. As and addendum, we also skip any submenu when doing the key search. This is not necessary since each menu delegate will get called eventually. Change-Id: Id793315293a02c99e99d793ad812cff7b4a47821 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QCocoaMenu: Derive custom NSMenu class, make delegate a singletonGabriel de Dietrich2017-12-191-0/+276
Out of the box, this saves one delegate instance per NSMenu. It also weak-couples the NSMenu instance with its owning QCocoaMenu, making it safer to inspect from the menu delegate. In the future, this will be helpful for debugging by just overriding any NSMenu method. Change-Id: I7eb801009b97f6a8ee2003306c0e152621bbce54 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>