C

SafeText QML Type

Provides a safety-critical QML text type that can be validated using Qt Safe Renderer's output verification. More...

Import Statement: import QtQuickUltralite.SafeRenderer
Since: Qt Quick Ultralite 2.9

Properties

Detailed Description

The Qt Safe Renderer provides a Qt Safe Layout Tool that generates font data for a SafeText item. Qt Safe Renderer's output verification can ensure the integrity of a safe item from the display content.

The text can be changed on runtime if runtimeEditable is set to true.

The following code provides an example of the SafeText type:

SafeText {
    id: safeText
    objectName: "safeText"
    x: 256
    y: 8
    text: "Safe text.."
    color: "black"
    fillColor: "white"  // optional, but recommended to use fillColor for controlled background color
    font.pixelSize: 12
}

Note: objectName is mandatory and must be set to same as item id as string.

Note: SafeText is not rendered properly if the font size is longer than 175.

See also Qt Quick Ultralite application with safety-critical items.

Property Documentation

color : color

This property holds the text color. This can be changed on run-time if the runtimeEditable is set to true.

The following code provides an example of a green text defined using hexadecimal notation:

SafeText {
    color: "#00FF00"
    text: "green text"
}

The following code provides an example of a steel blue text defined using an SVG color name:

SafeText {
    color: "steelblue"
    text: "blue text"
}

fillColor : color

This property holds the background fill color for text. This can be changed at run-time if the runtimeEditable is set to true.


font.bold : bool

This property holds whether the font weight is bold.


font.height : real

This property holds the text's height. The default value is 64.


font.italic : bool

This property holds whether the font weight is italic.


font.pixelSize : int

This property holds the font size in pixels.

Using this property makes the font device dependent.


horizontalAlignment : enumeration

This property holds the horizontal alignment of the text within the SafeText width. Horizontal alignment follows the natural alignment of the text. For example, the text that is read from left to right will be aligned to the left.

The valid values for horizontalAlignment are SafeText.AlignLeft, SafeText.AlignRight, SafeText.AlignHCenter, and SafeText.AlignJustify.


objectName : string

This property holds the text item's object name. This must be set to same as the item id as a string.

SafeText {
    id: foo
    objectName: "foo"
    // ...
}

opacity : real

This property holds the opacity of the item. Opacity is specified as a number between 0.0 (fully transparent) and 1.0 (fully opaque). The default value is 1.0.


runtimeEditable : bool

This property holds whether it is possible to change text and color on run-time.

When set to true and you generate the QtSafeRenderer files, a .qpf2 file is generated for each font type that you use in dynamic SafeText QML types in your project. By default, this is set to false and an .srb file is generated.

When set to true, text and color can be changed on the run-time.


text : string

This property holds a text to display. This can be changed on run-time if the runtimeEditable is set to true.


verticalAlignment : enumeration

This property holds the vertical alignment of the text within the SafeText height. Horizontal alignment follows the natural alignment of the text.

The valid values for verticalAlignment are SafeText.AlignTop, SafeText.AlignBottom, and SafeText.AlignVCenter.


width : real

This property holds the text's width. The default value is 128.


wrapMode : enumeration

This property holds how the text will be wrapped. The text will be wrapped only if an explicit width has been set.

  • SafeText.NoWrap (default) - no wrapping will be performed.
  • SafeText.WordWrap - wrapping is done on word boundaries only.

    Note: SafeText.WordWrap is not supported in SafeText when runtimeEditable is set to true.

  • SafeText.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
  • SafeText.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.

x : real

This property holds the x-coordinate in the text's position.


y : real

This property holds the y-coordinate in the text's position.


Available under certain Qt licenses.
Find out more.