summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoamenu.h
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Simplify Objective-C namespacingTor Arne Vestbø2019-10-151-3/+2
| | | | | | | | | | | | | | | | We only need to use the QT_MANGLE_NAMESPACE macro when declaring the interface of the class. As long as we couple that with an alias declaration using QT_NAMESPACE_ALIAS_OBJC_CLASS, any further uses of the class name can be un-namespaced, including declaring categories on the class. The only snag with QT_NAMESPACE_ALIAS_OBJC_CLASS is that it can only be used once per class and translation unit, so forward declarations get hairy, but we can avoid that by just including the headers instead. Change-Id: I333bcd18fe1e18d81fbd560b0941c98b1c32460e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* NSMenuItem/NSMenu - set the submenu properlyTimur Pocheptsov2019-06-211-0/+4
| | | | | | | | | | | | | | | | | | ... in case the submenu is set from a slot, attached to the aboutToShow() signal. Normally, with a 'statically' pre-populated menu, we set 'submenu' property on a menu item from 'updateItem' callback in our menu delegate. After that, AppKit calls our delegate's willOpen call back and this is where we emit 'aboutToShow'. Unfortunately, if an application tries to create a nested menu 'dynamically' at this point, it never becomes 'submenu' of the item, since 'updateItem' was already handled at this point. We catch this case in QCocoaMenuItem and call setAttachedItem if needed. Fixes: QTBUG-76060 Change-Id: I676bf1d8529b9ddbfc90e4dff422b39668b7a5fa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Cocoa Menus: Clean up codeGabriel de Dietrich2018-04-261-1/+1
| | | | | | | | | | | | In this edition: * Use Objective-C properties where appropriate. * Use recently introduced qt_objc_cast(). * Remove uses of foreach. * Update copyright headers. Change-Id: I2a07a7b6cab27b833e4deaeedf9563463ff55914 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QCocoaMenuItem: Make QCocoaNSMenu the item targetGabriel de Dietrich2018-03-071-0/+2
| | | | | | | | | | | | | | | | | 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>
* QCocoaMenu: Derive custom NSMenu class, make delegate a singletonGabriel de Dietrich2017-12-191-3/+4
| | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-231-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-091-0/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qwindow.cpp src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowssystemtrayicon.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp tests/auto/widgets/kernel/qaction/tst_qaction.cpp Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
| | * QCocoaMenu: Attach menu items when updating the menubarGabriel de Dietrich2017-11-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of waiting for the menu delegate to update each item, we can attach an NSMenu to its NSMenuItem as soon as we update the current window's menubar. This is safe to do because we know that this is going to be the main menubar right after, so we're not orphaning any NSMenuItem from its NSMenu at the wrong moment. By doing this, we also ensure that all menus from the active menubar are reachable by the key-equivalent dispatching logic, even before we display the actual menu. This was shown in BigMenuCreator where, under the menubar's ASP and SAP menus, all A*S submenus would be disabled. Furthermore, on the same menus, SAP would show the same issue. Added test in Menurama as well. Change-Id: If6e7311072e6b53ad1cbced73623d1832aa0df8e Task-number: QTBUG-57076 Task-number: QTBUG-63712 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-191-16/+16
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-151-0/+4
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoamenu.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/widgets/styles/qstylehelper_p.h Change-Id: I54247c98dd79d2b3826fc062b8b11048c9c7d9bb
| * QCocoaMenu: De-pessimize the number of calls to validateMenuItem:Gabriel de Dietrich2017-08-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Calling -[NSMenu update] every time we add a new item can result in a quadratic behavior since the function itself will iterate over all the items in the menu. We solve this by using a 0-timer which will trigger the call to update the next time the event loop spins. Menurama manual test updated. Change-Id: Ic155d364515cc93eb81b1c8085c8e44c93799954 Task-number: QTBUG-62396 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Make platform menu tag/setTag not be pure virtualAlbert Astals Cid2017-04-181-6/+0
|/ | | | | | | | | | | | | | | | | | | Reasons: * Tag means nothing to the platform, tag is something the Qt side code will store and then restore, but it's meaningless for the platform, since it can be either the pointer to an action (qmenu.cpp) or an item count (qcombobox.cpp) * Since it's meaningless to the platform you don't know what to do when trying to implement a platform, this shows in how the field was being initialized, some initialized to this, some initialized to 0 On a followup commit we will remove the virtual tag but first need to fix up other QPAs that don't live in the main repo Change-Id: I15ac83f3bf7e4c741153d31ac761dbbe6f4b1b52 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-181-4/+5
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbintegration.cpp Change-Id: I2d71d06a55f730df19ace0dd3304238584a0497f
| * Cocoa QPA Menus: Propagate enabled state downwardsGabriel de Dietrich2016-08-171-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NSMenu has autoenableItems set to true by default, and we keep it this way in Qt. This means that NSMenuItem's enabled property is basically ignored and therefore QCocoaMenuItem::syncModalState() is wrong. What is also wrong, is syncModalState()'s name in both QCocoaMenuItem and QCocoaMenu. Indeed, this function's role should be to ensure that the enabled state is properly propagated down the menu hierarchy, whether the reason is being in the context of a modal dialog or the parent menu having been disabled by the app. Notice that the latter case is specially needed when a menubar menu is explicitly disabled. Therefore, we introduce a separate flag for the parent enabled state in order to avoid polluting the app-set enabled state flag. This is done in both QCocoaMenu and QCocoaMenuItem. In the case of QCocoaMenuItem, these two flags define whether an NSMenuItem is enabled state conjointly, and set from -[QCocoaMenuDelegate validateMenuItem:]. The rest of the logic remains as before. Similar logic is used in QCocoaMenu::isEnabled(). In addition, the presence of the second flag allows us to show disabled submenus in the same fashion native Cocoa applications do. This means, the submenu item itself remains enabled, allowing to show the submenu popup where all its menu items will appear disabled. Bonus change: merged all the bool flags into a bitfield and made the compiler happy about the ivar reordering in QCocoaMenu and QCocoaMenuItem's constructor. Task-number: QTBUG-54698 Task-number: QTBUG-55121 Change-Id: Ie156cb3aa57a519103908ad4605f7b43c57e5aef Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-151-1/+5
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakeevaluator.cpp One side changed the iterator to use ranged-for, the other changed its body; they only conflicted because the latter had to add braces around the body, intruding on the for-line. Trivial resolution. Change-Id: Ib487bc3bd6e3c5225db15f94b9a8f6caaa33456b
| * QCocoaMenu: Attach late items to their submenuGabriel de Dietrich2016-07-081-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the QMenu::aboutToShow() signal is emitted way after -[QCocoaMenuDelegate menu:updateItem: atIndex:shouldCancel:], we miss the opportunity to attach the submenu to the menu item. The solution is to track the "open" state of the NSMenu. Then, if any submenu item gets added while the NSMenu is open, then we immediately attach the native item to the menu. Change-Id: I1f3a84ed3832520344da07e06cb3483ad6bd4ffd Task-number: QTBUG-54633 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Simon Hausmann2016-03-231-1/+1
|\| | | | | | | Change-Id: I9a10e1f3c9506ec8554d8f59b6300825ac730939
| * QCocoaMenus: Use mix-in pattern to implement menu hierarchyGabriel de Dietrich2016-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To solve menu item roles from their text, we need to find its depth in the menubar hierarchy. Unfortunately, there's no trivial way to access that hierarchy from the QPA side, so we need to come with an ad-hoc solution. Previously, we were using a dynamic proprety to keep track of the 'parent' object. However, as the life span of the different objects has changed since 09acf326dbc6b7b67f21a36, we need a way to keep track of the parent's existence. This is what we do in this patch by having both QCocoaMenu and QCocoaMenuItem also inherit QCocoaMenuObject. This class' sole role is to store the menu hierarchy's parent object and wrap it in a QPointer. Change-Id: Ia18d95171af76d26f6325eef04c77b40d99c4285 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-10/+3
|\| | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * QCocoaMenu: Decouple NSMenuItem from NSMenuGabriel de Dietrich2016-03-161-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While Cocoa requires an NSMenu to be coupled to an NSMenuItem (just as Qt requires a QMenu to be coupled to a QAction), making that a hard coupling comes with some limitations. This is because Cocoa won't allow the NSMenu object to be simultaneously coupled to more than one NSMenuItem and, similarly, an NSMenuItem can only be added to a single parent NSMenu. Therefore, it becomes difficult to share one QMenu between two different QMenuBars in different windows, or to use a QMenu as context menu while being accessible from the menu bar. Previous solutions to circumvent those limitations were less than ideal (see 119882714f87ffeb6945fdb2d02997ae125ff50c for the QMenuBar shared QMenu issue). Other workarounds that relied on that hard coupling, like 996054f5e65bc676aaea0743c2eacec51918e4aa, also added gratuitous complexity. In this patch, we break that hard NSMenuItem-NSMenu coupling, and we replace it with a temporary, looser coupling. As a consequence, * QCocoaMenu only contains and manages a NSMenu instance, removing the previously used NSMenuItem. It gets a temporarily attached NSMenuItem instead. * QCocoaMenuItem gains a safe pointer to its QCocoaMenu property removing the necessity containingMenuItem() in QCocoaMenu. * QCocoaMenuBar manages its own NSMenuItems. With this setup, we bind the NSMenu to its parent NSMenuItem at the last moment. In QCocoaMenuBar, when we call updateMenuBarImmediately(). In QCocoaMenu, we use the delegate's -[QCocoaMenuDelegate menu: updateItem:atIndex:shouldCancel:] method which is called when Cocoa is about to display the NSMenu. Note: There's still one use case we don't support, which is sharing a toplevel QMenuBar menu. This is because Cocoa's menu bar requires each of its menu items to have a submenu assigned, and therefore we can't rely on that last moment assignment. Task-number: QTBUG-34160 Task-number: QTBUG-31342 Task-number: QTBUG-41587 Change-Id: I92bdb444c680789c78e43fe0b585dc6661770281 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Cocoa QPA plugin: Unlock full Q_DECL_OVERRIDE karmaGabriel de Dietrich2015-08-011-21/+21
| | | | | | Change-Id: I0f631c3b120d052ad552809d0aab9493e5b41a70 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* QShortCut: Check whether the menu is QPA-disabledGabriel de Dietrich2015-03-111-0/+1
| | | | | | | | | | | | When climbing the menu hierarchy, it's sounder to check whether the actual QPA menu is enabled. This way we can trigger modifier-less shortcuts even in submenus. Task-number: QTBUG-38256 Task-number: QTBUG-42584 Change-Id: I13a27027306bce0f0732b05bf9469f3b77028f73 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Oswald Buddenhagen2014-10-061-0/+5
|\ | | | | | | Change-Id: I132bb6cce68e9f8413200f7ee75586bd1cada38c
| * QCocoaMenu: Keep a reference to the containing menu itemGabriel de Dietrich2014-09-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | This allows the menu to tell its containing item the menu got deleted. This removes the need to reset the COCOA_MENU_ANCESTOR property value, which would crash since QCocoaMenuItem::m_menu would be a dangling pointer. Task-number: QTBUG-41587 Change-Id: Ia3408ef85cf823bfddbc2c41d6534e43bf14ed29 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* | cocoa: override new QPlatformMenu::popup() functionRichard Moe Gustavsen2014-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having two versions of popup, one that takes a point and one that takes a target rect, causes problems for client code if they use the 'target rect' version since not all platforms override that function. So this patch will change the remaining platform that override QPlatformmenu into using the new 'target rect' version. Calling the old version that takes a point will still work, since the base version will then convert the point into a zero-sized rect, and forward the call to the 'target rect' version instead. Change-Id: Icc8531d79270a4f24ec08b8ed95b18ed3db1ad4d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* | Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
|/ | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QPA: Adding API to support QWidgetAction on MacGabriel de Dietrich2014-04-171-0/+1
| | | | | | | | | Includes the Cocoa implementation. Task-number: QTBUG-19840 Change-Id: Id33bc8053b82116cf76ed591b6df823df3aef9bc Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Allow to hide menu items in menubarGabriel de Dietrich2013-08-131-0/+3
| | | | | | | Task-number: QTBUG-32899 Change-Id: I423ac2d636306303d39e973f19032c9004957095 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* Cocoa:Fixed crash when sharing QMenu between two QMenuBar instancesRomain Perier2013-06-071-0/+5
| | | | | | | | | | | Don't insert a NSMenuItem into a NSMenu if this one already belongs to another NSMenu, this is forbidden in the Cocoa framework and raises an Exception. The solution consists in tagging the menu as sharable and moving it from one menubar to another when the window gets focus. Task-number: QTBUG-31342 Change-Id: Ic3bfadd4704f363ac26122ae15547543a0f6d44d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Improve text heuristic menu item syncing logicGabriel de Dietrich2013-04-251-4/+1
| | | | | | | | | | | | | | | Don't try anything after the original syncing, particularly after changing the menu item's text. Also, don't try anything if the menu item cannot be linked up to a menubar (see QTBUG-30756). This latter point requires extra syncing after adding a menu in the menubar. Finally, to be able to find the menubar, we need to clean the code for moc's eyes. Task-number: QTBUG-30756 Task-number: QTBUG-30812 Change-Id: I88fad663f1c35d03a0cb167d1723d16f590918c0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Remove dead code in QCocoaMenu*Gabriel de Dietrich2013-04-251-2/+0
| | | | | Change-Id: I56136594f073295ced645d06f657187a54e84384 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Add enablers for Android port in QPlatformMenuEskil Abrahamsen Blomfeldt2013-02-051-0/+2
| | | | | | | We need a couple of functions here for the Android support. Change-Id: I50e27277d7e838e277d616dbd3af9be817fb7197 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QPA, Cocoa: Add platform popup menusGabriel de Dietrich2013-01-111-1/+5
|/ | | | | | | | Also, allow to set menu-wide font (instead of per menu item), and minimum width. Change-Id: I5f83f260602f55b9409ad69abf670afb59b2d33a Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Fix syncing of visibility and enabled for menus on CocoaAndy Shaw2012-10-261-0/+1
| | | | | | | | | | | Fixed menu handling on Cocoa so if a menu is enabled/disabled or made visible or not then it will keep this in sync with the appropriate native menu entry. Change-Id: If269185fcf065fb1b2f60d6ef8c27c107eb4509f Reviewed-by: Pasi Matilainen <pasi.matilainen@digia.com> Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix missing cleanup of native Cocoa menus.James Turner2012-08-281-0/+1
| | | | | | | | | | | QCocoaMenu was missing a destructor to release various native resources, and this causes issues with pop-up menus when the Qt peers are recycled on successive shows of the same menu. Task-number: QTBUG-27022 Change-Id: I3cdf979804358ce10fe8a87c9e2c90419c6e0b48 Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Cocoa implementation of QPA menu interface.James Turner2012-05-191-36/+61
| | | | | | | | | | | Implement the QPA platform menu interface for Cocoa, including native menubar support and merging with the predefined menus created from the bundled .nib. Cleanup code previously used to maintain the menus, and add a manual test of the menus code. Change-Id: Ia99267ddb6485e18e05c540eb32c5aee6cbb85db Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cocoa: QMenu refactor.Morten Sorvig2011-09-071-0/+80
This change prepares for enabling native menus on OS X. Move code from src/widgets to cocoa: - qcocoaapplicaiton - qcocoaapplicaitondelegate - qcocoamenuloader - qcocoamenu - qmenu_mac - misc helpers to qcocoahelpers Create a QNSApplication and QCocoaApplicationDelegate at application startup. New Lighthouse API: - class QPlatformMenu - class QPlatformMenuBar - QPlatformIntegration::createPlatformMenu() - QPlatformIntegration::createPlatformMenuBar() Platforms that wants a native menu integration subclasses QPlatformMenu[|Bar] and implements the create function. The default implementation returns 0, which causes QMenu to use the standard Qt menus. This API is based on the current native menu abstraction that Mac, Wince and S60 uses in Qt 4. The main difference is that the platform classes are proper standalone classes and not #ifdeffed into QMenuPrivate. Change-Id: I3da41f80b0ae903a476937908b1f9b88014b7954 Reviewed-on: http://codereview.qt.nokia.com/4068 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>