Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

file-io

uac

qt

qt4

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.

like image 759
Dartoxian Avatar asked Sep 03 '25 16:09

Dartoxian


2 Answers

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

like image 162
Mat Avatar answered Sep 05 '25 08:09

Mat


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.

like image 42
edin-m Avatar answered Sep 05 '25 09:09

edin-m