Object Hierarchy:

Object hierarchy for ShortcutController


[ CCode ( type_id = "gtk_shortcut_controller_get_type ()" ) ]
public class ShortcutController : EventController, ListModel, Buildable

ShortcutController is an event controller that manages shortcuts.

Most common shortcuts are using this controller implicitly, e.g. by adding a mnemonic underline to a Label, or by installing a key binding using add_binding, or by adding accelerators to global actions using set_accels_for_action.

But it is possible to create your own shortcut controller, and add shortcuts to it.

ShortcutController implements ListModel for querying the shortcuts that have been added to it.

GtkShortcutController as a GtkBuildable

GtkShortcutControllers can be creates in ui files to set up shortcuts in the same place as the widgets.

An example of a UI definition fragment with GtkShortcutController:

  <object class='GtkButton'>
<object class='GtkShortcutController'>
<property name='scope'>managed</property>
<object class='GtkShortcut'>
<property name='trigger'>&amp;lt;Control&amp;gt;k</property>
<property name='action'>activate</property>

This example creates a ActivateAction for triggering the `activate` signal of the GtkButton. See parse_string for the syntax for other kinds of ShortcutAction. See parse_string to learn more about the syntax for triggers.

Namespace: Gtk
Package: gtk4



Creation methods:


Inherited Members:

All known members inherited from interface GLib.ListModel