C

Building for QNX

To use Qt Safe Renderer and its examples on QNX target devices, you need to set up and build the following projects:

ProjectDescription.pro file name.pro file pathBuild with Qt version
Qt Safe Layout ToolQt Safe Layout Tool generates safe layout data for Qt Safe Renderer.qtsafelayouttool.pro<Qt installation directory>/Src/QtSafeRenderer-<version>/tools/qtsafelayouttoolQt that is compiled for your host platform.
Qt Safe Resource Compiler ToolQt Safe Resource Compiler Tool generates safe resource files for Qt Safe Renderer.qtsafercctool.pro<Qt installation directory>/Src/QtSafeRenderer-<version>/tools/qtsafercctoolQt that is compiled for your host platform.
Qt Safe RendererWhen you build Qt Safe Renderer, the Qt Safe Renderer plugins are built and installed under the current kit in Qt Creator (that is, the Qt version that you use for building the projects).qtsaferenderer.pro<Qt installation directory>/Src/QtSafeRenderer-<version>Qt compiled for QNX.

For QNX, Qt Safe Renderer provides the following examples:

ProjectDescription.pro file name.pro file pathBuild with Qt version
The Qt Cluster exampleQt Cluster demonstrates rendering on QNX and recovery from the main UI failure.qtcluster.pro<Qt installation directory>/Examples/QtSafeRenderer-<version>/saferenderer/qtclusterQt compiled for QNX
The Telltales exampleWhen you build Telltales, you must use the Qt compiled for QNX. Then the QNX specific part of the project is built. The Process Watcher project is built together with the QNX specific Telltales. Telltales uses layout files from the Qt Cluster example.examples.pro<Qt installation directory>/Examples/QtSafeRenderer-<version>/saferendererQt compiled for QNX

Building Qt Safe Tools

Note: Since Qt Safe Renderer release 1.1.2 Qt Safe Layout and Qt Safe Resource Compiler Tools are available as a pre-built package in <Qt installation directory>/Tools/QSR-<version>/bin. You can skip this step if you do not intend to build the tool yourself.

To build Qt Safe Tools in Qt Creator, execute the steps listed in the following topics for qtsaferenderer.pro. Build the project with a Qt version that is compiled for your host platform. After a successful build, qtsafelayouttool and qtsafercctool are generated under <Qt installation directory>/<Qt version>/<compiler>/bin.

Opening Project to Edit Mode

Open the project to Qt Creator's Edit mode:

  1. Start Qt Creator.
  2. Select File > Open File or Project and browse to a .pro file.
  3. Select Open.
  4. In the Configure Project page, choose a kit for building the project and select Configure Project.

The project is now open in Qt Creator's Edit mode.

Adding a Custom Build Step <make install>

Note: If you are building some of the examples in Qt Safe Renderer, you can skip this step.

Before building Qt Safe Renderer, add a custom build step that installs the binary file under <Qt installation directory>/<Qt version/<compiler>/bin in the Qt version that is used for building the project:

  1. Select a Projects mode.
  2. In the kit, select Build.
  3. Select Build Settings > Build Steps > Add Build Step > Make.
  4. In Make arguments, add install.
  5. Select the Edit mode. Your custom build step is automatically saved.

Building the Project

Build the project in the Edit mode by selecting Build > Build Project "<project name>".

Setting Up Cross Compiling Environment

Copy the Qt Safe Layout Tool binary file (qtsafelayouttool) and Qt Safe Resource Compiler Tool binary file (qtsafercctool) to the directory in your cross compiling environment that contains the qmake executable.

You find the pre-built qtsafelayouttool and qtsafercctool in <Qt installation directory>/Tools/QSR-<version>/bin or, when self-built, in <Qt installation directory>/<Qt version>/<compiler>/bin.

For example, copy the Qt Safe Tool binary files under /opt/qt5.9.2/install/qnx7-armle-v7/bin/.

Building Qt Safe Renderer and Examples

To build Qt Safe Renderer and its examples for QNX, you must first configure and build Qt from sources. You must also add some modifications to the Qt Base source code so that it supports Qt Safe Renderer for QNX. The following topics describe how you get Qt sources and how you build Qt from sources:

Getting Qt Sources

You can download the Qt source code via your Qt Account. This step is optional, you can use the QNX binaries from the Qt Online Installer instead.

You can also get the Qt sources via the Git version control system. Qt Wiki has instructions for getting Qt sources via Git, see https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code.

Setting QNX Pipeline via Window Property

From Qt Safe Renderer 1.2 onwards, you must define the QNX pipeline by setting the _q_platform_qnxPipeline window property as follows:

if defined(Q_OS_QNX)
    view.setProperty("_q_platform_qnxPipeline", 1);
endif

The pipeline value 1 is the default value for the background layer. For more information, see Configuring Screen in QNX.

You find the full example code under saferenderer/qtcluster/main.cpp.

QNX Pipeline Support in Qt Base

From Qt 5.15.3 onwards, the QNX pipeline property is supported in Qt Base. The pipeline property is used when the QNX Screen platform adaption is used.

If you are using earlier Qt version, you must modify the Qt Base as follows to enable the pipeline:

src/plugins/platforms/qnx/qqnxwindow.cpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 1d3d609..22a00d3 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -225,6 +225,21 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW
 if (windowGroup.isValid() && windowGroup.canConvert<QByteArray>())
     joinWindowGroup(windowGroup.toByteArray());

+    QVariant pipelineValue = window->property("_q_platform_qnxPipeline");
+    if (pipelineValue.isValid()) {
+        bool ok = false;
+        int pipeline = pipelineValue.toInt(&ok);
+        if (ok) {
+            qWindowDebug() << "Set pipeline value to" << pipeline;
+
+            Q_SCREEN_CHECKERROR(
+                screen_set_window_property_iv(m_window, SCREEN_PROPERTY_PIPELINE, &pipeline),
+                "Failed to set window pipeline");
+        } else {
+            qWindowDebug() << "Invalid pipeline value:" << pipelineValue;
+        }
+    }
+
 int debug = 0;
 if (Q_UNLIKELY(debug_fps())) {
     debug |= SCREEN_DEBUG_GRAPH_FPS;

Setting QNX Pipeline for Safety-Critical Application

To enable the QNX pipeline in your safety-critical application, you must define the value of QSR_QNX_SCREEN_PIPELINE environment variable. The environment variable must be set before running the application in the QNX target device.

Configuring and Building Qt for QNX

Configure Qt for QNX by running the following command in a terminal (note that the following example configures Qt 5.9.3)):

./configure -confirm-license -commercial -release -xplatform \
qnx-armle-v7-qcc -opengl es2 -nomake tools -skip qtactiveqt \
-skip qtandroidextras -skip qtconnectivity -skip qtdoc -skip qtenginio \
-skip qtlocation -skip qtmacextras -skip qtsensors -skip qtserialport \
-skip qtwinextras -skip qtx11extras -openssl -nomake examples -nomake tests \
-force-debug-info -separate-debug-info -skip qtwebengine -no-fontconfig \
-prefix /opt/qt5.9.3/install/qnx7-armle-v7

Build Qt with the make command in the terminal. You can run make with as many cores on your host machine as you desire. In our example we use six cores:

make -j6

Enabling OpenWFD platform adaptation

It is possible to use the OpenWFD platform adaption instead of QNX Screen with the Qualcomm Snapdragon hardware. You can enable the OpenWFD plugin by setting following environment variables when building the Qt Safe Renderer:

WFD_INCLUDE
WFD_LIB

The WFD_INCLUDE path must point to the folder where the OpenWFD headers are located. The WFD_LIB path must point to the folder where the OpenWFD libraries are located.

Building Qt Safe Renderer and Examples

After you have built Qt, you can start Qt Creator and build the Qt Safe Renderer and its QNX specific examples, Telltales and Qt Cluster.

In Qt Creator, you must set the path to the QNX environment script as follows:

  • Select Tools > Options > Devices > QNX.
  • Select Add.
  • Enter the path for the file qnxsdp-env.sh that is included in QNX Software Development Platform (SDP). By default, the path is /opt/qnx700 in Linux and C:\qnx700 in Windows.
  • Select Open.
  • Select Generate kits.

After you have set the path, it appears to Host and Target fields under Configuration information.

To enable a QNX build in Qt Creator, you must set the Qt version with Qt Safe Renderer related QNX modifications to your kit. See Adding Kits.

You can build Qt Safe Renderer, Telltales, and Qt Cluster for QNX with the same steps that are described in Building Qt Safe Tools. Just remember that in Opening Project to Edit Mode, you must select the kit that contains the Qt Safe Renderer changes for QNX. The kit is selected from the Configure Project page.

When you build the Telltales example, also a Process Watcher project is built.

Deploying to Target Device

You need to deploy Qt Cluster and Telltales to your QNX target device. When you deploy Telltales, also Process Watcher is deployed. You can deploy the projects in Qt Creator with the following steps:

  1. Connect your target device to Qt Creator.
  2. In Qt Creator, select Tools > Options > Devices > Devices.
  3. Under Device, select your QNX device.
  4. Select Deploy Qt libraries.

After you have deployed the Qt libraries to your QNX device, also all Qt Safe Renderer libraries are copied to the device.

Available under certain Qt licenses.
Find out more.