API Documentation

Documentation for developing SailfishOS applications

MenuItem QML Type

Encapsulates a menu item More...

Import Statement: import Sailfish.Silica 1.0
Inherits:

Label

Properties

Signals

Detailed Description

The MenuItem type provides a menu item for use in PullDownMenu, PushUpMenu and ContextMenu. A MenuItem provides a text label and activation handling via the onClicked handler.

 PushUpMenu {
     MenuItem {
         text: "Option 1"
         onClicked: console.log("Clicked option 1")
     }
     MenuItem {
         text: "Option 2"
         onClicked: console.log("Clicked option 2")
     }
 }

Property Documentation

color : color

This property holds the color of the text.


down : bool

This property is true when the item is selected.


font.bold : bool

True if the displayed text is rendered in bold, otherwise false.


font.capitalization : enumeration

Holds the capitalization formatting that is applied to the displayed text. This is one of:

  • Font.MixedCase - no capitalization is applied (the default value)
  • Font.AllUppercase - all text is rendered in uppercase
  • Font.AllLowercase - all text is rendered in lowercase
  • Font.SmallCaps - text is rendered in small caps
  • Font.Capitalize - the first letter of each word is rendered with a capital letter

font.family : string

The name of the font family for rendering the displayed text.


font.italic : bool

True if the displayed text is rendered in italics, otherwise false.


font.letterSpacing : real

Controls the spacing (in pixels) between letters in the displayed text.

Specifying a positive value increases the default spacing between letters, and specifying a negative value decreases this spacing.


font.pixelSize : int

The size of the displayed text, in pixels.


font.pointSize : real

The size of the displayed text, in points.


font.strikeout : bool

True if the displayed text is rendered with a strikeout style, otherwise false.


font.underline : bool

True if the displayed text is rendered with an underline, otherwise false.


font.weight : enumeration

Holds the weight value for rendering the displayed text.

This is one of the following (listed from lightest to heaviest):

  • Font.Light
  • Font.Normal (the default value)
  • Font.DemiBold
  • Font.Bold
  • Font.Black

font.wordSpacing : real

Controls the spacing (in pixels) between words in the displayed text.

Specifying a positive value increases the default spacing between words, and specifying a negative value decreases this spacing.


horizontalAlignment : enumeration

Sets the horizontal alignment of the text. The valid values are: Text.AlignLeft, Text.AlignRight, Text.AlignHCenter and Text.AlignJustify.

The default value is Text.AlignHCenter


text : string

This property holds the text to display in the MenuItem.


Signal Documentation

clicked()

This signal is emitted when the MenuItem is clicked.


delayedClick()

This signal is emitted when the MenuItem is clicked and the menu (ContextMenu, PullDownMenu, PushUpMenu) containing the MenuItem is closed.


earlyClick()

This signal is emitted before the click transition is played, for example to preload content shown when clicked() is emitted.


We use cookies to improve your user experience and to help us to develop our services. By continuing to browse the site, you approve of our use of cookies.