Ubuntu.Components Menu

Menu defines a context menu or submenu structure of a MenuBar

Import Statement: import Ubuntu.Components 1.3

Properties

  • data : list<Object>

Methods

Detailed Description

Example usage:

import QtQuick 2.4
import Ubuntu.Components 1.3
Menu {
    text: "&File"
    MenuGroup {
        Action {
            text: "&New"
            shortcut: "Ctrl+N"
        }
        Action {
            text: "&Open"
            shortcut: "Ctrl+O"
        }
    }
    Menu {
        text: "Recent Files"
        ActionList {
            Action { text: "1.txt" }
            Action { text: "2.txt" }
            Action { text: "3.txt" }
        }
    }
    Action {
        action: Action {
            text: "E&xit"
            shortcut: "Ctrl+X"
        }
    }
}

Property Documentation

[default] data : list<Object>

List of objects representing menu items within the menu.

Currently supports Menu, Action, AcionList & MenuGroup objects.

Note: Item object which do not support platformItem will not be exported for native menus.

Method Documentation

appendObject(object o)

Add a object tto the menu

dismiss()

Dismiss and destroy the menu popup.

insertObject(int index, object o)

Inserts an item at the index in the menu.

Currently supports Menu, Action, AcionList & MenuGroup objects.

Note: Item object which do not support platformItem will not be exported for native menus.

removeObject(object o)

Removes the item from the menu.

show(point point)

Show the menu popup at the given point