@Joachim-W
I looked at your progress here but have not had an opportunity to examine it further. But here are a couple of points which strike me:
readLine() should read one line from input. It should not matter whether that comes from terminal (with or without pasting) or redirection. The fact that you seem to say sometimes it reads/returns one line and sometimes multiple lines should not happen. A line is a line. The QTextStream may (or may not) buffer further lines which are available (e.g. from redirection) but readLine() should only return a single line.
When reading from redirection you can/should be able to read till "end of file", indicating the end of input. But when reading from terminal there is no "end", user could type more at any time, so no "end of file".
You should not need a timer. One QSocketNotifier notification should be received when there is one or more lines/input available. Process all lines which are available (however you test for that) then exit. That should be it for the redirection case. For the terminal case at some future point a new QSocketNotifier notification should arrive at which point you re-enter and process whatever is available anew. You will need a readLine() call which returns with "empty" when no more input is currently available, or a test which says whether there is any further input available at this point before calling a blocking readLine(). It may be better to call readAll(): that should return all data which is available at that point, I believe, but will not block like readLine() when no further data is there. This will work for redirection too.