Fix a few initialization order warnings.
Properly support Qt5 in the message handler.

This avoids losing the message context, and avoids triggering the recursion
detection fallback when daisy-chaining message handlers. This also fixes
the missing newlines in the console output as that's a missing in the
recursion fallback code in Qt.