C
QSR_ADD_SAFE_LAYOUT
Adds safe layout files to the project.
The command is defined in Qt Safe Renderer which can be loaded as follows:
find_package(Qt6 REQUIRED COMPONENTS SafeRenderer SafeRendererTools SafePlatformAdaptation)
This command was introduced in Qt Safe Renderer 2.1.
Synopsis
qsr_add_safelayout(target
[SAFE_QMLS var_name]
[OUTPUT_PATH layout_data_path]
[SAFE_RESOURCE resource_file]
[SAFE_LANGUAGES language]
[SAFE_TRANSLATION dir_name]
[INPUT_RESOURCES dir_name]
)Description
The safe layout is added to target that you have defined as a dependency in add_dependencies. SAFE_QMLS defines the QML files with safety-critical UI element. The layout data is generated to OUTPUT_PATH. SAFE_RESOURCE defines the path of generated safe data asset file (.qrc). Qt Safe Layout Tool loads INPUT_RESOURCES to find the resource data asset.
SAFE_LANGUAGES lists the languages are contain localized strings for safety-critical UI elements. SAFE_TRANSLATION defines a path of safe translation files.
Example
set (safeqmls
"main.qml"
)
# Resource files are passed to qtsafelayouttool
set(resource_files
"qml.qrc"
)
#resource.bin is loaded by qtsafelayouttool to find the resource data asset.
qt6_add_binary_resources(resources_myproject ${resource_files} DESTINATION resource.bin)
qsr_add_safelayout(generatelayout_myproject SAFE_QMLS ${safeqmls}
OUTPUT_PATH ${CMAKE_CURRENT_LIST_DIR}/layoutData
SAFE_RESOURCE "${CMAKE_CURRENT_LIST_DIR}/safeasset.qrc"
INPUT_RESOURCES resource.bin)Available under certain Qt licenses.
Find out more.