There are separate examples in Qt for input and for output, so you should easily be able to analyse.