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