没有,自己调用win32 API,下面是示例(isAdminUserLogin(),自己写,判断当前用户是否是管理员)
void MainWindow::runApplicationAsAdmin(const QString &strPathExe)//{{{
{
#ifdef Q_WS_WIN
if (IsAdminUserLogin())
{
QDesktopServices::openUrl(QUrl::fromLocalFile(strPathExe));
}
else
{
std::wstring str = strPathExe.toStdWString();
SHELLEXECUTEINFO shExecInfo;
shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
shExecInfo.fMask = NULL;
shExecInfo.hwnd = NULL;
shExecInfo.lpVerb = L"runas";
shExecInfo.lpFile = str.c_str();
shExecInfo.lpParameters = NULL;
shExecInfo.lpDirectory = NULL;
shExecInfo.nShow = SW_MAXIMIZE;
shExecInfo.hInstApp = NULL;
ShellExecuteEx(&shExecInfo);
}
#elif defined(Q_WS_X11)
QDesktopServices::openUrl(QUrl::fromLocalFile(strPathExe));
#endif
close();
}//}}}