summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoamenu.mm
Commit message (Collapse)AuthorAgeFilesLines
* NSMenuItem/NSMenu - set the submenu properlyTimur Pocheptsov2019-06-211-0/+10
| | | | | | | | | | | | | | | | | | ... 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: Clear the shortcut used when hiding a native menu entryAndy Shaw2019-03-211-0/+3
| | | | | | | | | | The shortcut needs to be cleared if the native menu entry is being hidden due to the fact it was changed. Otherwise it will not show the shortcut anymore as it sees it as in-use. Change-Id: Ifb10db855766e4de71db06ea006f6d63497f3193 Fixes: QTBUG-74113 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Update all deprecated enums to their 10.12+ equivalentsTor Arne Vestbø2018-08-311-1/+1
| | | | | Change-Id: I3034258da95c9c70eb6758db92967f438617f6e9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Cocoa Menus: Clean up codeGabriel de Dietrich2018-04-261-24/+23
| | | | | | | | | | | | 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>
* Cocoa QPA: Clean up 0 as pointerGabriel de Dietrich2018-04-191-6/+6
| | | | | | | | We use nil for Objective-C null pointers and nullptr everywhere else, including CoreFoundation and similar opaque types. Change-Id: Id75c59413dec54bf4d8e83cf7ed0ff7f3d8bb480 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Cocoa Menus: Allow separators in app menuGabriel de Dietrich2018-04-191-1/+1
| | | | | | | | | | | | | We extend QCocoaNSMenuItem with separator items capabilities and use it as any other custom item in the app menu. Addition and removal of items in the app menu remains very basic because that menu doesn't exist as such. Instead, it's hinted through the QAction's menu role. Change-Id: Ia13bfcc008c75e49fd21705d2528da5a85ed1c73 Task-number: QTBUG-63756 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Cocoa Menus: Use the responder chain for menu items target/actionGabriel de Dietrich2018-04-191-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We start by setting the menu item target to nil. Then, -[qt_itemFired:] action is now in QNSView, which itself is naturally inserted in the responder chain. This removes the need to track and change the menu item's target/action when we're displaying a native dialog. Part of this is possible because we now derive our own QCocoaNSMenuItem class from NSMenuItem. We use -[respondsToSelector:] to decide whether the QNSView in the responder chain should respond to cut:, copy:, etc. And we only return YES when the view is first responder. The invocation to these action is forwarded to the same views' -[qt_itemFired:]. Message forwarding is done via forwardInvocation:, but experiments have shown that it can be done by the sole means of respondsToSelector: and direct invocation from cut:, copy:, etc. See the usage of the macro QT_COCOA_DYNAMIC_MENU_ITEM_ACTION. Menu validation also happens in QNSView and looks for modal windows. Therefore, -[worksWhenModal] is no longer necessary. Also, since the target is no longer set, the logic as documented in NSMenuItem.target won't work anymore. Most items from QCocoaMenuLoader also become QCocoaNSMenuItem and get the same target/action, which removes a bit of duplicated (and outdated) code. A particular case is the Quit item, which gets the terminate: action set until an actual menu item is added. Tested with texedit and standard dialogs examples together with menus, menurama and bigmenucreator manual tests. We also renamed some functions and variables to reflect common naming practices. Change-Id: I9b51d3be3467a666d8c3dcf8585edbc821e0282e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-081-2/+8
|\ | | | | | | Change-Id: Idf471ca5c6cf211813466b539ce45bdc1ae9b97c
| * QCocoaMenuItem: Make QCocoaNSMenu the item targetGabriel de Dietrich2018-03-071-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Clean up our Objective-C usageJake Petroules2018-02-201-3/+1
|/ | | | | | | | | | | | | | | | - Move ivars into @implementation - Use instancetype where applicable - Use dot notation for property access - Use subscript operator for dictionaries and arrays - Format selectors consistently - Use proper style for init methods - Use generics instead of void pointers where possible - Use "range for" loops instead of indexing - Replace or replace IBAction/IBOutlet with void Change-Id: I1667812a51d4dfe44ae80fe337cb1f4bc9699d92 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-2/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| * macOS: fix menu positioning on high-DPIJ-P Nurmi2018-02-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | The target position is passed in physical native pixels, so call QPlatformScreen::availableGeometry() and QPlatformWindow::mapToGlobal() instead of QScreen::availableSize() and QWindow::mapToGlobal(). The latter two operate on logical pixels. Task-number: QTBUG-55251 Change-Id: I281f47baee727bc0f4738fd6d6cdf12c9f462b0f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | QCocoaMenu: Derive custom NSMenu class, make delegate a singletonGabriel de Dietrich2017-12-191-215/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.9' into 5.10Liang Qi2017-11-091-1/+15
|\| | | | | | | | | | | | | | | | | | | | | | | 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-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-311-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/examples.pro qmake/library/qmakebuiltins.cpp src/corelib/global/qglobal.cpp Re-apply b525ec2 to qrandom.cpp(code movement in 030782e) src/corelib/global/qnamespace.qdoc src/corelib/global/qrandom.cpp src/gui/kernel/qwindow.cpp Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08) src/network/ssl/qsslkey_openssl.cpp src/plugins/platforms/android/androidjniinput.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/widgets/widgets/qmenu.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
| * QCocoaMenu: Stop update timerGabriel de Dietrich2017-08-281-0/+1
| | | | | | | | | | | | | | | | This amends patch f27d1ccbb24ec2fd4098f2976503478831006cc8. Change-Id: I4c7a390a5f2cdd3307007c7b6708692c36f861b4 Task-number: QTBUG-62396 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-151-2/+24
|\| | | | | | | | | | | | | | | | | | | 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: Sync menubar menu when adding itemsGabriel de Dietrich2017-08-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Empty menus on a menubar are hidden by default. If the menu gets added to the menubar before it contains any item, we need to get the menubar to sync the menu, which will update its native menu item hidden property. Menurama manual test's 'Add Many Items' button should now work. Change-Id: I8ce1df21031c171789318fdf28ae495819458d71 Task-number: QTBUG-62260 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * QCocoaMenu: De-pessimize the number of calls to validateMenuItem:Gabriel de Dietrich2017-08-151-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+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>
* macOS: Don't try to cast foreign windows to QNSViewTor Arne Vestbø2017-02-111-2/+2
| | | | | Change-Id: I08a4d76310a689c3c855d4c8306f9d7aa5cecadc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QCocoMenu: Fix patch b2f78b796b5b73d4Gabriel de Dietrich2016-12-161-1/+1
| | | | | | | | | | | A null pointer check was accidentally removed while refactoring the code. Change-Id: I547936671bd134bb7df710a4b123a0d731076bf2 Task-number: QTCREATORBUG-17438 Task-number: QTBUG-57404 Task-number: QTBUG-57657 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QCocoaMenu: Don't rely on tags when we can get the actual NSMenuItemGabriel de Dietrich2016-12-081-3/+2
| | | | | | | | | | | -[NSMenu itemWithTag:] clearly states that it'll return the first item with that tag. Furthermore, when and item has been synced more than once, it could be that more than one such item exists in the same menu (e.g. lately changing the role of Edit->Copy). Change-Id: I95a4f0a151659ae273ba03a3cab4a720b781fc3a Task-number: QTBUG-57404 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* QCocoaMenu: Avoid exception when inserting item already in this menuGabriel de Dietrich2016-12-081-7/+13
| | | | | | | | | | | | | | This should not happen, but it's clearly not the user's fault. So we should try to carry on as gracefully as possible instead of letting Cocoa abort the application. The patch also factors the repeated calls to QCocoaMenuItem:: nsItem() in QCocoaMenu::insertNative() and improves a warning from QCocoaMenuIten::sync(). Change-Id: Id00135c219aaf40fb565b19a65cab68f6d9863b2 Task-number: QTBUG-57404 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QCocoaMenu: Force NSMenuValidation when syncing itemsGabriel de Dietrich2016-11-161-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a menu item's enabled state changes after -[QCocoaMenuDelegate menuWillOpen:] is invoked, i.e., during or after QMenu::aboutToShow() is emitted, that state change may not be taken into account. This is because the automatic menu validation, upon which Qt relies, is not made aware of any such change. By calling -[NSMenu update] when syncing the QPA menu item, we induce Cocoa to invoke -[QCocoaMenuDelegate validateMenuItem:] and ensure that previously synced items, whose state may have changed, will be properly updated. This, however, has a small side effect, namely that menu-holding items will also go through the automatic menu enabling path and may appear disabled since, until now, they were not properly configured. In order to solve this, we set the action on those items as well, and make sure that both of QCocoaMenuDelegate's relevant methods, validateMenuItem: and itemFired:, properly process menu-holding items. Menurama manual test updated accordingly. Change-Id: I62f955538b8be09b8494ea0ce87fca7910148d38 Task-number: QTBUG-56850 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Replace QCFString::to(CF/NS/Q)String usage with QString methodsTor Arne Vestbø2016-10-061-2/+2
| | | | | | | | Slims down QCFString and leaves only one implementation of converting back and forth between CF/NS strings and QStrings. Change-Id: I068568ffa25e6f4f6d6c99dcf47078b7a8e70e10 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* macOS: Rename m_contentView to m_view, to distinguish from [NSWindow ↵Tor Arne Vestbø2016-10-051-1/+1
| | | | | | | | | | | | | | contentView] The contentView is the root view of a NSWindow, but our m_contentView is just the corresponding NSView of a QWindow, and doesn't always match the contentView property of the NSWindow. This is part of a multi part cleanup to the Cocoa platform plugin in preparation for improved foreign-window support. Change-Id: Ifaffb12f35544ec05e4a83964b346b47fa4b0576 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-08-291-14/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a were reverted because of reconstruction in 5.7. defineTest(qtConfTest_checkCompiler) in configure.pri is smart enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5. DirectWrite: Fix advances being scaled to 0 Since 131eee5cd, the stretch of a font can be 0, meaning "whatever the font provides". In combination with ec7fee96, this would cause advances in the DirectWrite engine to be scaled to 0, causing the QRawFont test to fail. Conflicts: configure mkspecs/features/uikit/device_destinations.sh mkspecs/features/uikit/xcodebuild.mk src/corelib/global/qglobal.cpp src/corelib/global/qnamespace.qdoc src/plugins/platforms/cocoa/qcocoamenuitem.h src/plugins/platforms/windows/qwindowsservices.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp src/widgets/kernel/qapplication.cpp tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-181-14/+23
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbintegration.cpp Change-Id: I2d71d06a55f730df19ace0dd3304238584a0497f
| | * Cocoa QPA Menus: Propagate enabled state downwardsGabriel de Dietrich2016-08-171-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Cocoa QPA Menus: Clean-up QCocoaMenuLoader related codeGabriel de Dietrich2016-08-011-6/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that QCocoaMenuLoader is a singleton, we can access it the natural way. In all cases, it already needed to be done in an Objective-C file, so it doesn't change anything from this point of view. Furthermore, we decide to remove private accessor APIs in QCocoaApplication and QCocoaApplicationDelegate which are now redundant. Change-Id: I4190ed2e2536b778482c513727e279c9318acb7e Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-151-1/+16
|\| | | | | | | | | | | | | | | | | | | | | 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/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.7Liang Qi2016-04-291-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qml_module.prf mkspecs/features/qt_common.prf src/gui/text/qzip.cpp src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/windows/array.h src/testlib/qtestcase.cpp src/widgets/dialogs/qfilesystemmodel.h Change-Id: Ie41c5868415b81f7693c80e045497035504bb210
| * QCocoaMenu: Have the menu delegate return the right amount of itemsGabriel de Dietrich2016-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | In some cases we move menu items around, therefore we should not rely on QCocoaMenu::items() being the actual items inside the menu. But, since the NSMenu is updated before hand, we can rely on NSMenu.numberOfItems instead. Change-Id: Icd4497beca4f52a6d38408eeaa2e6ec71b579685 Task-number: QTBUG-52931 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Simon Hausmann2016-03-231-5/+5
|\| | | | | | | Change-Id: I9a10e1f3c9506ec8554d8f59b6300825ac730939
| * QCocoaMenus: Use mix-in pattern to implement menu hierarchyGabriel de Dietrich2016-03-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-36/+42
|\| | | | | | | | | | | | | | | | | 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-36/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix for deferredDelete() bug when calling the glib loop directlyPaolo Angelelli2016-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes sure that all events posted using Qt on top of the GLib event loop have the loopLevel counter incremented. This is done since Qt depends on the fact that all deleteLater() calls are issued within the scope of some signal handler (in other words, triggered by the chain sendEvent() -> notifyInternal2()). There is a side effect though: in the conditions affected by this patch, that is deleteLater()s issued within a glib event handler for example, manually calling processEvents() or sendPostedEvents() with or without the QEvent::DeferredDelete flag has the same effect, and deferred deleted events are always processed. While this is not a currently working feature which the patch breaks, this side effect seems to be difficult to avoid without separating sendPostedEvents() and processEvents() into a public and a private method, in order to detect when they are manually called. Such change could perhaps be done for Qt6. An autotest for QTBUG-36434 is also included. Autotesting for QTBUG-32859 seems to be more challenging in this respect, due to its dependency on GLib. Task-number: QTBUG-18434 Task-number: QTBUG-32859 Task-number: QTBUG-36434 Change-Id: Ib89175aa27c9e38bca68ae254d182b2cd21cf7e9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Updated license headersJani Heikkinen2016-01-151-13/+19
|/ | | | | | | | | | | 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>
* QtBase: remove explicit function info from qWarning() etcMarc Mutz2015-11-281-6/+6
| | | | | | | | | | | This information is already registered by the QMessageLogger ctor. Where, by dropping the << Q_FUNC_INFO in ostream-style qDebug(), only a string literal remained, converted to printf-style qDebug() on the go. Change-Id: I3f261c98fd7bcfa1fead381a75a82713bb75e6f3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-10/+31
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * QCocoaMenu: Manually reposition popupsGabriel de Dietrich2015-09-111-10/+31
| | | | | | | | | | | | | | | | | | | | If the popup will show too close to the screen bottom, we need to help Cocoa a bit. The horizontal positioning hasn't shown any problems. Change-Id: I5f298529fbf4a902e39f686f368046a8d1c11760 Task-number: QTBUG-45063 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-0/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * QCocoaMenu: Fix crash with 10.7 QFileDialog shortcutsDyami Caliri2015-06-201-0/+2
| | | | | | | | | | | | | | | | | | Set target and action in menuHasKeyEquivalent in order to match the specification, and to avoid QFileDialog crashes on OSX 10.7. Task-number: QTBUG-17291 Change-Id: Ie8f88cbda31a42c3e1acd8d4ad36d54a295eac65 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-031-12/+22
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qnamespace.qdoc src/corelib/io/qwindowspipereader.cpp src/corelib/io/qwindowspipereader_p.h src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/plugins/platforms/xcb/qxcbconnection.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/tools/qmake/tst_qmake.cpp tests/manual/touch/main.cpp Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
| * QCocoaMenu: return YES if we have a shortcut for a pseudo-first responderTimur Pocheptsov2015-06-011-12/+22
| | | | | | | | | | | | | | | | | | | | When running a modal session with NSOpenPanel (QFileDialog), our menu delegate should not touch qApp->focusObject, since it's not what actually has focus inside NSOpenPanel (will be some native view). Return YES instead. Task-number: QTBUG-17291 Change-Id: I94f3281237fb25495d317b02310bf9d77b21d2ba Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* | Add shared implementation of a NSAutoreleasePool wrapper to qglobalTor Arne Vestbø2015-05-271-10/+9
|/ | | | | | | | | | | We have at least 5 different (but equal) implementations of a wrapper in Qt, and some code uses explicit NSAutoreleasePools. Having a shared implementation lets us clean up things a bit and makes it easier to reason about which pools are actually needed. Change-Id: I2fd8eefc3ae7308595ef9899b7820206268362a5 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>