解決方案一
在pro檔案中添加
解決方案二
假設需要管理者權限的程式為MyApp.exe
把MyApp.exe,MyApp.exe.manifest,mt.exe放到同一個目錄,打開指令提示符,cd到該目錄,執行下面指令
mt.exe -manifest "MyApp.exe.manifest" -outputresource:"MyApp.exe";#1
MyApp.exe.manifest參考内容如下
mt.exe在C:\Program Files\Windows Kits下,裝過visual studio的。
為了友善,做成批處理,下載下傳:QT管理者權限更新檔