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
- color : color
- fillColor : color
- font.bold : bool
- font.family : string
- font.italic : bool
- font.pixelSize : int
- height : real
- horizontalAlignment : enumeration
- objectName : string
- opacity : real
- runtimeEditable : bool
- text : string
- verticalAlignment : enumeration
- width : real
- wrapMode : enumeration
- x : real
- y : real
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.
Important considerations
- The Qt Quick Ultralite Safe Renderer module uses a custom text layout pipeline that does not depend on Static or Spark font engine.
- The Qt Safe Renderer layout and font files are placed to ImageFiles.files and BinaryFiles.files instead of FontFiles.files as described in Qt Quick Ultralite application with safety-critical items.
- The font properties under
MCU.Config
are not used by the Qt Quick Ultralite Safe Renderer module. The resource configuration for the static SafeText items is done with the ImageFiles properties. For the dynamic SafeText items configuration is done with the BinaryFiles properties. - Only ISO/IEC 8859-1:1998 (Latin-1) characters are supported with the dynamic SafeText.
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 }
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.
Note: This property can't be changed at runtime.
font.family : string |
Sets the family name of the font.
Note: The default font family is Lato.
Note: This property can't be changed at runtime.
font.italic : bool |
This property holds whether the font style is italic.
Note: This property can't be changed at runtime.
font.pixelSize : int |
This property holds the font size in pixels.
Note: Using this property makes the font device-dependent.
Note: This property can't be changed at runtime.
height : real |
This property holds the text item height. The default value is 64
.
Note: Text will be cropped if the item area is too small.
horizontalAlignment : enumeration |
This property holds the horizontal alignment of the text within the bounds of SafeText::width. The horizontal alignment follows the natural alignment of the text. For example, the text that is read from left-to-right is aligned to the left.
The valid values for horizontalAlignment
are SafeText.AlignLeft
, SafeText.AlignRight
, SafeText.AlignHCenter
, and SafeText.AlignJustify
.
Note: This property can't be changed at runtime.
objectName : string |
This property holds the text item's object name. objectName
is mandatory and it must be a string matching the item id
.
SafeText { id: foo objectName: "foo" // ... }
Note: This property can't be changed at runtime.
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
.
Note: This property can't be changed at runtime.
width : real |
This property holds the text item width. The default value is 128
.
Note: Text will be cropped if the item area is too small.
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 whenruntimeEditable
is set totrue
.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.
Note: This property can't be changed at runtime.
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.