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

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.

Note: Qt Safe Renderer is currently in Technical Preview status for Qt Quick Ultralite. A full Qt Safe Renderer support for Qt Quick Ultralite comes in the QSR 2.2 release.

The text can be changed at 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 it must be a string matching the item id.

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

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

Property Documentation

color : color

This property holds the text color. It can be changed at runtime if runtimeEditable is set to true.

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

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

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

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

fillColor : color

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


font.bold : bool

This property holds whether the font style is bold.


font.height : real

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


font.italic : bool

This property holds whether the font style is italic.


font.pixelSize : int

This property holds the font size in pixels.

Note: Using this property makes the font device-dependent.


horizontalAlignment : enumeration

This property holds the horizontal alignment of the text within the SafeText width. The 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.

Note: objectName is mandatory and it must be a string matching the item id.

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 at runtime.

When set to true, text and color can be changed at runtime.

When set to true and generating the QtSafeRenderer files, a .qpf2 file is generated for each font type that you use in your project's dynamic SafeText QML types.

By default, this is set to false and an .srb file is generated.


text : string

This property holds a text to display. It can be changed at runtime if runtimeEditable is set to true.


verticalAlignment : enumeration

This property holds the vertical alignment of the text within the SafeText height. The vertical 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 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 at 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 position of the text.


y : real

This property holds the y-coordinate position of the text.


Available under certain Qt licenses.
Find out more.