You could just use QProcess to run exactly the same sudo command as your user would from the command line.