Commit Graph

33 Commits

Author SHA1 Message Date
Gabriel de Dietrich
e8a41ed866 QCocoaMenu: Force NSMenuValidation when syncing items
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>
2016-11-16 14:23:49 +00:00
Tor Arne Vestbø
89842b97d7 Implement QMacCocoaViewContainer in terms of foreign window
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>
2016-10-05 19:37:17 +00:00
Liang Qi
2111bf00fe Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I4f4ab05b2de67cd4b1d29b294b96a8c9ffb964b2
2016-08-22 21:58:45 +02:00
Gabriel de Dietrich
0f61cde4d9 Cocoa Menus: Introducing Menurama manual test
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>
2016-08-19 03:04:28 +00:00
Jani Heikkinen
f776595cc1 Updated license headers
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>
2016-01-21 18:55:18 +00:00
Jake Petroules
353b160a4a Link to AppKit instead of Cocoa.
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>
2015-09-05 11:49:17 +00:00
Friedemann Kleint
51e501fa8d Remove QT_DISABLE_DEPRECATED_BEFORE=0 from tests not using deprecated API.
Change-Id: I1955320e7639760b4383a53f37a506c8055933ef
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
2015-09-01 16:57:46 +00:00
Morten Johan Sørvig
795400d1e5 Clean up qt_on_cocoa manual test.
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>
2015-04-30 05:04:07 +00:00
Andy Shaw
34ec0713bb Add a means to set the application icon where supported
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>
2015-04-10 10:10:25 +00:00
Morten Johan Sørvig
10126b37d2 Cocoa: Correct mouse event forwarding for popups
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>
2015-03-12 09:32:17 +00:00
Jani Heikkinen
cb95fff1c7 Fixed license headers
Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-02-17 18:46:09 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
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>
2015-02-11 06:49:51 +00:00
Christoph Schleifenbaum
f3699510d4 Cocoa: Fix icon size calculation for system tray.
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>
2014-10-22 23:32:17 +02:00
Matti Paaso
974c210835 Update license headers and add new license files
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3
- Removed LICENSE.GPL

Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
2014-09-24 12:26:19 +02:00
Tor Arne Vestbø
9d1f059fc5 qpa: Rename qwidgetwindow_qpa_p.h to qwidgetwindow_p.h
Change-Id: I24835b86194653e89c0bacefd22ddbff06b6e97b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-05-20 00:20:02 +02:00
Morten Johan Sørvig
c8848a5e98 Compile.
Change-Id: Ib0e7e7aa2964835afda4055a5fe76abbd5db84e3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2014-02-08 10:43:58 +01:00
Liang Qi
c2b8ebe9db tests: make qt_on_cocoa build again
QPA was public since 36547f4eff.

Change-Id: I838cc0736dc75e5301dd41f3ea89848f300443d4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-11-04 15:42:09 +01:00
Gunnar Sletta
b571b6329b Update manualtests license to say "part of test suite".
Change-Id: Ice9498c65a20ff17e68303578f8a1d9d6877f501
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-05-26 20:54:51 +02:00
Morten Johan Sørvig
b2c73c73cd Cocoa: Correct enter/leave event handling.
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>
2013-03-26 19:21:38 +01:00
Sergio Ahumada
48e0c4df23 Update copyright year in Digia's license headers
Change-Id: Ic804938fc352291d011800d21e549c10acac66fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-01-18 09:07:35 +01:00
Oswald Buddenhagen
599a58170d remove obsolete DEPENDPATH assignments
qmake now add CONFIG+=depend_includepath by default, making manual
DEPENDPATH setup unnecessary.

Change-Id: Ie57cf05c369e21b5b9e099b6ce9be4f75da1508f
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-12-17 14:08:17 +01:00
Morten Johan Sørvig
8fa464ffa6 Compile.
Update painting code with retina support.

Change-Id: Iebdfaaaaf98ed69f4ecb3cef5ca96b4e4ddb09dd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2012-12-17 11:57:02 +01:00
Andy Shaw
356f3c89b8 Fix syncing of visibility and enabled for menus on Cocoa
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>
2012-10-26 14:53:09 +02:00
Andy Shaw
8b7b6b6969 Add a manual test for QMacCocoaViewContainer
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>
2012-09-24 21:27:51 +02:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
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>
2012-09-22 19:20:11 +02:00
Thiago Macieira
672b5b7ab6 Set the Qt API level to compatibility mode in all tests.
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>
2012-08-01 15:37:46 +02:00
James Turner
b8246f08e4 Cocoa implementation of QPA menu interface.
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>
2012-05-19 10:18:21 +02:00
Friedemann Kleint
28675642f3 Build manual tests.
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>
2012-04-12 14:50:39 +02:00
Morten Johan Sorvig
5a2efb490b QWheelEvent high-resolution delta support.
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>
2012-02-24 14:55:06 +01:00
Jason McDonald
5635823e17 Remove "All rights reserved" line from license headers.
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>
2012-01-30 03:54:59 +01:00
Jason McDonald
629d6eda5c Update contact information in license headers.
Replace Nokia contact email address with Qt Project website.

Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-23 04:04:33 +01:00
Jason McDonald
1fdfc2abfe Update copyright year in license headers.
Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-05 06:36:56 +01:00
Morten Sorvig
f950a0f0c0 Make QCocoaWindow independent of NSWindow.
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>
2011-12-14 23:26:15 +01:00