Using QT Creator how can I set the execution level as requireAdministrator

核能气质少年 提交于 2019-11-30 19:46:02

问题


Basically I need to be able to edit files that require administrator privileges to edit. I know that in Visual Studio a manifest file is used for this - but I understand QT does not have these.


回答1:


You can use a manifest with Qt applications, but you'll have to do it semi-manually. This blog post Embedding Application Manifest and Version Information using QtCreator shows one way of doing it (adapt the manifest to suit your needs).




回答2:


GimbleJune 29, 2012 at 8:59 AM Just to add another less-intrusive way with VS2010 and Qt4.8+, from http://www.qtcentre.org/threads/29107-win32-how-to-modify-the-manifest-with-qmake

win32 {
CONFIG += embed_manifest_exe
QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:level=\'requireAdministrator\'
}

That works for a minimal case (just requiring administrative rights)

Still works on Qt 5.6 and MSVC 2015.




回答3:


This code compatible with Qt and Visual Studio 2015 IDE.

QMAKE_LFLAGS += /MANIFESTUAC:$$quote(\"level=\'requireAdministrator\' uiAccess=\'false\'\")


来源:https://stackoverflow.com/questions/5686977/using-qt-creator-how-can-i-set-the-execution-level-as-requireadministrator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!