Obsolete Members for Menu | Qt Quick Controls 5.12.5

Qt 5.12 | Qt Quick Controls | QML Types | Obsolete Members for Menu

Qt 5.12.5 Reference Documentation

# Obsolete Members for Menu

The following members of QML type Menu are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Methods

- Action actionAt(int index)
- void addAction(Action action)
- void addItem(Item item)
- void addMenu(Menu menu)
- void dismiss()
- void insertAction(int index, Action action)
- void insertItem(int index, Item item)
- void insertMenu(int index, Menu menu)
- Item itemAt(int index)
- Menu menuAt(int index)
- void moveItem(int from, int to)
- void popup(MenuItem item = null)
- void popup(Item parent, MenuItem item = null)
- void popup(point pos, MenuItem item = null)
- void popup(Item parent, point pos, MenuItem item = null)
- void popup(real x, real y, MenuItem item = null)
- void popup(Item parent, real x, real y, MenuItem item = null)
- void removeAction(Action action)
- void removeItem(Item item)
- void removeMenu(Menu menu)
- Action takeAction(int index)
- MenuItem takeItem(int index)
- Menu takeMenu(int index)

## Method Documentation

void popup(real x, real y, MenuItem item = null)
void popup(Item parent, real x, real y, MenuItem item = null)

Opens the menu at the specified position x, y in the popups coordinate system, that is, a coordinate relative to its parent item.

The menu can be optionally aligned to a specific menu item.

This documentation was introduced in QtQuick.Controls 2.3 (Qt 5.10).

See also dismiss() and Popup::open().

void popup(point pos, MenuItem item = null)
void popup(Item parent, point pos, MenuItem item = null)

Opens the menu at the specified position pos in the popups coordinate system, that is, a coordinate relative to its parent item.

The menu can be optionally aligned to a specific menu item.

This documentation was introduced in QtQuick.Controls 2.3 (Qt 5.10).

See also Popup::open().

void popup(MenuItem item = null)
void popup(Item parent, MenuItem item = null)

Opens the menu at the mouse cursor on desktop platforms that have a mouse cursor available, and otherwise centers the menu over its parent item.

The menu can be optionally aligned to a specific menu item.

This documentation was introduced in QtQuick.Controls 2.3 (Qt 5.10).

See also Popup::open().

Action actionAt(int index)

Returns the action at index, or `null` if the index is not valid or there is no action at the specified index.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

void addAction(Action action)

Adds action to the end of this menu.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

void addItem(Item item)

Adds item to the end of the list of items.

void addMenu(Menu menu)

Adds menu as a sub-menu to the end of this menu.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

void dismiss()

Closes all menus in the hierarchy that this menu belongs to.

Note: Unlike close() that only closes a menu and its sub-menus, `dismiss()` closes the whole hierarchy of menus, including the parent menus. In practice, `close()` is suitable e.g. for implementing navigation in a hierarchy of menus, and `dismiss()` is the appropriate method for closing the whole hierarchy of menus.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

See also popup() and Popup::close().

void insertAction(int index, Action action)

Inserts action at index. The index is within all items in the menu.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

void insertItem(int index, Item item)

Inserts item at index.

void insertMenu(int index, Menu menu)

Inserts menu as a sub-menu at index. The index is within all items in the menu.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

Item itemAt(int index)

Returns the item at index, or `null` if it does not exist.

Menu menuAt(int index)

Returns the sub-menu at index, or `null` if the index is not valid or there is no sub-menu at the specified index.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

void moveItem(int from, int to)

Moves an item from one index to another.

void removeAction(Action action)

Removes and destroys the specified action.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

void removeItem(Item item)

Removes and destroys the specified item.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

void removeMenu(Menu menu)

Removes and destroys the specified menu.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

Action takeAction(int index)

Removes and returns the action at index. The index is within all items in the menu.

Note: The ownership of the action is transferred to the caller.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

MenuItem takeItem(int index)

Removes and returns the item at index.

Note: The ownership of the item is transferred to the caller.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).

Menu takeMenu(int index)

Removes and returns the menu at index. The index is within all items in the menu.

Note: The ownership of the menu is transferred to the caller.

This method was introduced in QtQuick.Controls 2.3 (Qt 5.10).