Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
Public Slots | Signals | Properties | List of all members
MenuItem Class Reference

Represents an action in a Menu or MenuBar. More...

Public Slots

void toggle ()
 Toggle the checked property, if the menu item is checkable.
void trigger ()
 Triggers the menu item.

Signals

void triggered ()
 Emitted when the trigger() slot is called.

Properties

Action action
 The Action associated with the menu item.
bool autoRepeat
 Whether the menu item should accept auto-repeated key events.
bool checkable
 Whether the menu item is checkable.
bool checked
 Whether the menu item is checked.
bool enabled
 Whether the menu item is enabled.
ExclusiveGroup exclusiveGroup
 The exclusive group to which the menu item belongs.
string iconName
 The name of the icon to be used.
string iconSource
 The source of the icon to be used.
variant shortcut
 The keyboard shorcut used to trigger the menu item.
string text
 The text to be displayed in the menu item.
bool visible
 Whether the menu item is visible in the menu.

Detailed Description

Represents an action in a Menu or MenuBar.

The MenuItem is used to add an action to a Menu or MenuBar. MenuItem can also be used to display a visual item that is declared as its child.

Menu {
id: menu
MenuItem {
text: qsTr("MenuItem One")
onTriggered: console.log(qsTr("MenuItem One triggered"))
}
MenuItem {
text: qsTr("MenuItem Two")
onTriggered: console.log(qsTr("MenuItem Two triggered"))
}
Menu {
title: qsTr("Submenu One")
MenuItem {
text: qsTr("MenuItem Three")
onTriggered: console.log(qsTr("MenuItem Three triggered"))
}
}
}
menuBar: MenuBar {
filters: [
MenuItem {
checkable: true
text: qsTr("Filter One")
onTriggered: console.log(qsTr("Filter One selected"))
},
MenuItem {
checkable: true
text: qsTr("Filter Two")
onTriggered: console.log(qsTr("Filter Two selected"))
}
]
MenuItem {
text: qsTr("MenuItem One")
onTriggered: console.log(qsTr("MenuItem One triggered"))
}
MenuItem {
text: qsTr("MenuItem Two")
onTriggered: console.log(qsTr("MenuItem Two triggered"))
}
MenuItem {
text: qsTr("Menu CheckBox")
}
}
MenuItem {
Slider {}
}
}
See Also
Menu, MenuBar
Examples:
actions.qml, menus.qml, and tabs.qml.

Member Function Documentation

void MenuItem::toggle ( )
slot

Toggle the checked property, if the menu item is checkable.

See Also
checkable, checked
void MenuItem::trigger ( )
slot

Triggers the menu item.

See Also
triggered()
void MenuItem::triggered ( )
signal

Emitted when the trigger() slot is called.

See Also
trigger()

Property Documentation

Action * MenuItem::action
readwrite

The Action associated with the menu item.

The default value is null.

See Also
Action
bool MenuItem::autoRepeat
readwrite

Whether the menu item should accept auto-repeated key events.

The default value is true.

bool MenuItem::checkable
readwrite

Whether the menu item is checkable.

The default value is false.

bool MenuItem::checked
readwrite

Whether the menu item is checked.

The default value is false.

bool MenuItem::enabled
readwrite

Whether the menu item is enabled.

The default value is true.

ExclusiveGroup * MenuItem::exclusiveGroup
readwrite

The exclusive group to which the menu item belongs.

The default value is null.

See Also
ExclusiveGroup
string MenuItem::iconName
readwrite

The name of the icon to be used.

See Also
iconSource
string MenuItem::iconSource
readwrite

The source of the icon to be used.

See Also
iconName
bool MenuItem::visible
readwrite

Whether the menu item is visible in the menu.

The default value is true.