Obsolete Members for Menu

The following members of QML type Menu 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

方法

方法文档编制

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 项。

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

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

另请参阅 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 项。

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

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

另请参阅 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 项。

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

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

另请参阅 Popup::open() .

动作 actionAt ( int index )

Returns the action at index ,或 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 to the end of this menu.

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

void addItem ( Item item )

添加 item to the end of the list of items.

void addMenu ( Menu menu )

添加 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.

注意: 不像 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).

另请参阅 popup() and Popup::close() .

void insertAction ( int index , 动作 action )

插入 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 )

插入 item at index .

void insertMenu ( int index , Menu menu )

插入 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 )

返回项在 index ,或 null if it does not exist.

Returns the sub-menu at index ,或 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 )

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

动作 takeAction ( int index )

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

注意: 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 .

注意: 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.

注意: The ownership of the menu is transferred to the caller.

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