User Tools

Site Tools


DzMenu

Provides a menu widget for use in menu bars, context menus, and other popup menus.

More...

Inherits :

Methods

DAZ Script
NumberaddAction ( DzAction action, Number menuId=0 )
NumberaddAction ( String className, Number menuId=0 )
NumberaddItem ( String label, Number menuId=0 )
NumberaddItem ( String label, QObject receiver, String member, Number menuId=0 )
voidaddSeparator ( Number menuId=0 )
NumberaddSubMenu ( String label, Number menuId=0 )
Numberexec ( Point pos )
NumberfindSubMenu ( String label, Number menuId=0 )
BooleanisEmpty ()
voidsetItemCheckable ( Number itemId, Boolean checkable )
voidsetItemChecked ( Number itemId, Boolean checked )
voidsetItemData ( Number itemId, Object data )
voidsetItemEnabled ( Number itemId, Boolean enabled )

Signals

voidactivated ( Number id )

Detailed Description

TODO: Add detailed description.

Methods


Number : addAction( DzAction action, Number menuId=0 )

Adds the DzAction to the given menu.

Parameter(s):

  • action - The action to add to the menu.
  • menuId - The menu id of the menu to add the action to. If zero, the action will be added to the root menu.

Return Value:

  • The item id of the action in the menu.

Number : addAction( String className, Number menuId=0 )

Convenience method to find an action by class name and add it to the menu.

Parameter(s):

  • className - The class name of the action to add to the menu.
  • menuId - The menu id of the menu to add the action to. If zero, the action will be added to the root menu.

Return Value:

  • The item id of the action in the menu.

Number : addItem( String label, Number menuId=0 )

Adds an entry to the given menu.

Parameter(s):

  • label - The label that will appear in the menu for the user to activate the item.
  • menuId - The menu id of the menu to add the item to. If zero, the item will be added to the root menu.

Return Value:

  • The item id of the new menu item.

Number : addItem( String label, QObject receiver, String member, Number menuId=0 )

Adds an entry to the given menu and connects it to a slot.

Parameter(s):

  • label - The label that will appear in the menu for the user to activate the item.
  • receiver - The QObject to connect the activate signal to.
  • member - The name of the slot/signal that will be connected to the activate signal.
  • menuId - The menu id of the menu to add the item to. If zero, the item will be added to the root menu.

Return Value:

  • The item id of the new menu item.

void : addSeparator( Number menuId=0 )

Adds a separator bar to the given menu.

Parameter(s):

  • menuId - The menu id of the menu to add the separator to. If zero, the separator will be added to the root menu.

Number : addSubMenu( String label, Number menuId=0 )

Creates a submenu with the given label, and adds it to the given menu.

Parameter(s):

  • label - The text that will appear in the parent menu for the user to activate the submenu.
  • menuId - The menu id of the parent menu to add the submenu to. If zero, the submenu will be added to the root menu.

Return Value:

  • The menu id of the new submenu.

Number : exec( Point pos )

Shows the menu to the user.

Parameter(s):

  • pos - The global position that the menu will be displayed at.

Return Value:

  • The item id of the item selected by the user, or -1 if the menu was closed without the user selecting an item.

Number : findSubMenu( String label, Number menuId=0 )

Finds a submenu with the given label, and returns its menu id.

Parameter(s):

  • label - The text that appears in the parent menu for the user to activate the submenu.
  • menuId - The menu id of the parent menu to search for the submenu in. If zero, the root menu will be searched.

Return Value:

  • The menu id of the new submenu, -1 if submenu is not found.

Boolean : isEmpty()

Return Value:

  • true if no items or actions have been added to the menu, otherwise false.

void : setItemCheckable( Number itemId, Boolean checkable )

Sets weather or not an item is checkable.

Parameter(s):

  • itemId - The id of the item.
  • checkable - If true, the item is made checkable.

void : setItemChecked( Number itemId, Boolean checked )

Sets weather or not an item is checked.

Parameter(s):

  • itemId - The id of the item.
  • checked - If true, the item is checked.

void : setItemData( Number itemId, Object data )

Sets the data for the item.

Parameter(s):

  • itemId - The id of the item.
  • data - The data to set.

void : setItemEnabled( Number itemId, Boolean enabled )

Sets whether or not an item is enabled.

Parameter(s):

  • itemId - The id of the item.
  • enabled - If true, the action is enabled.

Since:

  • 4.11.0.208

Signals


void : activated( Number id )

Signature:“activated(int)”

Emitted when the user selects an item in the menu, or one of its submenus.

Parameter(s):

  • id - The item id of the item the user selected.