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

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.


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).


© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.