QT_WINDOWS_APP_PROJECT_EXECUTION_LEVEL

生成的 Windows 应用程序清单中的 UAC 执行级别。

该属性自 Qt 6.11.1 起引入。

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

设置应用程序清单中requestedExecutionLevel 元素的level 属性,该清单由Qt自动为使用qt_add_executable()构建的Windows可执行文件生成。

有效值为:

  • asInvoker — 以与启动应用程序的进程相同的权限运行(默认)。
  • highestAvailable — 以当前用户可获得的最高权限运行。
  • requireAdministrator — 仅以管理员权限运行;如有必要,Windows 将提示提升权限。

如果提供的值无效,将触发 CMake 警告,并使用 `asInvoker `。

如果目标在其源代码中已提供.manifest 文件,Qt 将跳过自动生成清单的过程,此时该属性将无效。

set_target_properties(myapp PROPERTIES
    QT_WINDOWS_APP_PROJECT_EXECUTION_LEVEL "requireAdministrator"
)

另请参阅 《Qt for Windows - 部署》和QT_WINDOWS_APP_PROJECT_IDENTIFIER。

© 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.