PopoverMenu
Superclasses: Popover
, Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
, Native
, ShortcutManager
- Constructors:
PopoverMenu(**properties)
new_from_model(model:Gio.MenuModel=None) -> Gtk.Widget
new_from_model_full(model:Gio.MenuModel, flags:Gtk.PopoverMenuFlags) -> Gtk.Widget
Constructors
- class PopoverMenu
- classmethod new_from_model(model: MenuModel | None = None) → Widget
Creates a
GtkPopoverMenu
and populates it according tomodel
.The created buttons are connected to actions found in the
GtkApplicationWindow
to which the popover belongs - typically by means of being attached to a widget that is contained within theGtkApplicationWindow
’s widget hierarchy.Actions can also be added using
insert_action_group
on the menus attach widget or on any of its parent widgets.This function creates menus with sliding submenus. See
new_from_model_full
for a way to control this.- Parameters:
model – a
GMenuModel
- classmethod new_from_model_full(model: MenuModel, flags: PopoverMenuFlags) → Widget
Creates a
GtkPopoverMenu
and populates it according tomodel
.The created buttons are connected to actions found in the action groups that are accessible from the parent widget. This includes the
GtkApplicationWindow
to which the popover belongs. Actions can also be added usinginsert_action_group
on the parent widget or on any of its parent widgets.- Parameters:
model – a
GMenuModel
flags – flags that affect how the menu is created
Methods
- class PopoverMenu
- add_child(child: Widget, id: str) → bool
Adds a custom widget to a generated menu.
For this to work, the menu model of
popover
must have an item with acustom
attribute that matchesid
.- Parameters:
child – the
GtkWidget
to addid – the ID to insert
child
at
- get_flags() → PopoverMenuFlags
Returns the flags that
popover
uses to create/display a menu from its model.Added in version 4.14.
- remove_child(child: Widget) → bool
Removes a widget that has previously been added with
add_child()
- Parameters:
child – the
GtkWidget
to remove
- set_flags(flags: PopoverMenuFlags) → None
Sets the flags that
popover
uses to create/display a menu from its model.If a model is set and the flags change, contents are rebuilt, so if setting properties individually, set flags before model to avoid a redundant rebuild.
Added in version 4.14.
- Parameters:
flags – a set of
GtkPopoverMenuFlags
Properties
- class PopoverMenu
- props.flags: PopoverMenuFlags
The flags that
popover
uses to create/display a menu from its model.If a model is set and the flags change, contents are rebuilt, so if setting properties individually, set flags before model to avoid a redundant rebuild.
Added in version 4.14.