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>
This leaves a clearer separation between the foreign-window and non-foreign
window use-cases, where a single QCococaWindow can only be in one mode,
which is determined in the constructor and doesn't change after that.
There are no source or binary compatibility guarantees for the QPA classes,
meaning the helper function in QPlatformNativeInterface can be removed.
Change-Id: I3232aedca1d98c49a8f54e16750832187f9dc69a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This manual test pretends to be a modest safeguard
against QMenu related regressions on macOS. It takes
a slightly different approach than the existing menus
manual test, tracking observed regressions instead of
providing extensive coverage (though this may change
in the future).
These regressions are listed as task numbers below,
most of them arising from the now infamous change,
09acf326db QCocoaMenu: Decouple NSMenuItem from NSMenu
So, from now on, please run this and the menus manual
tests and look for regressions every time you make a
change regarding QCocoaMenu and related. And, if you're
fixing a regression, add the regression example to the
Menurama manual test.
Task-number: QTBUG-52931
Task-number: QTBUG-53085
Task-number: QTBUG-53251
Task-number: QTBUG-54633
Task-number: QTBUG-54637
Task-number: QTBUG-54698
Task-number: QTBUG-55121
Change-Id: I276e916dcdf00f1a44faf64d87050bc3a037a3b5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)
Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
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>
Focus the test on embedding QWindow: Remove the
NSToolBar code. Use standard NSApplication startup
code. Use winId() to access the NSView instead of
QPlatformNativeInterface (which is gui-private).
Rename Window -> RasterWindow.
Change-Id: Ie98cb73020d2721743bb665b89b17f07f2bf984b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
On OS X the application icon can be changed at runtime, so this adds a way
to set this via the QPlatformIntegration.
[ChangeLog][OS X] QApplication::setWindowIcon now changes the icon for the
application in the dock.
Task-number: QTBUG-43999
Change-Id: Ice298c0bd52f10f4866f37c6d3f20cf5419b7a1b
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
We need to track the active popup globally, having
parent windows track child popups is not sufficient
since there may be one or more intermediate windows
in between the event receiving window and popup window.
Add API to QOCocoaIntegration for tracking the global
popup window and use it instead of the per-window
tracking. Make sure to only close popups on clicks
outside the popup only. Add code to QNSView::handleMouseEvent
that redirects mouse events to the active popup.
Add manual test.
Change-Id: Ia3e3fd42d8fddf5c69f0c6879b333ca544521f61
Task-number: QTBUG-43464
Task-number: QTBUG-31937
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
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>
The Overall goal is to make it possible to use correctly-
sized pixmaps in a predictable way, while still doing
something reasonable with small and large pixmaps.
(The recommended pixmap height is up to 18 points.)
Enable use of rectangular icons by selecting pixmaps
based on pixmap height.
Draw a low-resolution pixmap on retina displays if
there is no high-resolution pixmap available. Scale
large pixmaps to fit the available menu bar area.
Add a manual-test with various pixmap sizes
Task-number: QTBUG-33441
Change-Id: I1926181fe27cae526bae58022df3240bae9f8ac8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Make top-level windows generate enter/leave events
for sub-windows. Keep track of the current "under mouse"
window in mouseMoved and send EnterLeave events when
it changes.
mouseEntered/mouseExited handles enters and leaves
from the top-level window.
Add tests/manual/cocoa/nativewidgets.
Task-number: QTBUG-27550
Task-number: QTBUG-29751
Change-Id: If4b9f9e0f39d9fb05fdab45a100ffdcf107965ad
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
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>
Added a test for QMacCocoaViewContainer which will enable the testing
of the fixes coming
Change-Id: I73e9540bc58411634f0da7d398eca4b7ffafba8e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
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>
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.
Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
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>
Add a toplevel manual.pro and other .pro-files to build them and
fix the build.
Change-Id: Ibc98a27b39dd1304edfa8a6894d62e77ce7ef387
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Support pixel-based deltas as well as sending
dx and dy values in the same event. Keep source and
behavior compatibility with Qt 4.
New API:
QPoint pixelDelta() const
QPoint angleDelta() const
Deprecate delta() and orientation().
Both pixel-based deltas and combined updates are
necessary for smooth trackpad-based scrolling on
OS X.
Qt 4 compatible behavior is achieved by sending an
extra wheel event in cases where the initial event
has a combined dx and dy update. This extra event
sends dx in delta() and orientation(), with pixelDelta()
and angleDelta() set to null.
Modify the Cocoa implementation to provide pixel
deltas. It is expected that not all platforms can
provide these. Angle deltas will always be available.
Change-Id: I20c10f0df338ddcd6a3f7a4d40949ed5ae3b4795
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
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>
QCocoaWindow now gets resize events from QNSViev
and does not require a NSWindow. QWindow instances
can now be inserted in NSView hierarchies. This is
useful for Qt-as-a-plugin use cases and is needed to
implement QMacNativeWidget for Qt 5.
Change-Id: Ia95ea9c22a15a3e62d1e6543466cff07390c70a2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>