Emulate terminal with QTextEdit, but how to log to text file sequentially
I am writing a serial terminal with qtextedit, and want to log the output to file.
But a lot of insert/delete actions takes in the terminal while I have to log out the final text.
and a feature is, terminal(text) only display the limited lines, the oldest lines will be discarded, but the log file has to record all.
now, my implement is, while one 'return' is input, the previous line will be write to the log file.
but if doing this, the last line without 'return' will be lost.
So, is there any better way?