I was thinking about mvuori said - adding calls to processEvents(): split up your openFile() method into more steps, so that Qt has time to handle events. So maybe you could try something like this:

- openFile() just opens the file and reads the contents into a QString.
- QTextEdit::setPlainText( const QString &) is a slot, so have your MainWindow emit a signal: textLoaded( const QString & ) after the file is read, and connect this to the QTextEdit slot.
- make your highlightLines() a slot also, and emit a signal from MainWindow to connect to it.

If you do this, then instead of doing lots of processing with no event handling, you let Qt do the signals and slots thing it was designed to do well. You can always call a slot as if it was an ordinary function (which it is), but when you use the signal / slot mechanism instead, Qt can do its magic.

Thank you very much, however I think I should fill a bug report.
Probably not a good idea, because the Qt folks would probably tell you to redesign your code to do things the Qt way instead of the C++ way.