C
在 INTEGRITY 上运行示例
有关如何为 INTEGRITY 构建示例的说明,请参阅 构建 INTEGRITY。这些说明提供了构建 INTEGRITY 上 Qt 安全渲染器的总体步骤。
但是,请注意,这些步骤假设您已经具有在 INTEGRITY 环境中工作的经验。如果您需要有关如何为 INTEGRITY 构建 Qt 安全渲染器的更多详细信息,您可以联系 Qt 咨询服务。
运行 Qt 集群示例的解决方案
INTEGRITY 中的 Qt 集群示例存在已知错误 QTAUTO-1003。错误描述在 1.6 节的发行说明中。您可以在 <Qt 安装目录>/Docs/QtSafeRenderer-<版本> 中找到发行说明。以下代码更改提供了解决错误的解决方案,直到提供正确修复为止。
要包含 INTEGRITY 所需的文件,请按照以下方式更新 <Qt 安装目录>/Examples/QtSafeRenderer-<版本>/saferenderer/qtcluster/main.cpp
#include "etcprovider.h" #include "crasher.h" #ifdef Q_OS_INTEGRITY #include <mqueue.h> #include <unistd.h> #define ATTACH_POINT "saferenderer" #endif
要添加实际解决方案功能,请按照以下方式更新 <Qt 安装目录>/Examples/QtSafeRenderer-<版本>/saferenderer/qtcluster/main.cpp
qputenv("QT_QPA_WM_DISP_ID", "0");
qputenv("QT_QPA_WM_LAYER", "3");
#ifdef Q_OS_INTEGRITY
sleep(10);
mqd_t mqdes;
if ((mqdes = mq_open(ATTACH_POINT, O_WRONLY)) != MQ_FAILED) {
qWarning() << "Dummy op success";
mq_close(mqdes);
} else {
qFatal("Failed to open connection to safe renderer. Dummy.");
}
#endif
QGuiApplication app(argc, argv);以下代码提供所有必需更新的 .patch 文件格式
diff --git a/examples/qtcluster/main.cpp b/examples/qtcluster/main.cpp
index 0c7e836..4fbd3e9 100644
--- a/examples/qtcluster/main.cpp
+++ b/examples/qtcluster/main.cpp
@@ -65,6 +65,11 @@
#include "etcprovider.h"
#include "crasher.h"
+#ifdef Q_OS_INTEGRITY
+#include <mqueue.h>
+#include <unistd.h>
+#define ATTACH_POINT "saferenderer"
+#endif
int main(int argc, char **argv)
{
@@ -78,6 +83,18 @@ int main(int argc, char **argv)
qputenv("QT_QPA_WM_DISP_ID", "0");
qputenv("QT_QPA_WM_LAYER", "3");
+ #ifdef Q_OS_INTEGRITY
+ sleep(10);
+ mqd_t mqdes;
+
+ if ((mqdes = mq_open(ATTACH_POINT, O_WRONLY)) != MQ_FAILED) {
+ qWarning() << "Dummy op success";
+ mq_close(mqdes);
+ } else {
+ qFatal("Failed to open connection to safe renderer. Dummy.");
+ }
+ #endif
+
QGuiApplication app(argc, argv);
//Find the ip address to the environment variable在某些 Qt 许可下提供。
了解更多。