Working with UI Files
You can use Qt Design Studio for designing an application UI that contains both safety-critical and non-safety elements in the .ui.qml files. This topic introduces the Qt Safe Renderer related functionality in Qt Design Studio.
- Select File > New File > Qt Quick Files > QtQuick UI File.
- Select Choose.
- In Component name, type the name for the component, that is, the .ui.qml file.
- Select Finish.
Add Qt Safe Renderer safety-critical QML types to the UI Files as follows:
- In Components, type safe to the search field to find the Qt Safe Renderer components. Those should appear under QT SAFERENDERER (1).
- Drag and drop components to the Form Editor (2).
- The QML code is automatically genereted to Text Editor.
import Qt.SafeRenderer 2.0indicates you are using Qt Safe Renderer 2.0 components on your application (3).
For more information how to use Qt Design Studio, see Qt Design Studio Manual.
- Update the
SAFE_QMLvariable in project file (.pro) with a path and name of your .ui.qml file. For example, if your UI file is under the Indicators example directory:
SAFE_QML = $$PWD/MainForm.ui.qml $$PWD/MyTest.ui.qml.
- In main.cpp, read the generated layout data as follows:
static QSafeLayoutResourceReader layout("/layoutData/MyTest/MyTest.ui.srl");
You can add the UI files to your project's tree directory as follows:
- In the Edit mode, select your application.
- In the context menu, select Add Existing Files and browse to your UI file.
- Select Open.
For more information about how to work with Qt Safe Renderer in Qt Creator, see Enabling Qt Safe Renderer in Project.
Available under certain Qt licenses.
Find out more.