QT_HARMONYOS_能力_方向

HarmonyOS 能力的屏幕方向策略。

该属性于 Qt 6.12 中引入。

注意:该 属性目前处于技术预览阶段,未来版本中可能会发生变化。

注意: 仅当目标平台为 HarmonyOS 时,才使用此 属性。

指定应用程序能力的屏幕方向策略。该值将在构建 HAP 包时写入entry/src/main/module.json5 文件。支持的值是 HarmonyOSmodule.json5 架构中定义的方向字符串,包括auto_rotation 、auto_rotation_restricted 、landscape 、portrait 、auto_rotation_landscape 、auto_rotation_portrait 和locked 。若值不被识别,将在 HAP 构建时被忽略并触发警告。

如果未设置此属性,则该字段将从清单中省略,并采用系统默认值。

set_target_properties(myapp PROPERTIES
    QT_HARMONYOS_ABILITY_ORIENTATION "landscape"
)

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.