Introduce a generic Utils::TouchBar that implements a touch bar for
macOS based on QAction. Touch bars can be nested, and one is set to be
the application's top level touch bar.
Also add an ActionContainer for the touch bar. That allows us to manage
the layout of the touch bar the same way we do with menus.
Since the touch bar is an input device with very limited space, a
command in the touch bar needs to be specifically styled for the touch
bar by setting either touchBarText or touchBarIcon (or both).
Touch bars can be nested by nesting the ActionContainers. A nested touch
bar ActionContainer needs to specify an icon and/or text to show in the
touch bar button that opens that sub-bar.
Commands are only shown in the touch bar if they are valid within the
current context.
Implementation-wise we cannot use the standard NSPopoverTouchBarItem for
nesting touch bar levels. We cannot hide items in the touch bar, because
hidden items still take up space in the touch bar. So we need to rebuild
the touch bar regularly. Since the items we show are very dynamic, every
time the items in the toplevel bar change because of a context change,
any opened sub-level touch bar closes. That is why we maintain a stack of
touch bar levels ourselves, replacing the main touch bar with the current
level, and managing opening and closing the levels manually.
This patch adds buttons for Help, Bookmarks, Header/Source, Follow
(Symbol), Decl/Def, and a sub-bar for the debugger actions.
Fixes: QTCREATORBUG-21263
Change-Id: Ib63e610f21a993f1d324fe23c83a7f2224f434ac
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Many issues, mostly in headers, were not addressed in
e38410b76c
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default
Change-Id: I320a51726db881e582b898948d53735ebb06887a
Reviewed-by: hjk <hjk@qt.io>
There are several places where we want to override an icon when adding
an action to a toolbar and to a menu, because we need to different
icon variations.
Change-Id: I0bed4d002b8f83c9ce3278137aa463c20d1dc7be
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Updating the ProxyAction first disconnects from the action and then
connects again. Looks like reconnecting while being in
QMetaObject::activate can lead to never ending handling of the
activation, so use a QueuedConnection instead.
Change-Id: Ia06f926413fd4492d847dfea4461f2ccfdd37ffc
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
&& is used to prevent the following space from becoming a shortcut.
Change-Id: I8143b8ee193a2f2ffc391375e75d8a0fb26e8e09
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This fixes a problem on Mac, where the default menu role is TextHeuristic,
and menu item syncing would reassing this entry as "About Qt Creator". Also
ProxyAction would not forward the menu role.
Task-number: QTBUG-30679
Change-Id: If5ad5fb3a34131c080543bf8160e9ab5140c8585
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
A generic action that acts as a proxy for another (changeable) action,
like it is used for mostly all of the visible actions in Qt Creator
through the action manager.