There is already one that works for all AbstractOutput classes and properly restores the state of QDebug.