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>