API Documentation
Documentation for developing SailfishOS applicationsLabel QML Type
A text label More...
Import Statement: | import Sailfish.Silica 1.0 |
Inherited By: |
Properties
- highlighted : bool
- palette : Palette
- truncationMode : enumeration
Detailed Description
The Label type provides a Sailfish-styled text label. The default color, font family and font size are set according to the current ambience.
The label text is simply set with the text property:
import Sailfish.Silica 1.0 Label { text: "Hello, world!" }
When choosing different colors or font properties it is recommended that the values exposed by the Theme object are used. For example:
import Sailfish.Silica 1.0 Label { text: "Hello, world!" color: Theme.highlightColor font.family: Theme.fontFamilyHeading }
See the Theme documentation for guidelines on styling text colors and sizes in Sailfish OS.
Label inherits the QtQuick Text type, so any properties, signals and methods of Text (such as the color and font.family properties in the example above) are also available to Label objects. See the Text documentation for its full list of available properties, signals and methods.
In most cases Label
should be used in preference to the Text type.
Default Text
property values
Labels use the following Text property values by default:
- color: Theme.primaryColor
- font.pixelSize: Theme.fontSizeMedium
- textFormat:
Text.PlainText
- elide: if the text is truncated with
TruncationMode.Elide
, this elides automatically according to the currenthorizontalAlignment
, otherwise this isText.ElideNone
Property Documentation
Specifies whether an label should appear highlighted.
By default a label will be highlighted when a control it is a member of is highlighted.
palette : Palette |
The label's color palette.
If one or more of a parent control's {SilicaControl::palette}{palette} colors have been overridden those changes will be reflected here. Otherwise the values will follow the equivalent Theme color properties.
Specifies the effect to apply to the end of the text string if it does not fit within the bounds of this item. This is one of:
- TruncationMode.None (default)
- TruncationMode.Elide
- TruncationMode.Fade
TruncationMode.Fade is the preferred truncation mode in Sailfish OS. Note it will only be applied to single line text; multiline text will fall back to TruncationMode.Elide.
Note that setting Text::elide will override truncationMode.