MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QML MenuItem Element

One menu item that is provided inside the menu. More...

Inherits Item

This element was introduced in qt-components 4.7.

Properties

Signals

Detailed Description

One menu item that is provided inside the menu. Each menu item displays some text and can be associated with a custom action that is performed on the clicked signal:

 // Creates a menu with different menu items.
  Menu {
      id: myMenu
      // visualParent is needed to specify the grayed out area.
      visualParent: pageStack
      MenuLayout {
          MenuItem {text: "Red"; onClicked: { colorRect.color = "darkred" } }
          MenuItem {text: "Green"; onClicked: { colorRect.color = "darkgreen" }}
          MenuItem {text: "Blue"; onClicked: { colorRect.color = "darkblue" }}
      }
  }

Common API

  signal clicked
  default property string text

See also Menu.

Property Documentation

platformStyle : Style

Property default is MenuItemStyle{}.

Property for styling the component.


text : string

Property default is "".

The text displayed on the menu item.


Signal Documentation

MenuItem::clicked ()

Signal for detecting the button clicks. If the menu is pressed and released, then this signal will be emitted.

The signal handler, onClicked(), can bind to state changes or other actions.