QProcess Class is used to start external programs and to communicate with them.
create a new QProcess and input args to /bin/sh.
Below code has been tested working.
Thanks to p3c0, if not, answer below will not be available :
QProcess *myProcess = new QProcess;
QStringList args;
args<"-c"<<"sudo -S ifconfig eth0 192.168.100.1 < /var/passwd.txt");
myProcess->start("/bin/sh",args);