summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmenu_mac.mm
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Mark the widget's container as embedded when placed into NSMenuItemv5.10.0-beta2Tor Arne Vestbø2017-10-161-0/+5
| | | | | | | | | | | | | | Otherwise we'll end up creating a NSPanel for the QMacNativeWidget which is never closed, even if the backing NSView is moved to a new superview. Ideally this would be based on [NSView viewDidMoveToSuperview] and [NSView viewDidMoveToWindow], with retain/releases of the corresponding NSWindow, but that needs more research, especially as AppKit on macOS 10.13 will always keep a strong reference to the NSWindow. Task-number: QTBUG-63443 Change-Id: I9eec5ea871373d00dedf154600bf7005898cf37a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Convert features.menu to QT_[REQUIRE_]CONFIGStephan Binner2017-09-191-2/+2
| | | | | Change-Id: I031356411294b259ebd2b22c53159c93fd92af6e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.menubar to QT_[REQUIRE_]CONFIGStephan Binner2017-09-041-2/+4
| | | | | Change-Id: Idbd4978852fa280dd18a5684469d499da3892126 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* QMenu: don't force platform instance creation on constructionJ-P Nurmi2016-10-161-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a conflict between QGtk3Menu and QDbusPlatformMenuBar. The problem is that on Unity the type of the platform menu instance must be different depending on whether the menu is in the global menubar or a standalone context menu. Since QMenu creates a platform menu instance at construction time, it does not yet know whether it will be added into a menubar. QMenuBar checks that the QMenu already has a platform menu instance, and passes it to the platform menubar. As a result, a QGtk3Menu instance is passed to QDbusPlatformMenuBar. Currently, a standalone QMenu does not use the native platform menu instance. Only menus that are added to a QMenuBar do. Therefore we don't need to create the platform instance when QMenu is constructed, but only after it is added to QMenuBar. The platform menu instance creation is implemented in QMenuBarPrivate::getPlatformMenu(), and QMenu::setPlatformMenu() calls syncPlatformMenu() to take care of syncing the QMenu properties and actions to the new platform menu instance. The macOS-specific methods QMenu::toNSMenu() and QMenu::setAsDockMenu() rely on the platform menu instance, and must therefore create it on demand. This is a hot fix for the release blocker, not a long term solution. In the future, if standalone QMenus are made to use native platform menu instances, the instance must be created lazily when the menu is about to be made visible. Task-number: QTBUG-56526 Change-Id: I044933cabb1639406fe47908dfc4b1903af214d1 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-161-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-4/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| | * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | | QtBase: use printf-style qWarning/qDebug where possible (II)Marc Mutz2016-05-031-2/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this second part, replace qWarning() << "" << non-QString with qWarning("..%.", non-QString). QString (and QUrl etc) have special escaping handling when streamed into QDebug, so leave those alone. They also seem to expand to less code than the qPrintable() alternative, so there's no reason to replace them. Saves 2KiB, 3.4KiB, ~750b and ~450b in text size in QtCore, Gui, Network and Widgets, resp., on optimized GCC 5.3 AMD64 builds. Change-Id: Iae6823e543544347e628ca1060d6d51e3b04d3f4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-241-2/+8
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/plugins/platforms/windows/qwindowsfontengine.cpp src/plugins/platforms/windows/qwindowsnativeimage.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
| * QMenu: Add delegate related notes to OS X-only APIGabriel de Dietrich2016-02-191-2/+8
| | | | | | | | | | Change-Id: I88bb4fdb2c11da0602e4c9f6637bbdeaa715aba0 Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-5/+3
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * Doc: Properly document old platform-specific functionsSze Howe Koh2016-01-291-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | qt_mac_set_dock_menu() needs a \relates command to show up properly. "\since 5.2" produces "This function was introduced in Qt 5.2", which is wrong; the function existed in Qt 4. qt_set_sequence_auto_mnemonic() is referenced by the QShortcut class ref, but the page that hosted it in qtdoc.git is being removed. Thus, its description is now transferred here. Change-Id: If009a45f1d04541787925cf230ed7b59c7db0b39 Reviewed-by: Alejandro Exojo Piqueras <suy@badopi.org> Reviewed-by: Topi Reiniö <topi.reinio@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>
* | QtWidgets: use Q_UNLIKELY for every qWarning() (1)Marc Mutz2015-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qWarning(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. This change contains the changes to the util/, dialogs/ and widgets/ subdirs. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In QSystemTrayIcon::setVisible(), as a drive-by, I swapped the evaluation order of an &&-expression (newly wrapped in Q_UNLIKELY) to be more readable and more efficient (cheaper check first) at the same time. Change-Id: I3564c5a5deacba49d67d3989fb0b53e680c57fcb Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-11-041-0/+1
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/ptrsize.test configure src/corelib/global/qnamespace.h src/network/socket/qabstractsocket.cpp tests/auto/other/networkselftest/networkselftest.pro Change-Id: Ic78abb4a34f9068567cea876861d4220f5a07672
| * QWidgetAction: Don't deactivate the current window on MacGabriel de Dietrich2015-10-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We check the name of the window class the widget's QNSView changes window and set a flag when the that window is a native Cocoa menu window. Later, only those views not inside a native menu can become first responder, ensuring Qt won't deactivate the main window. We're allowed to reject becoming the first responder mainly because Cocoa itself doesn't support sending key event to menu views and, therefore, it doesn't change what's already possible. This patch also sets the widget action visible, which needs to be done right after reparenting it to the container widget. Besides that, it also contains a few small code cleaning changes related to Cocoa's support of QWidgetAction. Change-Id: Ia2170bdc5e1f40bfa2f1091c05e9e99397c47187 Task-number: QTBUG-44015 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Link to AppKit instead of Cocoa.Jake Petroules2015-09-051-1/+1
|/ | | | | | | | | | | | | Cocoa is basically just AppKit + CoreData. Since we do not use CoreData in Qt, there is no reason to link to it or (transitively) import its headers. This is just a mechanical replacement of -framework Cocoa with -framework AppKit and <Cocoa/Cocoa.h> with <AppKit/AppKit.h> Change-Id: Ibcfc8a03c0ddff27a67fbc87dd7bd58a4b648956 Reviewed-by: Mika Lindqvist <postmaster@raasu.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-22/+14
| | | | | | | | | | | | | | | | | | 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>
* QMenu: Add support for QWidgetAction on MacGabriel de Dietrich2014-04-251-0/+19
| | | | | | | | | | | | | | | The implementation follows a similar logic as in Qt 4 making sure we properly interface with the QPA backend. We also make sure to delay moving the action widget to the QPA menu until it's about to show. We still don't support moving the action widget back from QPA world into Qt, as explained in the QWidgetAction documentation. Task-number: QTBUG-19840 Change-Id: I47f6359b0806f967d80c67fbb1f36c3d5ec8603e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Add QMenu -> NSMenu conversion functions.Morten Johan Sørvig2013-09-211-0/+140
Add QMenu::toNSMenu() and QMenuBar()::toNSMenu(). Add QMenu::setAsDockMenu and qt_mac_set_doc_menu(QMenu *menu) These are all API wrappers around implementation in the Cocoa platform plugin. Change-Id: I927ed4fb5dc42cc577a41a80b531a4a2f7b8812c Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>