I tested out Kaleb Pederson's answer, and found a more consise way than the solution he presented (though I have to thank him for pointing me to the right direction):
QTextStream qtin(stdin);
QString line = qtin.readLine(); // This is how you read the entire line
QString word;
qtin >> word; // This is how you read a word (separated by space) at a time.
In other words, you don't really need QFile as your middleman.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…