跳转至

MenuButton

继承

Button

简要描述

单击时会弹出PopupMenu的特殊按钮。

描述

单击时会弹出PopupMenu的特殊按钮。

可以使用get_popup().add_item("My Item Name")。在此PopupMenu中创建新项目。

成员

类型 属性名 默认值
int action_mode 0
bool flat true
int focus_mode 0
bool switch_on_hover false
bool toggle_mode true

方法

返回值类型 方法名称
PopupMenu get_popup() const
void set_disable_shortcuts(disabled: bool)

信号

  • about_to_show

当此MenuButton的PopupMenu即将显示时发出。


常量

成员说明

  • int action_mode
Default 0
setter set_action_mode(value)
getter get_action_mode
  • bool flat
Default true
setter set_flat(value)
getter is_flat
  • int focus_mode
Default 0
setter set_focus_mode(value)
getter get_focus_mode
  • bool switch_on_hover
Default false
setter set_switch_on_hover(value)
getter is_switch_on_hover
  • bool toggle_mode
Default true
setter set_toggle_mode(value)
getter is_toggle_mode

方法说明

  • get_popup get_popup() const

返回此按钮中包含的PopupMenu


  • set_disable_shortcuts set_disable_shortcuts(disabled: bool)

如果true,则禁用快捷方式,并且不能使用快捷方式来触发按钮。